[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/53] target/i386: make rex_w available even in 32-bit mode
From: |
Paolo Bonzini |
Subject: |
[PULL 20/53] target/i386: make rex_w available even in 32-bit mode |
Date: |
Tue, 18 Oct 2022 15:30:09 +0200 |
REX.W can be used even in 32-bit mode by AVX instructions, where it is
retroactively
renamed to VEX.W. Make the field available even in 32-bit mode but keep the
REX_W()
macro as it was; this way, that the handling of dflag does not use it by
mistake and
the AVX code more clearly points at the special VEX behavior of the bit.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/translate.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 1b96201685..279e34e0d0 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -99,8 +99,8 @@ typedef struct DisasContext {
uint8_t rex_r;
uint8_t rex_x;
uint8_t rex_b;
- bool rex_w;
#endif
+ bool vex_w; /* used by AVX even on 32-bit processors */
bool jmp_opt; /* use direct block chaining for direct jumps */
bool repz_opt; /* optimize jumps within repz instructions */
bool cc_op_dirty;
@@ -177,7 +177,7 @@ typedef struct DisasContext {
#ifdef TARGET_X86_64
#define REX_PREFIX(S) (((S)->prefix & PREFIX_REX) != 0)
-#define REX_W(S) ((S)->rex_w)
+#define REX_W(S) ((S)->vex_w)
#define REX_R(S) ((S)->rex_r + 0)
#define REX_X(S) ((S)->rex_x + 0)
#define REX_B(S) ((S)->rex_b + 0)
@@ -4823,7 +4823,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
s->pc = s->base.pc_next;
s->override = -1;
#ifdef TARGET_X86_64
- s->rex_w = false;
s->rex_r = 0;
s->rex_x = 0;
s->rex_b = 0;
@@ -4831,6 +4830,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
s->rip_offset = 0; /* for relative ip address */
s->vex_l = 0;
s->vex_v = 0;
+ s->vex_w = false;
switch (sigsetjmp(s->jmpbuf, 0)) {
case 0:
break;
@@ -4903,7 +4903,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
if (CODE64(s)) {
/* REX prefix */
prefixes |= PREFIX_REX;
- s->rex_w = (b >> 3) & 1;
+ s->vex_w = (b >> 3) & 1;
s->rex_r = (b & 0x4) << 1;
s->rex_x = (b & 0x2) << 2;
s->rex_b = (b & 0x1) << 3;
@@ -4946,8 +4946,8 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
#ifdef TARGET_X86_64
s->rex_x = (~vex2 >> 3) & 8;
s->rex_b = (~vex2 >> 2) & 8;
- s->rex_w = (vex3 >> 7) & 1;
#endif
+ s->vex_w = (vex3 >> 7) & 1;
switch (vex2 & 0x1f) {
case 0x01: /* Implied 0f leading opcode bytes. */
b = x86_ldub_code(env, s) | 0x100;
--
2.37.3
- [PULL 36/53] target/i386: reimplement 0x0f 0xd8-0xdf, 0xe8-0xef, 0xf8-0xff, add AVX, (continued)
- [PULL 36/53] target/i386: reimplement 0x0f 0xd8-0xdf, 0xe8-0xef, 0xf8-0xff, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 35/53] target/i386: reimplement 0x0f 0x60-0x6f, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 23/53] target/i386: add CPUID[EAX=7,ECX=0].ECX to DisasContext, Paolo Bonzini, 2022/10/18
- [PULL 44/53] target/i386: reimplement 0x0f 0x38, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 53/53] target/i386: remove old SSE decoder, Paolo Bonzini, 2022/10/18
- [PULL 27/53] target/i386: validate SSE prefixes directly in the decoding table, Paolo Bonzini, 2022/10/18
- [PULL 37/53] target/i386: reimplement 0x0f 0x50-0x5f, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 26/53] target/i386: validate VEX prefixes via the instructions' exception classes, Paolo Bonzini, 2022/10/18
- [PULL 29/53] target/i386: Prepare ops_sse_header.h for 256 bit AVX, Paolo Bonzini, 2022/10/18
- [PULL 30/53] target/i386: extend helpers to support VEX.V 3- and 4- operand encodings, Paolo Bonzini, 2022/10/18
- [PULL 20/53] target/i386: make rex_w available even in 32-bit mode,
Paolo Bonzini <=
- [PULL 45/53] target/i386: reimplement 0x0f 0xc2, 0xc4-0xc6, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 47/53] target/i386: reimplement 0x0f 0x28-0x2f, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 48/53] target/i386: implement XSAVE and XRSTOR of AVX registers, Paolo Bonzini, 2022/10/18
- [PULL 50/53] target/i386: Enable AVX cpuid bits when using TCG, Paolo Bonzini, 2022/10/18
- [PULL 33/53] target/i386: implement additional AVX comparison operators, Paolo Bonzini, 2022/10/18
- [PULL 42/53] target/i386: reimplement 0x0f 0x3a, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 46/53] target/i386: reimplement 0x0f 0x10-0x17, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 51/53] tests/tcg: extend SSE tests to AVX, Paolo Bonzini, 2022/10/18
- [PULL 52/53] target/i386: move 3DNow to the new decoder, Paolo Bonzini, 2022/10/18
- [PULL 49/53] target/i386: implement VLDMXCSR/VSTMXCSR, Paolo Bonzini, 2022/10/18