[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 37/40] target/i386: Split out gen_cmpxchg8b, gen_cmpxchg16b
From: |
Richard Henderson |
Subject: |
[PULL 37/40] target/i386: Split out gen_cmpxchg8b, gen_cmpxchg16b |
Date: |
Sat, 4 Feb 2023 06:33:07 -1000 |
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/i386/tcg/translate.c | 48 ++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 17 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 7e0b2a709a..a82131d635 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -2993,6 +2993,34 @@ static void gen_sty_env_A0(DisasContext *s, int offset,
bool align)
#include "emit.c.inc"
#include "decode-new.c.inc"
+static void gen_cmpxchg8b(DisasContext *s, CPUX86State *env, int modrm)
+{
+ gen_lea_modrm(env, s, modrm);
+
+ if ((s->prefix & PREFIX_LOCK) &&
+ (tb_cflags(s->base.tb) & CF_PARALLEL)) {
+ gen_helper_cmpxchg8b(cpu_env, s->A0);
+ } else {
+ gen_helper_cmpxchg8b_unlocked(cpu_env, s->A0);
+ }
+ set_cc_op(s, CC_OP_EFLAGS);
+}
+
+#ifdef TARGET_X86_64
+static void gen_cmpxchg16b(DisasContext *s, CPUX86State *env, int modrm)
+{
+ gen_lea_modrm(env, s, modrm);
+
+ if ((s->prefix & PREFIX_LOCK) &&
+ (tb_cflags(s->base.tb) & CF_PARALLEL)) {
+ gen_helper_cmpxchg16b(cpu_env, s->A0);
+ } else {
+ gen_helper_cmpxchg16b_unlocked(cpu_env, s->A0);
+ }
+ set_cc_op(s, CC_OP_EFLAGS);
+}
+#endif
+
/* convert one instruction. s->base.is_jmp is set if the translation must
be stopped. Return the next pc value */
static bool disas_insn(DisasContext *s, CPUState *cpu)
@@ -3844,28 +3872,14 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
if (!(s->cpuid_ext_features & CPUID_EXT_CX16)) {
goto illegal_op;
}
- gen_lea_modrm(env, s, modrm);
- if ((s->prefix & PREFIX_LOCK) &&
- (tb_cflags(s->base.tb) & CF_PARALLEL)) {
- gen_helper_cmpxchg16b(cpu_env, s->A0);
- } else {
- gen_helper_cmpxchg16b_unlocked(cpu_env, s->A0);
- }
- set_cc_op(s, CC_OP_EFLAGS);
+ gen_cmpxchg16b(s, env, modrm);
break;
}
-#endif
+#endif
if (!(s->cpuid_features & CPUID_CX8)) {
goto illegal_op;
}
- gen_lea_modrm(env, s, modrm);
- if ((s->prefix & PREFIX_LOCK) &&
- (tb_cflags(s->base.tb) & CF_PARALLEL)) {
- gen_helper_cmpxchg8b(cpu_env, s->A0);
- } else {
- gen_helper_cmpxchg8b_unlocked(cpu_env, s->A0);
- }
- set_cc_op(s, CC_OP_EFLAGS);
+ gen_cmpxchg8b(s, env, modrm);
break;
case 7: /* RDSEED */
--
2.34.1
- [PULL 29/40] target/s390x: Use Int128 for return from CLST, (continued)
- [PULL 29/40] target/s390x: Use Int128 for return from CLST, Richard Henderson, 2023/02/04
- [PULL 30/40] target/s390x: Use Int128 for return from CKSM, Richard Henderson, 2023/02/04
- [PULL 31/40] target/s390x: Use Int128 for return from TRE, Richard Henderson, 2023/02/04
- [PULL 32/40] target/s390x: Copy wout_x1 to wout_x1_P, Richard Henderson, 2023/02/04
- [PULL 33/40] target/s390x: Use Int128 for returning float128, Richard Henderson, 2023/02/04
- [PULL 35/40] target/s390x: Use tcg_gen_atomic_cmpxchg_i128 for CDSG, Richard Henderson, 2023/02/04
- [PULL 36/40] target/s390x: Implement CC_OP_NZ in gen_op_calc_cc, Richard Henderson, 2023/02/04
- [PULL 34/40] target/s390x: Use Int128 for passing float128, Richard Henderson, 2023/02/04
- [PULL 38/40] target/i386: Inline cmpxchg8b, Richard Henderson, 2023/02/04
- [PULL 39/40] target/i386: Inline cmpxchg16b, Richard Henderson, 2023/02/04
- [PULL 37/40] target/i386: Split out gen_cmpxchg8b, gen_cmpxchg16b,
Richard Henderson <=
- [PULL 40/40] tcg/aarch64: Fix patching of LDR in tb_target_set_jmp_target, Richard Henderson, 2023/02/04
- Re: [PULL 00/40] tcg patch queue, Peter Maydell, 2023/02/05