]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86/APX: add CMPcc/CTESTcc cases to noreg64 tests
authorJan Beulich <jbeulich@suse.com>
Fri, 19 Jul 2024 08:54:22 +0000 (10:54 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 19 Jul 2024 08:54:22 +0000 (10:54 +0200)
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.

gas/config/tc-i386.c
gas/testsuite/gas/i386/noreg-intel64.l
gas/testsuite/gas/i386/noreg64-data16.d
gas/testsuite/gas/i386/noreg64-data16.e
gas/testsuite/gas/i386/noreg64-rex64.d
gas/testsuite/gas/i386/noreg64.d
gas/testsuite/gas/i386/noreg64.l
gas/testsuite/gas/i386/noreg64.s

index 0ab95bc141f54e0a22aa87bc09f9411ccb49f597..1ae3db0d3c44e81c15efed5d56b67a3e7adce17d 100644 (file)
@@ -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;
index b99b9e1f60c3f1f1807e21a9d3a99b340cfea096..f758e706f863981d4f7026aa24f0ccd7dc035ff3 100644 (file)
 .*:[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'
 .*:[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'
index 802eb4053d359f89afa3aba8d5d1c58325b2ddb2..358271b77e0815f500572849da329f071ef83905 100644 (file)
@@ -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\)
index 48ff2a99a9a4f0c9843724957b2c06d319f3578e..65d31d0d38bc31647d22f68401b41e17f31ed6d2 100644 (file)
@@ -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: .*
index e33851d8093bffcdb0b4905a615bdec3904fecef..1f6757b16f0b4e10b74e39d071709eccd1bc8c35 100644 (file)
@@ -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\)
index 2afdef38f9260dc4cda820f0823670e002c43acd..3cf3baf4fcda15c1ce16cce0433eaaa980fe7071 100644 (file)
@@ -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\)
index b32430dff077c1880bc7ba6c136cd9b236e538e2..97b7ff0dc75168bdbe7a78fc627a0afde14f0eb1 100644 (file)
 .*:[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'
 .*:[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'
index c067f88ce1724edc3359d9ac8f8aea339fbb276b..9d2a714f9d493dee1ad613fcf55f94e542d29864 100644 (file)
@@ -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)