aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-i386.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-03-28 11:55:25 +0100
committerJan Beulich <jbeulich@suse.com>2024-03-28 11:55:25 +0100
commitebe82bfdb3832be50bb8553784d148d5b73c0b39 (patch)
tree49994071b8740f46ca7b32e152131025dee251ba /gas/config/tc-i386.c
parent1c6310c97b04bc79637fed66d2cbc61ee5888e31 (diff)
downloadbinutils-ebe82bfdb3832be50bb8553784d148d5b73c0b39.zip
binutils-ebe82bfdb3832be50bb8553784d148d5b73c0b39.tar.gz
binutils-ebe82bfdb3832be50bb8553784d148d5b73c0b39.tar.bz2
x86/SSE2AVX: respect prefixes
1) Without -msse2avx we unconditionally honor REX.W. Hence we ought to also do so with -msse2avx, converting to VEX.W. 2) {rex} doesn't prevent conversion to VEX encodings. Thus {rex2} shouldn't either.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r--gas/config/tc-i386.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 6d35c87..9f5273f 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3885,7 +3885,7 @@ build_vex_prefix (const insn_template *t)
/* Check the REX.W bit and VEXW. */
if (i.tm.opcode_modifier.vexw == VEXWIG)
w = (vexwig == vexw1 || (i.rex & REX_W)) ? 1 : 0;
- else if (i.tm.opcode_modifier.vexw)
+ else if (i.tm.opcode_modifier.vexw && !(i.rex & REX_W))
w = i.tm.opcode_modifier.vexw == VEXW1 ? 1 : 0;
else
w = (flag_code == CODE_64BIT ? i.rex & REX_W : vexwig == vexw1) ? 1 : 0;
@@ -8413,7 +8413,7 @@ check_EgprOperands (const insn_template *t)
}
/* Check if pseudo prefix {rex2} is valid. */
- if (i.rex2_encoding)
+ if (i.rex2_encoding && !t->opcode_modifier.sse2avx)
{
i.error = invalid_pseudo_prefix;
return true;
@@ -10031,6 +10031,7 @@ process_operands (void)
i.rex |= i.prefix[REX_PREFIX] & (REX_W | REX_R | REX_X | REX_B);
i.prefix[REX_PREFIX] = 0;
i.rex_encoding = 0;
+ i.rex2_encoding = 0;
}
/* ImmExt should be processed after SSE2AVX. */
else if (i.tm.opcode_modifier.immext)