[binutils-gdb] x86: correct implied-AVX512VL checking
Jan Beulich
jbeulich@sourceware.org
Fri Jul 24 06:30:48 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=478111ec57ba51c61d32e2bf781aad8ab23103a4
commit 478111ec57ba51c61d32e2bf781aad8ab23103a4
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Jul 24 08:27:04 2026 +0200
x86: correct implied-AVX512VL checking
Templates specifying e.g. AVX2|AVX512F (i.e. providing all of AVX2,
AVX512F, and AVX512VL form(s) at the same time) would presently bypass the
operand size checking in check_VecOperands(). Both t->cpu and t->cpu_any
need taking into account.
Diff:
---
gas/config/tc-i386.c | 6 ++++--
gas/testsuite/gas/i386/avx512vl-plain.l | 9 +++++++--
gas/testsuite/gas/i386/avx512vl-plain.s | 6 +++++-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index dd6d4381087..c5137e7d039 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -8796,9 +8796,11 @@ check_VecOperands (const insn_template *t)
operand size is YMMword or XMMword. Since this function runs after
template matching, there's no need to check for YMMword/XMMword in
the template. */
- cpu = cpu_flags_and (cpu_flags_from_attr (t->cpu), avx512);
+ cpu = cpu_flags_or (cpu_flags_from_attr (t->cpu),
+ cpu_flags_from_attr (t->cpu_any));
+ cpu = cpu_flags_and (cpu, avx512);
if (!cpu_flags_all_zero (&cpu)
- && !is_cpu (t, CpuAVX512VL)
+ && !cpu.bitfield.cpuavx512vl
&& !cpu_arch_flags.bitfield.cpuavx512vl
&& (!t->opcode_modifier.vex || need_evex_encoding (t)))
{
diff --git a/gas/testsuite/gas/i386/avx512vl-plain.l b/gas/testsuite/gas/i386/avx512vl-plain.l
index c2dee22022e..248d2947424 100644
--- a/gas/testsuite/gas/i386/avx512vl-plain.l
+++ b/gas/testsuite/gas/i386/avx512vl-plain.l
@@ -2,6 +2,7 @@
.*:5: Error: .*
.*:6: Error: .*
.*:7: Error: .*
+.*:20: Error: .*
GAS LISTING .*
@@ -24,5 +25,9 @@ GAS LISTING .*
[ ]*15[ ]+\.arch \.vpclmulqdq
[ ]*16[ ]+\?\?\?\? 62F36D28[ ]+\{evex\} vpclmulqdq[ ]+\$0, %ymm1, %ymm2, %ymm3
[ ]*16[ ]+44D900
-[ ]*17[ ]+\?\?\?\? 00000000 \.p2align 4,0
-#...
+[ ]*17[ ]*
+[ ]*18[ ]+\.arch generic32
+[ ]*19[ ]+\.arch \.avx512f
+[ ]*20[ ]+\{evex\}[ ]+vpermd[ ]+%ymm1, %ymm2, %ymm3
+[ ]*21[ ]+\?\?\?\? C4E26D36[ ]+vpermd[ ]+%ymm1, %ymm2, %ymm3
+#pass
diff --git a/gas/testsuite/gas/i386/avx512vl-plain.s b/gas/testsuite/gas/i386/avx512vl-plain.s
index 75e356158a7..a19e3eb5f4b 100644
--- a/gas/testsuite/gas/i386/avx512vl-plain.s
+++ b/gas/testsuite/gas/i386/avx512vl-plain.s
@@ -14,4 +14,8 @@ _start:
.arch .vpclmulqdq
{evex} vpclmulqdq $0, %ymm1, %ymm2, %ymm3
- .p2align 4,0
+
+ .arch generic32
+ .arch .avx512f
+ {evex} vpermd %ymm1, %ymm2, %ymm3
+ vpermd %ymm1, %ymm2, %ymm3
More information about the Binutils-cvs
mailing list