diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-08-14 11:25:12 +0200 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2024-08-20 21:22:50 +0200 |
commit | 83d37358312dc4785abbe0d5ec8d4398b342116b (patch) | |
tree | 7d58d8da7d84a7b90524385c6329c8fb1c964533 | |
parent | ld: Add PR ld/32067 tests (diff) | |
download | binutils-gdb-83d37358312dc4785abbe0d5ec8d4398b342116b.tar.gz binutils-gdb-83d37358312dc4785abbe0d5ec8d4398b342116b.tar.bz2 binutils-gdb-83d37358312dc4785abbe0d5ec8d4398b342116b.zip |
x86: correct .insn with opcode extension and VEX/XOP/EVEX encoding
When VexVVVV handling was re-worked, .insn broke: When an opcode
extension is in use, VexVVVV_DST needs using now, as ModR/M.reg is
already occupied, matching what c8866e3ec5e2 ("x86: Drop using
extension_opcode to encode vvvv register") did.
While adding (bad) POP2 forms, also slightly adjust existing ones:
No need to use XMM registers, and no need to specify %r8 when really
%rax is meant twice (EVEX.vvvv not really being the culprit there, or
else EVEX.V' would also have needed mentioning).
(cherry picked from commit d13452d18a919ff56de6861b2e0ebeaaf3aa057a)
-rw-r--r-- | gas/config/tc-i386.c | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s | 12 |
3 files changed, 15 insertions, 5 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index f7be075d14b..79347405b50 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -14038,7 +14038,8 @@ s_insn (int dummy ATTRIBUTE_UNUSED) case 3: if (pp.encoding != encoding_default) { - i.tm.opcode_modifier.vexvvvv = VexVVVV_SRC1; + i.tm.opcode_modifier.vexvvvv = i.tm.extension_opcode == None + ? VexVVVV_SRC1 : VexVVVV_DST; break; } /* Fall through. */ diff --git a/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d b/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d index 7c2efb08d71..667e6f27130 100644 --- a/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d +++ b/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d @@ -34,9 +34,12 @@ Disassembly of section .text: [ ]*[a-f0-9]+:[ ]+04 08[ ]+.* [ ]*[a-f0-9]+:[ ]+62 f4 3c 08 8f[ ]+\(bad\) [ ]*[a-f0-9]+:[ ]+c7[ ]+.* -[ ]*[a-f0-9]+:[ ]+62 74 7c 18 8f c0[ ]+pop2 %rax,\(bad\) +[ ]*[a-f0-9]+:[ ]+62 f4 7c 18 8f c0[ ]+pop2 %rax,\(bad\) [ ]*[a-f0-9]+:[ ]+62 d4 24 18 8f[ ]+\(bad\) [ ]*[a-f0-9]+:[ ]+c3[ ]+.* +[ ]*[a-f0-9]+:[ ]+62 f4 5c 18 8f[ ]+\(bad\) +[ ]*[a-f0-9]+:[ ]+c3[ ]+.* +[ ]*[a-f0-9]+:[ ]+62 f4 7c 18 8f c4[ ]+pop2 %rsp,\(bad\) [ ]*[a-f0-9]+:[ ]+62 fc 7d 0c 60 c7[ ]+movbe \{bad-nf\},%r23w,%ax [ ]*[a-f0-9]+:[ ]+62 fc 79 08 60[ ]+\(bad\) [ ]*[a-f0-9]+:[ ]+c7[ ]+.* diff --git a/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s b/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s index 959e4e1fb43..7b2df4b36ea 100644 --- a/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s +++ b/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s @@ -44,11 +44,17 @@ _start: # pop2 %rdi, %r8 set EVEX.ND=0. .byte 0x62, 0xf4, 0x3c, 0x08, 0x8f, 0xc7 - # pop2 %rax, %r8 set EVEX.vvvv = 1111. - .insn EVEX.L0.M4.W0 0x8f, %rax, {rn-sae},%r8 + # pop2 %rax, %rax + .insn EVEX.L0.NP.M4.W0 0x8f/0, %rax, {sae}, %rax # pop2 %r11, %r11 - .insn EVEX.L0.NP.M4.W0 0x8f/0, {sae}, %xmm11, %xmm11 + .insn EVEX.L0.NP.M4.W0 0x8f/0, %r11, {sae}, %r11 + + # pop2 %rbx, %rsp + .insn EVEX.L0.NP.M4.W0 0x8f/0, %rbx, {sae}, %rsp + + # pop2 %rsp, %rax + .insn EVEX.L0.NP.M4.W0 0x8f/0, %rsp, {sae}, %rax #EVEX_MAP4 movbe %r18w,%ax set EVEX.nf = 1. .insn EVEX.L0.66.M12.W0 0x60, %di, %ax {%k4} |