[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/22] target/i386: remove unnecessary truncations
From: |
Paolo Bonzini |
Subject: |
[PATCH 04/22] target/i386: remove unnecessary truncations |
Date: |
Fri, 22 Dec 2023 19:15:45 +0100 |
gen_lea_v_seg (called by gen_add_A0_ds_seg) already zeroes any
bits of s->A0 beyond s->aflag. It does so before summing the
segment base and, if not in 64-bit mode, also after summing it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/emit.c.inc | 4 +---
target/i386/tcg/translate.c | 2 --
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc
index 82da5488d47..d444d83e534 100644
--- a/target/i386/tcg/emit.c.inc
+++ b/target/i386/tcg/emit.c.inc
@@ -1242,9 +1242,7 @@ static void gen_LDMXCSR(DisasContext *s, CPUX86State
*env, X86DecodedInsn *decod
static void gen_MASKMOV(DisasContext *s, CPUX86State *env, X86DecodedInsn
*decode)
{
- tcg_gen_mov_tl(s->A0, cpu_regs[R_EDI]);
- gen_extu(s->aflag, s->A0);
- gen_add_A0_ds_seg(s);
+ gen_lea_v_seg(s, s->aflag, cpu_regs[R_EDI], R_DS, s->override);
if (s->prefix & PREFIX_DATA) {
gen_helper_maskmov_xmm(tcg_env, OP_PTR1, OP_PTR2, s->A0);
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index a16eb8d4008..73b83e07e23 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -4183,7 +4183,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
tcg_gen_mov_tl(s->A0, cpu_regs[R_EBX]);
tcg_gen_ext8u_tl(s->T0, cpu_regs[R_EAX]);
tcg_gen_add_tl(s->A0, s->A0, s->T0);
- gen_extu(s->aflag, s->A0);
gen_add_A0_ds_seg(s);
gen_op_ld_v(s, MO_8, s->T0, s->A0);
gen_op_mov_reg_v(s, MO_8, R_EAX, s->T0);
@@ -5835,7 +5834,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
gen_update_cc_op(s);
gen_update_eip_cur(s);
tcg_gen_mov_tl(s->A0, cpu_regs[R_EAX]);
- gen_extu(s->aflag, s->A0);
gen_add_A0_ds_seg(s);
gen_helper_monitor(tcg_env, s->A0);
break;
--
2.43.0
- [PATCH 00/22] target/i386: first part of TCG changes for 9.0, Paolo Bonzini, 2023/12/22
- [PATCH 01/22] target/i386: optimize computation of JL and JLE from flags, Paolo Bonzini, 2023/12/22
- [PATCH 02/22] target/i386: speedup JO/SETO after MUL or IMUL, Paolo Bonzini, 2023/12/22
- [PATCH 03/22] target/i386: remove unnecessary arguments from raise_interrupt, Paolo Bonzini, 2023/12/22
- [PATCH 04/22] target/i386: remove unnecessary truncations,
Paolo Bonzini <=
- [PATCH 08/22] target/i386: avoid trunc and ext for MULX and RORX, Paolo Bonzini, 2023/12/22
- [PATCH 11/22] target/i386: do not decode string source/destination into decode->mem, Paolo Bonzini, 2023/12/22
- [PATCH 12/22] target/i386: do not clobber A0 in POP translation, Paolo Bonzini, 2023/12/22
- [PATCH 14/22] target/i386: split eflags computation out of gen_compute_eflags, Paolo Bonzini, 2023/12/22
- [PATCH 18/22] target/i386: prepare for implementation of STOS/SCAS in new decoder, Paolo Bonzini, 2023/12/22