target/arm: Use tcg_constant in disas_fp*

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220426163043.100432-18-richard.henderson@linaro.org
[PMM: Restore incorrectly removed free of t_false in disas_fp_csel()]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2022-04-26 09:30:13 -07:00 committed by Peter Maydell
parent 4cb05eb74c
commit e45b201348
1 changed files with 7 additions and 16 deletions

View File

@ -5875,7 +5875,7 @@ static void handle_fp_compare(DisasContext *s, int size,
tcg_vn = read_fp_dreg(s, rn); tcg_vn = read_fp_dreg(s, rn);
if (cmp_with_zero) { if (cmp_with_zero) {
tcg_vm = tcg_const_i64(0); tcg_vm = tcg_constant_i64(0);
} else { } else {
tcg_vm = read_fp_dreg(s, rm); tcg_vm = read_fp_dreg(s, rm);
} }
@ -5985,7 +5985,6 @@ static void disas_fp_compare(DisasContext *s, uint32_t insn)
static void disas_fp_ccomp(DisasContext *s, uint32_t insn) static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
{ {
unsigned int mos, type, rm, cond, rn, op, nzcv; unsigned int mos, type, rm, cond, rn, op, nzcv;
TCGv_i64 tcg_flags;
TCGLabel *label_continue = NULL; TCGLabel *label_continue = NULL;
int size; int size;
@ -6029,9 +6028,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
label_continue = gen_new_label(); label_continue = gen_new_label();
arm_gen_test_cc(cond, label_match); arm_gen_test_cc(cond, label_match);
/* nomatch: */ /* nomatch: */
tcg_flags = tcg_const_i64(nzcv << 28); gen_set_nzcv(tcg_constant_i64(nzcv << 28));
gen_set_nzcv(tcg_flags);
tcg_temp_free_i64(tcg_flags);
tcg_gen_br(label_continue); tcg_gen_br(label_continue);
gen_set_label(label_match); gen_set_label(label_match);
} }
@ -6052,7 +6049,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
static void disas_fp_csel(DisasContext *s, uint32_t insn) static void disas_fp_csel(DisasContext *s, uint32_t insn)
{ {
unsigned int mos, type, rm, cond, rn, rd; unsigned int mos, type, rm, cond, rn, rd;
TCGv_i64 t_true, t_false, t_zero; TCGv_i64 t_true, t_false;
DisasCompare64 c; DisasCompare64 c;
MemOp sz; MemOp sz;
@ -6097,9 +6094,8 @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
read_vec_element(s, t_false, rm, 0, sz); read_vec_element(s, t_false, rm, 0, sz);
a64_test_cc(&c, cond); a64_test_cc(&c, cond);
t_zero = tcg_const_i64(0); tcg_gen_movcond_i64(c.cond, t_true, c.value, tcg_constant_i64(0),
tcg_gen_movcond_i64(c.cond, t_true, c.value, t_zero, t_true, t_false); t_true, t_false);
tcg_temp_free_i64(t_zero);
tcg_temp_free_i64(t_false); tcg_temp_free_i64(t_false);
a64_free_cc(&c); a64_free_cc(&c);
@ -6881,7 +6877,6 @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
int type = extract32(insn, 22, 2); int type = extract32(insn, 22, 2);
int mos = extract32(insn, 29, 3); int mos = extract32(insn, 29, 3);
uint64_t imm; uint64_t imm;
TCGv_i64 tcg_res;
MemOp sz; MemOp sz;
if (mos || imm5) { if (mos || imm5) {
@ -6912,10 +6907,7 @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
} }
imm = vfp_expand_imm(sz, imm8); imm = vfp_expand_imm(sz, imm8);
write_fp_dreg(s, rd, tcg_constant_i64(imm));
tcg_res = tcg_const_i64(imm);
write_fp_dreg(s, rd, tcg_res);
tcg_temp_free_i64(tcg_res);
} }
/* Handle floating point <=> fixed point conversions. Note that we can /* Handle floating point <=> fixed point conversions. Note that we can
@ -6933,7 +6925,7 @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
tcg_fpstatus = fpstatus_ptr(type == 3 ? FPST_FPCR_F16 : FPST_FPCR); tcg_fpstatus = fpstatus_ptr(type == 3 ? FPST_FPCR_F16 : FPST_FPCR);
tcg_shift = tcg_const_i32(64 - scale); tcg_shift = tcg_constant_i32(64 - scale);
if (itof) { if (itof) {
TCGv_i64 tcg_int = cpu_reg(s, rn); TCGv_i64 tcg_int = cpu_reg(s, rn);
@ -7092,7 +7084,6 @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
} }
tcg_temp_free_ptr(tcg_fpstatus); tcg_temp_free_ptr(tcg_fpstatus);
tcg_temp_free_i32(tcg_shift);
} }
/* Floating point <-> fixed point conversions /* Floating point <-> fixed point conversions