aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-02-03 08:22:35 +0100
committerJan Beulich <jbeulich@suse.com>2023-02-03 08:22:35 +0100
commit33740f219e4eec3ee0f428a76390b9afc8140ad6 (patch)
tree52a0144a42b75ee0377f4e039a7edfcc03c2316d
parent739d764954b69fafd4fa7b238cf95149a86b2bda (diff)
downloadgdb-33740f219e4eec3ee0f428a76390b9afc8140ad6.zip
gdb-33740f219e4eec3ee0f428a76390b9afc8140ad6.tar.gz
gdb-33740f219e4eec3ee0f428a76390b9afc8140ad6.tar.bz2
x86-64: respect {nooptimize} when building VEX prefix
Swapping operands for commutative insns occurs outside of optimize_encoding() and hence needs explicit checking for a request to avoid any optimizations.
-rw-r--r--gas/config/tc-i386.c3
-rw-r--r--gas/testsuite/gas/i386/x86-64-optimize-4.d2
-rw-r--r--gas/testsuite/gas/i386/x86-64-optimize-4.s3
3 files changed, 7 insertions, 1 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index c3aa40b..d5a24ae 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3624,7 +3624,8 @@ build_vex_prefix (const insn_template *t)
&& i.reg_operands == i.operands - i.imm_operands
&& i.tm.opcode_modifier.vex
&& i.tm.opcode_modifier.commutative
- && (i.tm.opcode_modifier.sse2avx || optimize > 1)
+ && (i.tm.opcode_modifier.sse2avx
+ || (optimize > 1 && !i.no_optimize))
&& i.rex == REX_B
&& i.vex.register_specifier
&& !(i.vex.register_specifier->reg_flags & RegRex))
diff --git a/gas/testsuite/gas/i386/x86-64-optimize-4.d b/gas/testsuite/gas/i386/x86-64-optimize-4.d
index d25d24d..ed01f21 100644
--- a/gas/testsuite/gas/i386/x86-64-optimize-4.d
+++ b/gas/testsuite/gas/i386/x86-64-optimize-4.d
@@ -9,6 +9,8 @@ Disassembly of section .text:
0+ <_start>:
+[a-f0-9]+: a9 7f 00 00 00 test \$0x7f,%eax
+ +[a-f0-9]+: c4 c1 61 db e4 vpand %xmm12,%xmm3,%xmm4
+ +[a-f0-9]+: c5 91 db e2 vpand %xmm2,%xmm13,%xmm4
+[a-f0-9]+: 62 f1 7d 28 6f d1 vmovdqa32 %ymm1,%ymm2
+[a-f0-9]+: 62 f1 fd 28 6f d1 vmovdqa64 %ymm1,%ymm2
+[a-f0-9]+: 62 f1 7f 08 6f d1 vmovdqu8 %xmm1,%xmm2
diff --git a/gas/testsuite/gas/i386/x86-64-optimize-4.s b/gas/testsuite/gas/i386/x86-64-optimize-4.s
index a3f69a3..97264e2 100644
--- a/gas/testsuite/gas/i386/x86-64-optimize-4.s
+++ b/gas/testsuite/gas/i386/x86-64-optimize-4.s
@@ -5,6 +5,9 @@
_start:
{nooptimize} testl $0x7f, %eax
+ {nooptimize} vpand %xmm12, %xmm3, %xmm4
+ {nooptimize} vpand %xmm2, %xmm13, %xmm4
+
{nooptimize} vmovdqa32 %ymm1, %ymm2
{nooptimize} vmovdqa64 %ymm1, %ymm2
{nooptimize} vmovdqu8 %xmm1, %xmm2