From: Paolo Bonzini Date: Wed, 24 Apr 2024 10:20:17 +0000 (+0200) Subject: target/i386/tcg: move fcom/fcomp differentiation to gen_helper_fp_arith_ST0_FT0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a1ec17e3fa652f3d24e4bdac48bc53dde4c967b;p=thirdparty%2Fqemu.git target/i386/tcg: move fcom/fcomp differentiation to gen_helper_fp_arith_ST0_FT0 There is only one call site for gen_helper_fp_arith_ST0_FT0(), therefore there is no need to check the op1 == 3 in the caller. Once this is done, eliminate the goto to that call site. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 68f41b3742..4b77cff8ee 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -1485,6 +1485,7 @@ static void gen_helper_fp_arith_ST0_FT0(int op) break; case 3: gen_helper_fcom_ST0_FT0(tcg_env); + gen_helper_fpop(tcg_env); break; case 4: gen_helper_fsub_ST0_FT0(tcg_env); @@ -2460,36 +2461,28 @@ static void gen_x87(DisasContext *s, X86DecodedInsn *decode) tcg_gen_qemu_ld_i32(s->tmp2_i32, s->A0, s->mem_index, MO_LEUL); gen_helper_flds_FT0(tcg_env, s->tmp2_i32); - goto fp_arith_ST0_FT0; + gen_helper_fp_arith_ST0_FT0(op & 7); + break; case 0x10 ... 0x17: /* fixxxl */ tcg_gen_qemu_ld_i32(s->tmp2_i32, s->A0, s->mem_index, MO_LEUL); gen_helper_fildl_FT0(tcg_env, s->tmp2_i32); - goto fp_arith_ST0_FT0; + gen_helper_fp_arith_ST0_FT0(op & 7); + break; case 0x20 ... 0x27: /* fxxxl */ tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0, s->mem_index, MO_LEUQ); gen_helper_fldl_FT0(tcg_env, s->tmp1_i64); - goto fp_arith_ST0_FT0; + gen_helper_fp_arith_ST0_FT0(op & 7); + break; case 0x30 ... 0x37: /* fixxx */ tcg_gen_qemu_ld_i32(s->tmp2_i32, s->A0, s->mem_index, MO_LESW); gen_helper_fildl_FT0(tcg_env, s->tmp2_i32); - goto fp_arith_ST0_FT0; - -fp_arith_ST0_FT0: - { - int op1 = op & 7; - - gen_helper_fp_arith_ST0_FT0(op1); - if (op1 == 3) { - /* fcomp needs pop */ - gen_helper_fpop(tcg_env); - } - } + gen_helper_fp_arith_ST0_FT0(op & 7); break; case 0x08: /* flds */