[llvm] r325178 - [X86] Don't swap argument on BOUND instruction in at&t syntax.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 13:54:58 PST 2018


Author: ctopper
Date: Wed Feb 14 13:54:58 2018
New Revision: 325178

URL: http://llvm.org/viewvc/llvm-project?rev=325178&view=rev
Log:
[X86] Don't swap argument on BOUND instruction in at&t syntax.

The bound instruction does not have reversed operands in gas.

Fixes PR27653.

Patch by Maya Madhavan.

Differential Revision: https://reviews.llvm.org/D43243

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.td
    llvm/trunk/test/CodeGen/X86/schedule-x86_32.ll
    llvm/trunk/test/MC/Disassembler/X86/x86-16.txt
    llvm/trunk/test/MC/X86/I186-32.s
    llvm/trunk/test/MC/X86/x86-16.s
    llvm/trunk/test/MC/X86/x86-32.s

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=325178&r1=325177&r2=325178&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Feb 14 13:54:58 2018
@@ -2168,11 +2168,12 @@ def DAS : I<0x2F, RawFrm, (outs), (ins),
 
 let SchedRW = [WriteSystem] in {
 // Check Array Index Against Bounds
+// Note: "bound" does not have reversed operands in at&t syntax.
 def BOUNDS16rm : I<0x62, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
-                   "bound\t{$src, $dst|$dst, $src}", [], IIC_BOUND>, OpSize16,
+                   "bound\t$dst, $src", [], IIC_BOUND>, OpSize16,
                    Requires<[Not64BitMode]>;
 def BOUNDS32rm : I<0x62, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
-                   "bound\t{$src, $dst|$dst, $src}", [], IIC_BOUND>, OpSize32,
+                   "bound\t$dst, $src", [], IIC_BOUND>, OpSize32,
                    Requires<[Not64BitMode]>;
 
 // Adjust RPL Field of Segment Selector

Modified: llvm/trunk/test/CodeGen/X86/schedule-x86_32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/schedule-x86_32.ll?rev=325178&r1=325177&r2=325178&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/schedule-x86_32.ll (original)
+++ llvm/trunk/test/CodeGen/X86/schedule-x86_32.ll Wed Feb 14 13:54:58 2018
@@ -452,8 +452,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; GENERIC-NEXT:    movl {{[0-9]+}}(%esp), %edx
 ; GENERIC-NEXT:    movl {{[0-9]+}}(%esp), %esi
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    bound (%esi), %ax
-; GENERIC-NEXT:    bound (%edx), %ecx
+; GENERIC-NEXT:    bound %ax, (%esi)
+; GENERIC-NEXT:    bound %ecx, (%edx)
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    popl %esi
 ; GENERIC-NEXT:    retl
@@ -468,8 +468,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; ATOM-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [1:1.00]
 ; ATOM-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [1:1.00]
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    bound (%esi), %ax # sched: [11:5.50]
-; ATOM-NEXT:    bound (%edx), %ecx # sched: [11:5.50]
+; ATOM-NEXT:    bound %ax, (%esi) # sched: [11:5.50]
+; ATOM-NEXT:    bound %ecx, (%edx) # sched: [11:5.50]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    popl %esi # sched: [1:1.00]
 ; ATOM-NEXT:    retl # sched: [79:39.50]
@@ -484,8 +484,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; SLM-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [3:1.00]
 ; SLM-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [3:1.00]
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    bound (%esi), %ax # sched: [100:1.00]
-; SLM-NEXT:    bound (%edx), %ecx # sched: [100:1.00]
+; SLM-NEXT:    bound %ax, (%esi) # sched: [100:1.00]
+; SLM-NEXT:    bound %ecx, (%edx) # sched: [100:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    popl %esi # sched: [3:1.00]
 ; SLM-NEXT:    retl # sched: [4:1.00]
@@ -500,8 +500,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; SANDY-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [5:0.50]
 ; SANDY-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [5:0.50]
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    bound (%esi), %ax # sched: [100:0.33]
-; SANDY-NEXT:    bound (%edx), %ecx # sched: [100:0.33]
+; SANDY-NEXT:    bound %ax, (%esi) # sched: [100:0.33]
+; SANDY-NEXT:    bound %ecx, (%edx) # sched: [100:0.33]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    popl %esi # sched: [6:0.50]
 ; SANDY-NEXT:    retl # sched: [5:1.00]
@@ -516,8 +516,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; HASWELL-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [5:0.50]
 ; HASWELL-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [5:0.50]
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    bound (%esi), %ax # sched: [1:?]
-; HASWELL-NEXT:    bound (%edx), %ecx # sched: [1:?]
+; HASWELL-NEXT:    bound %ax, (%esi) # sched: [1:?]
+; HASWELL-NEXT:    bound %ecx, (%edx) # sched: [1:?]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    popl %esi # sched: [6:0.50]
 ; HASWELL-NEXT:    retl # sched: [7:1.00]
@@ -532,8 +532,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; BROADWELL-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [5:0.50]
 ; BROADWELL-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [5:0.50]
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    bound (%esi), %ax # sched: [100:0.25]
-; BROADWELL-NEXT:    bound (%edx), %ecx # sched: [100:0.25]
+; BROADWELL-NEXT:    bound %ax, (%esi) # sched: [100:0.25]
+; BROADWELL-NEXT:    bound %ecx, (%edx) # sched: [100:0.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    popl %esi # sched: [6:0.50]
 ; BROADWELL-NEXT:    retl # sched: [6:0.50]
@@ -548,8 +548,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; SKYLAKE-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [5:0.50]
 ; SKYLAKE-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [5:0.50]
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    bound (%esi), %ax # sched: [100:0.25]
-; SKYLAKE-NEXT:    bound (%edx), %ecx # sched: [100:0.25]
+; SKYLAKE-NEXT:    bound %ax, (%esi) # sched: [100:0.25]
+; SKYLAKE-NEXT:    bound %ecx, (%edx) # sched: [100:0.25]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    popl %esi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    retl # sched: [6:0.50]
@@ -564,8 +564,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; SKX-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [5:0.50]
 ; SKX-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [5:0.50]
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    bound (%esi), %ax # sched: [100:0.25]
-; SKX-NEXT:    bound (%edx), %ecx # sched: [100:0.25]
+; SKX-NEXT:    bound %ax, (%esi) # sched: [100:0.25]
+; SKX-NEXT:    bound %ecx, (%edx) # sched: [100:0.25]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    popl %esi # sched: [6:0.50]
 ; SKX-NEXT:    retl # sched: [6:0.50]
@@ -580,8 +580,8 @@ define void @test_bound(i16 %a0, i16 *%a
 ; BTVER2-NEXT:    movl {{[0-9]+}}(%esp), %edx # sched: [5:1.00]
 ; BTVER2-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [5:1.00]
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    bound (%esi), %ax # sched: [100:0.17]
-; BTVER2-NEXT:    bound (%edx), %ecx # sched: [100:0.17]
+; BTVER2-NEXT:    bound %ax, (%esi) # sched: [100:0.17]
+; BTVER2-NEXT:    bound %ecx, (%edx) # sched: [100:0.17]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    popl %esi # sched: [5:1.00]
 ; BTVER2-NEXT:    retl # sched: [4:1.00]
@@ -596,12 +596,12 @@ define void @test_bound(i16 %a0, i16 *%a
 ; ZNVER1-NEXT:    movl {{[0-9]+}}(%esp), %esi # sched: [8:0.50]
 ; ZNVER1-NEXT:    movzwl {{[0-9]+}}(%esp), %eax # sched: [8:0.50]
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    bound (%esi), %ax # sched: [100:?]
-; ZNVER1-NEXT:    bound (%edx), %ecx # sched: [100:?]
+; ZNVER1-NEXT:    bound %ax, (%esi) # sched: [100:?]
+; ZNVER1-NEXT:    bound %ecx, (%edx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    popl %esi # sched: [8:0.50]
 ; ZNVER1-NEXT:    retl # sched: [1:0.50]
-  call void asm sideeffect "bound $1, $0 \0A\09 bound $3, $2", "r,*m,r,*m"(i16 %a0, i16 *%a1, i32 %a2, i32 *%a3)
+  call void asm sideeffect "bound $0, $1 \0A\09 bound $2, $3", "r,*m,r,*m"(i16 %a0, i16 *%a1, i32 %a2, i32 *%a3)
   ret void
 }
 

Modified: llvm/trunk/test/MC/Disassembler/X86/x86-16.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/X86/x86-16.txt?rev=325178&r1=325177&r2=325178&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/X86/x86-16.txt (original)
+++ llvm/trunk/test/MC/Disassembler/X86/x86-16.txt Wed Feb 14 13:54:58 2018
@@ -570,10 +570,10 @@
 # CHECK: lretl $31438
 0x66 0xca 0xce 0x7a
 
-# CHECK: bound 2(%eax), %bx
+# CHECK: bound %bx, 2(%eax)
 0x67 0x62 0x58 0x02
 
-# CHECK: bound 4(%ebx), %ecx
+# CHECK: bound %ecx, 4(%ebx)
 0x67 0x66 0x62 0x4b 0x04
 
 # CHECK: arpl %bx, %bx

Modified: llvm/trunk/test/MC/X86/I186-32.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/I186-32.s?rev=325178&r1=325177&r2=325178&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/I186-32.s (original)
+++ llvm/trunk/test/MC/X86/I186-32.s Wed Feb 14 13:54:58 2018
@@ -1,28 +1,28 @@
 // RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s
 
-// CHECK: bound 3809469200(%edx,%eax,4), %eax 
+// CHECK: bound %eax, 3809469200(%edx,%eax,4)
 // CHECK: encoding: [0x62,0x84,0x82,0x10,0xe3,0x0f,0xe3]        
-bound 3809469200(%edx,%eax,4), %eax 
+bound %eax, 3809469200(%edx,%eax,4)
 
-// CHECK: bound 485498096, %eax 
+// CHECK: bound %eax, 485498096
 // CHECK: encoding: [0x62,0x05,0xf0,0x1c,0xf0,0x1c]        
-bound 485498096, %eax 
+bound %eax, 485498096
 
-// CHECK: bound 485498096(%edx,%eax,4), %eax 
+// CHECK: bound %eax, 485498096(%edx,%eax,4)
 // CHECK: encoding: [0x62,0x84,0x82,0xf0,0x1c,0xf0,0x1c]        
-bound 485498096(%edx,%eax,4), %eax 
+bound %eax, 485498096(%edx,%eax,4)
 
-// CHECK: bound 485498096(%edx), %eax 
+// CHECK: bound %eax, 485498096(%edx)
 // CHECK: encoding: [0x62,0x82,0xf0,0x1c,0xf0,0x1c]        
-bound 485498096(%edx), %eax 
+bound %eax, 485498096(%edx)
 
-// CHECK: bound 64(%edx,%eax), %eax 
+// CHECK: bound %eax, 64(%edx,%eax)
 // CHECK: encoding: [0x62,0x44,0x02,0x40]        
-bound 64(%edx,%eax), %eax 
+bound %eax, 64(%edx,%eax)
 
-// CHECK: bound (%edx), %eax 
+// CHECK: bound %eax, (%edx)
 // CHECK: encoding: [0x62,0x02]        
-bound (%edx), %eax 
+bound %eax, (%edx)
 
 // CHECK: enter $0, $0 
 // CHECK: encoding: [0xc8,0x00,0x00,0x00]        

Modified: llvm/trunk/test/MC/X86/x86-16.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-16.s?rev=325178&r1=325177&r2=325178&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/x86-16.s (original)
+++ llvm/trunk/test/MC/X86/x86-16.s Wed Feb 14 13:54:58 2018
@@ -637,13 +637,13 @@ pshufw $90, %mm4, %mm0
 // CHECK:  encoding: [0x66,0xca,0xce,0x7a]
         	lretl	$0x7ace
 
-// CHECK: bound	2(%eax), %bx
+// CHECK: bound	%bx, 2(%eax)
 // CHECK:  encoding: [0x67,0x62,0x58,0x02]
-        	bound	2(%eax),%bx
+        	bound	%bx,2(%eax)
 
-// CHECK: bound	4(%ebx), %ecx
+// CHECK: bound	%ecx, 4(%ebx)
 // CHECK:  encoding: [0x67,0x66,0x62,0x4b,0x04]
-        	bound	4(%ebx),%ecx
+        	bound	%ecx,4(%ebx)
 
 // CHECK: arpl	%bx, %bx
 // CHECK:  encoding: [0x63,0xdb]

Modified: llvm/trunk/test/MC/X86/x86-32.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-32.s?rev=325178&r1=325177&r2=325178&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/x86-32.s (original)
+++ llvm/trunk/test/MC/X86/x86-32.s Wed Feb 14 13:54:58 2018
@@ -770,13 +770,13 @@ pshufw $90, %mm4, %mm0
 // CHECK:  encoding: [0x66,0xca,0xce,0x7a]
         	lretw	$0x7ace
 
-// CHECK: bound	2(%eax), %bx
+// CHECK: bound	%bx, 2(%eax)
 // CHECK:  encoding: [0x66,0x62,0x58,0x02]
-        	bound	2(%eax),%bx
+        	bound	%bx,2(%eax)
 
-// CHECK: bound	4(%ebx), %ecx
+// CHECK: bound	%ecx, 4(%ebx)
 // CHECK:  encoding: [0x62,0x4b,0x04]
-        	bound	4(%ebx),%ecx
+        	bound	%ecx,4(%ebx)
 
 // CHECK: arpl	%bx, %bx
 // CHECK:  encoding: [0x63,0xdb]




More information about the llvm-commits mailing list