[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 21/26] target/i386: Remove MemOp argument to gen_op_j*_ecx
From: |
Richard Henderson |
Subject: |
[PATCH v3 21/26] target/i386: Remove MemOp argument to gen_op_j*_ecx |
Date: |
Sat, 1 Oct 2022 07:09:30 -0700 |
These functions are always passed aflag, so we might as well
read it from DisasContext directly. While we're at it, use
a common subroutine for these two functions.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/i386/tcg/translate.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index cf23ae6e5e..9294f12f66 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -676,20 +676,21 @@ static void gen_exts(MemOp ot, TCGv reg)
gen_ext_tl(reg, reg, ot, true);
}
-static inline
-void gen_op_jnz_ecx(DisasContext *s, MemOp size, TCGLabel *label1)
+static void gen_op_j_ecx(DisasContext *s, TCGCond cond, TCGLabel *label1)
{
tcg_gen_mov_tl(s->tmp0, cpu_regs[R_ECX]);
- gen_extu(size, s->tmp0);
- tcg_gen_brcondi_tl(TCG_COND_NE, s->tmp0, 0, label1);
+ gen_extu(s->aflag, s->tmp0);
+ tcg_gen_brcondi_tl(cond, s->tmp0, 0, label1);
}
-static inline
-void gen_op_jz_ecx(DisasContext *s, MemOp size, TCGLabel *label1)
+static inline void gen_op_jz_ecx(DisasContext *s, TCGLabel *label1)
{
- tcg_gen_mov_tl(s->tmp0, cpu_regs[R_ECX]);
- gen_extu(size, s->tmp0);
- tcg_gen_brcondi_tl(TCG_COND_EQ, s->tmp0, 0, label1);
+ gen_op_j_ecx(s, TCG_COND_EQ, label1);
+}
+
+static inline void gen_op_jnz_ecx(DisasContext *s, TCGLabel *label1)
+{
+ gen_op_j_ecx(s, TCG_COND_NE, label1);
}
static void gen_helper_in_func(MemOp ot, TCGv v, TCGv_i32 n)
@@ -1183,7 +1184,7 @@ static TCGLabel *gen_jz_ecx_string(DisasContext *s)
{
TCGLabel *l1 = gen_new_label();
TCGLabel *l2 = gen_new_label();
- gen_op_jnz_ecx(s, s->aflag, l1);
+ gen_op_jnz_ecx(s, l1);
gen_set_label(l2);
gen_jmp_rel_csize(s, 0, 1);
gen_set_label(l1);
@@ -1286,7 +1287,7 @@ static void gen_repz(DisasContext *s, MemOp ot,
* before rep string_insn
*/
if (s->repz_opt) {
- gen_op_jz_ecx(s, s->aflag, l2);
+ gen_op_jz_ecx(s, l2);
}
gen_jmp_rel_csize(s, -cur_insn_len(s), 0);
}
@@ -1306,7 +1307,7 @@ static void gen_repz2(DisasContext *s, MemOp ot, int nz,
gen_update_cc_op(s);
gen_jcc1(s, (JCC_Z << 1) | (nz ^ 1), l2);
if (s->repz_opt) {
- gen_op_jz_ecx(s, s->aflag, l2);
+ gen_op_jz_ecx(s, l2);
}
gen_jmp_rel_csize(s, -cur_insn_len(s), 0);
}
@@ -7397,16 +7398,16 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
case 0: /* loopnz */
case 1: /* loopz */
gen_op_add_reg_im(s, s->aflag, R_ECX, -1);
- gen_op_jz_ecx(s, s->aflag, l2);
+ gen_op_jz_ecx(s, l2);
gen_jcc1(s, (JCC_Z << 1) | (b ^ 1), l1);
break;
case 2: /* loop */
gen_op_add_reg_im(s, s->aflag, R_ECX, -1);
- gen_op_jnz_ecx(s, s->aflag, l1);
+ gen_op_jnz_ecx(s, l1);
break;
default:
case 3: /* jcxz */
- gen_op_jz_ecx(s, s->aflag, l1);
+ gen_op_jz_ecx(s, l1);
break;
}
--
2.34.1
- [PATCH v3 03/26] target/i386: Remove cur_eip argument to gen_exception, (continued)
- [PATCH v3 03/26] target/i386: Remove cur_eip argument to gen_exception, Richard Henderson, 2022/10/01
- [PATCH v3 11/26] target/i386: Create cur_insn_len, cur_insn_len_i32, Richard Henderson, 2022/10/01
- [PATCH v3 04/26] target/i386: Remove cur_eip, next_eip arguments to gen_interrupt, Richard Henderson, 2022/10/01
- [PATCH v3 12/26] target/i386: Remove cur_eip, next_eip arguments to gen_repz*, Richard Henderson, 2022/10/01
- [PATCH v3 13/26] target/i386: Introduce DISAS_JUMP, Richard Henderson, 2022/10/01
- [PATCH v3 14/26] target/i386: Truncate values for lcall_real to i32, Richard Henderson, 2022/10/01
- [PATCH v3 15/26] target/i386: Create eip_next_*, Richard Henderson, 2022/10/01
- [PATCH v3 16/26] target/i386: Use DISAS_TOO_MANY to exit after gen_io_start, Richard Henderson, 2022/10/01
- [PATCH v3 20/26] target/i386: Use gen_jmp_rel for DISAS_TOO_MANY, Richard Henderson, 2022/10/01
- [PATCH v3 17/26] target/i386: Create gen_jmp_rel, Richard Henderson, 2022/10/01
- [PATCH v3 21/26] target/i386: Remove MemOp argument to gen_op_j*_ecx,
Richard Henderson <=
- [PATCH v3 19/26] target/i386: Use gen_jmp_rel for gen_jcc, Richard Henderson, 2022/10/01
- [PATCH v3 18/26] target/i386: Use gen_jmp_rel for loop, repz, jecxz insns, Richard Henderson, 2022/10/01
- [PATCH v3 22/26] target/i386: Merge gen_jmp_tb and gen_goto_tb into gen_jmp_rel, Richard Henderson, 2022/10/01
- [PATCH v3 23/26] target/i386: Create eip_cur_tl, Richard Henderson, 2022/10/01
- [PATCH v3 24/26] target/i386: Add cpu_eip, Richard Henderson, 2022/10/01
- [PATCH v3 25/26] target/i386: Inline gen_jmp_im, Richard Henderson, 2022/10/01
- [PATCH v3 26/26] target/i386: Enable TARGET_TB_PCREL, Richard Henderson, 2022/10/01
- Re: [PATCH v3 00/26] target/i386: pc-relative translation blocks, Paolo Bonzini, 2022/10/01