1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[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

llvm-svn: 325178
This commit is contained in:
Craig Topper 2018-02-14 21:54:58 +00:00
parent 829dbc0aeb
commit 1184db4a1c
6 changed files with 46 additions and 45 deletions

View File

@ -2168,11 +2168,12 @@ def DAS : I<0x2F, RawFrm, (outs), (ins), "das", [], IIC_DAS>,
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

View File

@ -452,8 +452,8 @@ define void @test_bound(i16 %a0, i16 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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 *%a1, i32 %a2, i32 *%a3) optsize {
; 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
}

View File

@ -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

View File

@ -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]

View File

@ -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]

View File

@ -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]