[PATCH] D38025: [X86] Change the Format attribute for TEST*rr instruction from the default MRMDestReg to MRMSrcReg

Ayman Musa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 00:43:47 PDT 2017


aymanmus created this revision.

Correctly define the TEST{8 | 16 | 32 | 64}rr instructions Format attribute.


https://reviews.llvm.org/D38025

Files:
  lib/Target/X86/X86InstrArithmetic.td
  test/MC/Disassembler/X86/x86-16.txt
  test/MC/X86/x86-16.s
  test/MC/X86/x86-32.s
  test/MC/X86/x86-64.s


Index: test/MC/X86/x86-64.s
===================================================================
--- test/MC/X86/x86-64.s
+++ test/MC/X86/x86-64.s
@@ -671,7 +671,7 @@
 movq 0x00(%r13,%rax,8),%r13
 
 // CHECK: testq	%rax, %rbx
-// CHECK:  encoding: [0x48,0x85,0xc3]
+// CHECK:  encoding: [0x48,0x85,0xd8]
 testq %rax, %rbx
 
 // CHECK: cmpq	%rbx, %r14
Index: test/MC/X86/x86-32.s
===================================================================
--- test/MC/X86/x86-32.s
+++ test/MC/X86/x86-32.s
@@ -79,7 +79,7 @@
 // CHECK: movl	%eax, -16(%ebp)          # encoding: [0x89,0x45,0xf0]
 	movl	%eax, -16(%ebp)
 
-// CHECK: testb	%bl, %cl                # encoding: [0x84,0xd9]
+// CHECK: testb	%bl, %cl                # encoding: [0x84,0xcb]
         testb %bl, %cl
 
 // CHECK: cmpl	%eax, %ebx              # encoding: [0x39,0xc3]
Index: test/MC/X86/x86-16.s
===================================================================
--- test/MC/X86/x86-16.s
+++ test/MC/X86/x86-16.s
@@ -30,7 +30,7 @@
 // CHECK: movl	%eax, -16(%ebp)          # encoding: [0x67,0x66,0x89,0x45,0xf0]
 	movl	%eax, -16(%ebp)
 
-// CHECK: testb	%bl, %cl                # encoding: [0x84,0xd9]
+// CHECK: testb	%bl, %cl                # encoding: [0x84,0xcb]
         testb %bl, %cl
 
 // CHECK: cmpl	%eax, %ebx              # encoding: [0x66,0x39,0xc3]
Index: test/MC/Disassembler/X86/x86-16.txt
===================================================================
--- test/MC/Disassembler/X86/x86-16.txt
+++ test/MC/Disassembler/X86/x86-16.txt
@@ -30,7 +30,7 @@
 # CHECK: movl %eax, -16(%ebp)
 0x67 0x66 0x89 0x45 0xf0
 
-# CHECK: testb %cl, %bl
+# CHECK: testb %bl, %cl
 0x84 0xcb
 
 # CHECK: cmpl %eax, %ebx
Index: lib/Target/X86/X86InstrArithmetic.td
===================================================================
--- lib/Target/X86/X86InstrArithmetic.td
+++ lib/Target/X86/X86InstrArithmetic.td
@@ -1225,10 +1225,10 @@
 let isCompare = 1 in {
   let Defs = [EFLAGS] in {
     let isCommutable = 1 in {
-      def TEST8rr  : BinOpRR_F<0x84, "test", Xi8 , X86testpat>;
-      def TEST16rr : BinOpRR_F<0x84, "test", Xi16, X86testpat>;
-      def TEST32rr : BinOpRR_F<0x84, "test", Xi32, X86testpat>;
-      def TEST64rr : BinOpRR_F<0x84, "test", Xi64, X86testpat>;
+      def TEST8rr  : BinOpRR_F<0x84, "test", Xi8 , X86testpat, MRMSrcReg>;
+      def TEST16rr : BinOpRR_F<0x84, "test", Xi16, X86testpat, MRMSrcReg>;
+      def TEST32rr : BinOpRR_F<0x84, "test", Xi32, X86testpat, MRMSrcReg>;
+      def TEST64rr : BinOpRR_F<0x84, "test", Xi64, X86testpat, MRMSrcReg>;
     } // isCommutable
 
     def TEST8rm    : BinOpRM_F<0x84, "test", Xi8 , X86testpat>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38025.115797.patch
Type: text/x-patch
Size: 2643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/07126b27/attachment.bin>


More information about the llvm-commits mailing list