[binutils-gdb] x86/APX: add CMPcc/CTESTcc cases to noreg64 tests
Jan Beulich
jbeulich@sourceware.org
Fri Jul 19 08:54:38 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8ba953169cf6d40c7c3722718b19f5be5210bfca
commit 8ba953169cf6d40c7c3722718b19f5be5210bfca
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Jul 19 10:54:22 2024 +0200
x86/APX: add CMPcc/CTESTcc cases to noreg64 tests
This was missed when support for the insns was added. Just like for
DATA16, in
rex64 neg (%rax)
rex64 neg (%r16)
rex64 {nf} neg (%rax)
it is not logical why the last one shouldn't be permitted. Bypassing
that check requires other adjustments, though, to actually properly
consume (and then squash) the prefix.
Diff:
---
gas/config/tc-i386.c | 40 ++++++++++++++++++++++++---------
gas/testsuite/gas/i386/noreg-intel64.l | 14 ++++++++++++
gas/testsuite/gas/i386/noreg64-data16.d | 7 ++++++
gas/testsuite/gas/i386/noreg64-data16.e | 16 ++++++++-----
gas/testsuite/gas/i386/noreg64-rex64.d | 7 ++++++
gas/testsuite/gas/i386/noreg64.d | 7 ++++++
gas/testsuite/gas/i386/noreg64.l | 14 ++++++++++++
gas/testsuite/gas/i386/noreg64.s | 7 ++++++
8 files changed, 95 insertions(+), 17 deletions(-)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 0ab95bc141f..1ae3db0d3c4 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4402,19 +4402,32 @@ build_rex2_prefix (void)
static bool
build_apx_evex_prefix (void)
{
- /* To mimic behavior for legacy insns, transform use of DATA16 into its
- embedded-prefix representation. */
- if (i.prefix[DATA_PREFIX] && i.tm.opcode_space == SPACE_EVEXMAP4)
+ /* To mimic behavior for legacy insns, transform use of DATA16 and REX64 into
+ their embedded-prefix representations. */
+ if (i.tm.opcode_space == SPACE_EVEXMAP4)
{
- if (i.tm.opcode_modifier.opcodeprefix)
+ if (i.prefix[DATA_PREFIX])
+ {
+ if (i.tm.opcode_modifier.opcodeprefix)
+ {
+ as_bad (i.tm.opcode_modifier.opcodeprefix == PREFIX_0X66
+ ? _("same type of prefix used twice")
+ : _("conflicting use of `data16' prefix"));
+ return false;
+ }
+ i.tm.opcode_modifier.opcodeprefix = PREFIX_0X66;
+ i.prefix[DATA_PREFIX] = 0;
+ }
+ if (i.prefix[REX_PREFIX] & REX_W)
{
- as_bad (i.tm.opcode_modifier.opcodeprefix == PREFIX_0X66
- ? _("same type of prefix used twice")
- : _("conflicting use of `data16' prefix"));
- return false;
+ if (i.suffix == QWORD_MNEM_SUFFIX)
+ {
+ as_bad (_("same type of prefix used twice"));
+ return false;
+ }
+ i.tm.opcode_modifier.vexw = VEXW1;
+ i.prefix[REX_PREFIX] = 0;
}
- i.tm.opcode_modifier.opcodeprefix = PREFIX_0X66;
- i.prefix[DATA_PREFIX] = 0;
}
build_evex_prefix ();
@@ -7709,7 +7722,12 @@ md_assemble (char *line)
}
/* Check for explicit REX prefix. */
- if (i.prefix[REX_PREFIX] || i.rex_encoding)
+ if ((i.prefix[REX_PREFIX]
+ && (i.tm.opcode_space != SPACE_EVEXMAP4
+ /* To mimic behavior for legacy insns, permit use of REX64 for promoted
+ legacy instructions. */
+ || i.prefix[REX_PREFIX] != (REX_OPCODE | REX_W)))
+ || i.rex_encoding)
{
as_bad (_("REX prefix invalid with `%s'"), insn_name (&i.tm));
return;
diff --git a/gas/testsuite/gas/i386/noreg-intel64.l b/gas/testsuite/gas/i386/noreg-intel64.l
index b99b9e1f60c..f758e706f86 100644
--- a/gas/testsuite/gas/i386/noreg-intel64.l
+++ b/gas/testsuite/gas/i386/noreg-intel64.l
@@ -31,6 +31,14 @@
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `bts'
.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `cmp'
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `cmp'
@@ -48,6 +56,12 @@
.*:[1-9][0-9]*: Warning: .* `crc32'
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ctesta'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ctesta'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ctesta'
+.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `dec'
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `div'
diff --git a/gas/testsuite/gas/i386/noreg64-data16.d b/gas/testsuite/gas/i386/noreg64-data16.d
index 802eb4053d3..358271b77e0 100644
--- a/gas/testsuite/gas/i386/noreg64-data16.d
+++ b/gas/testsuite/gas/i386/noreg64-data16.d
@@ -26,6 +26,10 @@ Disassembly of section .text:
*[a-f0-9]+: 66 0f ba 30 01 btrw \$0x1,\(%rax\)
*[a-f0-9]+: 66 0f ba 28 01 btsw \$0x1,\(%rax\)
*[a-f0-9]+: 66 ff 10 callw \*\(%rax\)
+ *[a-f0-9]+: 62 f4 05 07 83 38 01[ ]+ccmpaw \{dfv=\} \$0x1,\(%rax\)
+ *[a-f0-9]+: 62 f4 05 07 81 38 89 00[ ]+ccmpaw \{dfv=\} \$0x89,\(%rax\)
+ *[a-f0-9]+: 62 f4 05 07 81 38 34 12[ ]+ccmpaw \{dfv=\} \$0x1234,\(%rax\)
+ *[a-f0-9]+: 62 f4 05 07 81 38 78 56[ ]+ccmpaw \{dfv=\} \$0x5678,\(%rax\)
*[a-f0-9]+: 66 83 38 01 cmpw \$0x1,\(%rax\)
*[a-f0-9]+: 66 81 38 89 00 cmpw \$0x89,\(%rax\)
*[a-f0-9]+: 66 81 38 34 12 cmpw \$0x1234,\(%rax\)
@@ -34,6 +38,9 @@ Disassembly of section .text:
*[a-f0-9]+: 66 a7 cmpsw %es:\(%rdi\),%ds:\(%rsi\)
*[a-f0-9]+: 66 f2 0f 38 f1 00 crc32w \(%rax\),%eax
*[a-f0-9]+: 66 f2 48 0f 38 f1 00 data16 crc32q \(%rax\),%rax
+ *[a-f0-9]+: 62 f4 05 07 f7 00 89 00[ ]+ctestaw \{dfv=\} \$0x89,\(%rax\)
+ *[a-f0-9]+: 62 f4 05 07 f7 00 34 12[ ]+ctestaw \{dfv=\} \$0x1234,\(%rax\)
+ *[a-f0-9]+: 62 f4 05 07 f7 00 78 56[ ]+ctestaw \{dfv=\} \$0x5678,\(%rax\)
*[a-f0-9]+: 66 ff 08 decw \(%rax\)
*[a-f0-9]+: 66 f7 30 divw \(%rax\)
*[a-f0-9]+: 66 d8 00 data16 fadds \(%rax\)
diff --git a/gas/testsuite/gas/i386/noreg64-data16.e b/gas/testsuite/gas/i386/noreg64-data16.e
index 48ff2a99a9a..65d31d0d38b 100644
--- a/gas/testsuite/gas/i386/noreg64-data16.e
+++ b/gas/testsuite/gas/i386/noreg64-data16.e
@@ -8,14 +8,18 @@
.*:3: Warning: .*shortened.*
.*:47: Info: .*
.*:3: Warning: .*shortened.*
-.*:99: Info: .*
+.*:51: Info: .*
.*:3: Warning: .*shortened.*
-.*:117: Info: .*
+.*:58: Info: .*
.*:3: Warning: .*shortened.*
-.*:146: Info: .*
+.*:106: Info: .*
.*:3: Warning: .*shortened.*
-.*:170: Info: .*
+.*:124: Info: .*
.*:3: Warning: .*shortened.*
-.*:175: Info: .*
+.*:153: Info: .*
.*:3: Warning: .*shortened.*
-.*:179: Info: .*
+.*:177: Info: .*
+.*:3: Warning: .*shortened.*
+.*:182: Info: .*
+.*:3: Warning: .*shortened.*
+.*:186: Info: .*
diff --git a/gas/testsuite/gas/i386/noreg64-rex64.d b/gas/testsuite/gas/i386/noreg64-rex64.d
index e33851d8093..1f6757b16f0 100644
--- a/gas/testsuite/gas/i386/noreg64-rex64.d
+++ b/gas/testsuite/gas/i386/noreg64-rex64.d
@@ -25,6 +25,10 @@ Disassembly of section .text:
*[a-f0-9]+: 48 0f ba 30 01 btrq \$0x1,\(%rax\)
*[a-f0-9]+: 48 0f ba 28 01 btsq \$0x1,\(%rax\)
*[a-f0-9]+: 48 ff 10 rex\.W call \*\(%rax\)
+ *[a-f0-9]+: 62 f4 84 07 83 38 01[ ]+ccmpaq \{dfv=\} \$0x1,\(%rax\)
+ *[a-f0-9]+: 62 f4 84 07 81 38 89 00 00 00[ ]+ccmpaq \{dfv=\} \$0x89,\(%rax\)
+ *[a-f0-9]+: 62 f4 84 07 81 38 34 12 00 00[ ]+ccmpaq \{dfv=\} \$0x1234,\(%rax\)
+ *[a-f0-9]+: 62 f4 84 07 81 38 78 56 34 12[ ]+ccmpaq \{dfv=\} \$0x12345678,\(%rax\)
*[a-f0-9]+: 48 83 38 01 cmpq \$0x1,\(%rax\)
*[a-f0-9]+: 48 81 38 89 00 00 00 cmpq \$0x89,\(%rax\)
*[a-f0-9]+: 48 81 38 34 12 00 00 cmpq \$0x1234,\(%rax\)
@@ -32,6 +36,9 @@ Disassembly of section .text:
*[a-f0-9]+: 48 a7 cmpsq %es:\(%rdi\),%ds:\(%rsi\)
*[a-f0-9]+: 48 a7 cmpsq %es:\(%rdi\),%ds:\(%rsi\)
*[a-f0-9]+: f2 48 0f 38 f1 00 crc32q \(%rax\),%rax
+ *[a-f0-9]+: 62 f4 84 07 f7 00 89 00 00 00[ ]+ctestaq \{dfv=\} \$0x89,\(%rax\)
+ *[a-f0-9]+: 62 f4 84 07 f7 00 34 12 00 00[ ]+ctestaq \{dfv=\} \$0x1234,\(%rax\)
+ *[a-f0-9]+: 62 f4 84 07 f7 00 78 56 34 12[ ]+ctestaq \{dfv=\} \$0x12345678,\(%rax\)
*[a-f0-9]+: 48 ff 08 decq \(%rax\)
*[a-f0-9]+: 48 f7 30 divq \(%rax\)
*[a-f0-9]+: 48 d8 00 rex\.W fadds \(%rax\)
diff --git a/gas/testsuite/gas/i386/noreg64.d b/gas/testsuite/gas/i386/noreg64.d
index 2afdef38f92..3cf3baf4fcd 100644
--- a/gas/testsuite/gas/i386/noreg64.d
+++ b/gas/testsuite/gas/i386/noreg64.d
@@ -24,6 +24,10 @@ Disassembly of section .text:
*[a-f0-9]+: 0f ba 30 01 btrl \$0x1,\(%rax\)
*[a-f0-9]+: 0f ba 28 01 btsl \$0x1,\(%rax\)
*[a-f0-9]+: ff 10 call \*\(%rax\)
+ *[a-f0-9]+: 62 f4 04 07 83 38 01 ccmpal \{dfv=\} \$0x1,\(%rax\)
+ *[a-f0-9]+: 62 f4 04 07 81 38 89 00 00 00 ccmpal \{dfv=\} \$0x89,\(%rax\)
+ *[a-f0-9]+: 62 f4 04 07 81 38 34 12 00 00 ccmpal \{dfv=\} \$0x1234,\(%rax\)
+ *[a-f0-9]+: 62 f4 04 07 81 38 78 56 34 12 ccmpal \{dfv=\} \$0x12345678,\(%rax\)
*[a-f0-9]+: 83 38 01 cmpl \$0x1,\(%rax\)
*[a-f0-9]+: 81 38 89 00 00 00 cmpl \$0x89,\(%rax\)
*[a-f0-9]+: 81 38 34 12 00 00 cmpl \$0x1234,\(%rax\)
@@ -32,6 +36,9 @@ Disassembly of section .text:
*[a-f0-9]+: a7 cmpsl %es:\(%rdi\),%ds:\(%rsi\)
*[a-f0-9]+: f2 0f 38 f1 00 crc32l \(%rax\),%eax
*[a-f0-9]+: f2 48 0f 38 f1 00 crc32q \(%rax\),%rax
+ *[a-f0-9]+: 62 f4 04 07 f7 00 89 00 00 00 ctestal \{dfv=\} \$0x89,\(%rax\)
+ *[a-f0-9]+: 62 f4 04 07 f7 00 34 12 00 00 ctestal \{dfv=\} \$0x1234,\(%rax\)
+ *[a-f0-9]+: 62 f4 04 07 f7 00 78 56 34 12 ctestal \{dfv=\} \$0x12345678,\(%rax\)
*[a-f0-9]+: ff 08 decl \(%rax\)
*[a-f0-9]+: f7 30 divl \(%rax\)
*[a-f0-9]+: d8 00 fadds \(%rax\)
diff --git a/gas/testsuite/gas/i386/noreg64.l b/gas/testsuite/gas/i386/noreg64.l
index b32430dff07..97b7ff0dc75 100644
--- a/gas/testsuite/gas/i386/noreg64.l
+++ b/gas/testsuite/gas/i386/noreg64.l
@@ -31,6 +31,14 @@
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `bts'
.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ccmpa'
+.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `cmp'
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `cmp'
@@ -48,6 +56,12 @@
.*:[1-9][0-9]*: Warning: .* `crc32'
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ctesta'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ctesta'
+.*:[1-9][0-9]*: Info: .*
+.*:[1-9][0-9]*: Warning: .* `ctesta'
+.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `dec'
.*:[1-9][0-9]*: Info: .*
.*:[1-9][0-9]*: Warning: .* `div'
diff --git a/gas/testsuite/gas/i386/noreg64.s b/gas/testsuite/gas/i386/noreg64.s
index c067f88ce17..9d2a714f9d4 100644
--- a/gas/testsuite/gas/i386/noreg64.s
+++ b/gas/testsuite/gas/i386/noreg64.s
@@ -41,6 +41,10 @@ noreg:
pfx btr $1, (%rax)
pfx bts $1, (%rax)
pfx call *(%rax)
+ pfx ccmpa $1, (%rax)
+ pfx ccmpa $0x89, (%rax)
+ pfx ccmpa $0x1234, (%rax)
+ pfx ccmpa $0x12345678, (%rax)
pfx cmp $1, (%rax)
pfx cmp $0x89, (%rax)
pfx cmp $0x1234, (%rax)
@@ -49,6 +53,9 @@ noreg:
pfx cmps %es:(%rdi), (%rsi)
pfx crc32 (%rax), %eax
pfx16 crc32 (%rax), %rax
+ pfx ctesta $0x89, (%rax)
+ pfx ctesta $0x1234, (%rax)
+ pfx ctesta $0x12345678, (%rax)
pfx dec (%rax)
pfx div (%rax)
pfx fadd (%rax)
More information about the Binutils-cvs
mailing list