target/arm: Use clear_vec_high more effectively

Do not explicitly store zero to the NEON high part
when we can pass !is_q to clear_vec_high.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200519212453.28494-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2020-05-19 14:24:53 -07:00 committed by Peter Maydell
parent 5c27392dd0
commit e1f778596e

View File

@ -900,11 +900,10 @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
{ {
/* This always zero-extends and writes to a full 128 bit wide vector */ /* This always zero-extends and writes to a full 128 bit wide vector */
TCGv_i64 tmplo = tcg_temp_new_i64(); TCGv_i64 tmplo = tcg_temp_new_i64();
TCGv_i64 tmphi; TCGv_i64 tmphi = NULL;
if (size < 4) { if (size < 4) {
MemOp memop = s->be_data + size; MemOp memop = s->be_data + size;
tmphi = tcg_const_i64(0);
tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), memop); tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), memop);
} else { } else {
bool be = s->be_data == MO_BE; bool be = s->be_data == MO_BE;
@ -922,12 +921,13 @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
} }
tcg_gen_st_i64(tmplo, cpu_env, fp_reg_offset(s, destidx, MO_64)); tcg_gen_st_i64(tmplo, cpu_env, fp_reg_offset(s, destidx, MO_64));
tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
tcg_temp_free_i64(tmplo); tcg_temp_free_i64(tmplo);
tcg_temp_free_i64(tmphi);
clear_vec_high(s, true, destidx); if (tmphi) {
tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
tcg_temp_free_i64(tmphi);
}
clear_vec_high(s, tmphi != NULL, destidx);
} }
/* /*
@ -6934,7 +6934,6 @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
read_vec_element(s, tcg_resh, rm, 0, MO_64); read_vec_element(s, tcg_resh, rm, 0, MO_64);
do_ext64(s, tcg_resh, tcg_resl, pos); do_ext64(s, tcg_resh, tcg_resl, pos);
} }
tcg_gen_movi_i64(tcg_resh, 0);
} else { } else {
TCGv_i64 tcg_hh; TCGv_i64 tcg_hh;
typedef struct { typedef struct {
@ -6964,9 +6963,11 @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
write_vec_element(s, tcg_resl, rd, 0, MO_64); write_vec_element(s, tcg_resl, rd, 0, MO_64);
tcg_temp_free_i64(tcg_resl); tcg_temp_free_i64(tcg_resl);
if (is_q) {
write_vec_element(s, tcg_resh, rd, 1, MO_64); write_vec_element(s, tcg_resh, rd, 1, MO_64);
}
tcg_temp_free_i64(tcg_resh); tcg_temp_free_i64(tcg_resh);
clear_vec_high(s, true, rd); clear_vec_high(s, is_q, rd);
} }
/* TBL/TBX /* TBL/TBX
@ -7003,18 +7004,22 @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
* the input. * the input.
*/ */
tcg_resl = tcg_temp_new_i64(); tcg_resl = tcg_temp_new_i64();
tcg_resh = tcg_temp_new_i64(); tcg_resh = NULL;
if (is_tblx) { if (is_tblx) {
read_vec_element(s, tcg_resl, rd, 0, MO_64); read_vec_element(s, tcg_resl, rd, 0, MO_64);
} else { } else {
tcg_gen_movi_i64(tcg_resl, 0); tcg_gen_movi_i64(tcg_resl, 0);
} }
if (is_tblx && is_q) {
if (is_q) {
tcg_resh = tcg_temp_new_i64();
if (is_tblx) {
read_vec_element(s, tcg_resh, rd, 1, MO_64); read_vec_element(s, tcg_resh, rd, 1, MO_64);
} else { } else {
tcg_gen_movi_i64(tcg_resh, 0); tcg_gen_movi_i64(tcg_resh, 0);
} }
}
tcg_idx = tcg_temp_new_i64(); tcg_idx = tcg_temp_new_i64();
tcg_regno = tcg_const_i32(rn); tcg_regno = tcg_const_i32(rn);
@ -7033,9 +7038,12 @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
write_vec_element(s, tcg_resl, rd, 0, MO_64); write_vec_element(s, tcg_resl, rd, 0, MO_64);
tcg_temp_free_i64(tcg_resl); tcg_temp_free_i64(tcg_resl);
if (is_q) {
write_vec_element(s, tcg_resh, rd, 1, MO_64); write_vec_element(s, tcg_resh, rd, 1, MO_64);
tcg_temp_free_i64(tcg_resh); tcg_temp_free_i64(tcg_resh);
clear_vec_high(s, true, rd); }
clear_vec_high(s, is_q, rd);
} }
/* ZIP/UZP/TRN /* ZIP/UZP/TRN
@ -7072,7 +7080,7 @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
} }
tcg_resl = tcg_const_i64(0); tcg_resl = tcg_const_i64(0);
tcg_resh = tcg_const_i64(0); tcg_resh = is_q ? tcg_const_i64(0) : NULL;
tcg_res = tcg_temp_new_i64(); tcg_res = tcg_temp_new_i64();
for (i = 0; i < elements; i++) { for (i = 0; i < elements; i++) {
@ -7123,9 +7131,12 @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
write_vec_element(s, tcg_resl, rd, 0, MO_64); write_vec_element(s, tcg_resl, rd, 0, MO_64);
tcg_temp_free_i64(tcg_resl); tcg_temp_free_i64(tcg_resl);
if (is_q) {
write_vec_element(s, tcg_resh, rd, 1, MO_64); write_vec_element(s, tcg_resh, rd, 1, MO_64);
tcg_temp_free_i64(tcg_resh); tcg_temp_free_i64(tcg_resh);
clear_vec_high(s, true, rd); }
clear_vec_high(s, is_q, rd);
} }
/* /*