2014-07-02 02:53:31 +08:00
|
|
|
; RUN: llc -march=x86 -mattr=+cmov,cx16 -mtriple=i386-pc-linux -verify-machineinstrs < %s | FileCheck %s -check-prefix=LINUX
|
|
|
|
; RUN: llc -march=x86 -mattr=cx16 -mtriple=i386-macosx -relocation-model=pic -verify-machineinstrs < %s | FileCheck %s -check-prefix=PIC
|
2012-10-10 07:48:33 +08:00
|
|
|
|
2012-09-26 02:08:13 +08:00
|
|
|
@sc64 = external global i64
|
|
|
|
|
|
|
|
define void @atomic_maxmin_i6432() {
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: atomic_maxmin_i6432
|
2012-09-26 02:08:13 +08:00
|
|
|
%1 = atomicrmw max i64* @sc64, i64 5 acquire
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: [[LABEL:.LBB[0-9]+_[0-9]+]]
|
|
|
|
; LINUX: cmpl
|
X86: More efficient legalization of wide integer compares
In particular, this makes the code for 64-bit compares on 32-bit targets
much more efficient.
Example:
define i32 @test_slt(i64 %a, i64 %b) {
entry:
%cmp = icmp slt i64 %a, %b
br i1 %cmp, label %bb1, label %bb2
bb1:
ret i32 1
bb2:
ret i32 2
}
Before this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
setae %al
cmpl 16(%esp), %ecx
setge %cl
je .LBB2_2
movb %cl, %al
.LBB2_2:
testb %al, %al
jne .LBB2_4
movl $1, %eax
retl
.LBB2_4:
movl $2, %eax
retl
After this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
sbbl 16(%esp), %ecx
jge .LBB1_2
movl $1, %eax
retl
.LBB1_2:
movl $2, %eax
retl
Differential Revision: http://reviews.llvm.org/D14496
llvm-svn: 253572
2015-11-20 00:35:08 +08:00
|
|
|
; LINUX: sbbl
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: cmovne
|
|
|
|
; LINUX: cmovne
|
2015-05-27 02:35:10 +08:00
|
|
|
; LINUX: lock cmpxchg8b
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: jne [[LABEL]]
|
2012-09-26 02:08:13 +08:00
|
|
|
%2 = atomicrmw min i64* @sc64, i64 6 acquire
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: [[LABEL:.LBB[0-9]+_[0-9]+]]
|
|
|
|
; LINUX: cmpl
|
X86: More efficient legalization of wide integer compares
In particular, this makes the code for 64-bit compares on 32-bit targets
much more efficient.
Example:
define i32 @test_slt(i64 %a, i64 %b) {
entry:
%cmp = icmp slt i64 %a, %b
br i1 %cmp, label %bb1, label %bb2
bb1:
ret i32 1
bb2:
ret i32 2
}
Before this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
setae %al
cmpl 16(%esp), %ecx
setge %cl
je .LBB2_2
movb %cl, %al
.LBB2_2:
testb %al, %al
jne .LBB2_4
movl $1, %eax
retl
.LBB2_4:
movl $2, %eax
retl
After this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
sbbl 16(%esp), %ecx
jge .LBB1_2
movl $1, %eax
retl
.LBB1_2:
movl $2, %eax
retl
Differential Revision: http://reviews.llvm.org/D14496
llvm-svn: 253572
2015-11-20 00:35:08 +08:00
|
|
|
; LINUX: sbbl
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: cmovne
|
|
|
|
; LINUX: cmovne
|
2015-05-27 02:35:10 +08:00
|
|
|
; LINUX: lock cmpxchg8b
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: jne [[LABEL]]
|
2012-09-26 02:08:13 +08:00
|
|
|
%3 = atomicrmw umax i64* @sc64, i64 7 acquire
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: [[LABEL:.LBB[0-9]+_[0-9]+]]
|
|
|
|
; LINUX: cmpl
|
X86: More efficient legalization of wide integer compares
In particular, this makes the code for 64-bit compares on 32-bit targets
much more efficient.
Example:
define i32 @test_slt(i64 %a, i64 %b) {
entry:
%cmp = icmp slt i64 %a, %b
br i1 %cmp, label %bb1, label %bb2
bb1:
ret i32 1
bb2:
ret i32 2
}
Before this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
setae %al
cmpl 16(%esp), %ecx
setge %cl
je .LBB2_2
movb %cl, %al
.LBB2_2:
testb %al, %al
jne .LBB2_4
movl $1, %eax
retl
.LBB2_4:
movl $2, %eax
retl
After this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
sbbl 16(%esp), %ecx
jge .LBB1_2
movl $1, %eax
retl
.LBB1_2:
movl $2, %eax
retl
Differential Revision: http://reviews.llvm.org/D14496
llvm-svn: 253572
2015-11-20 00:35:08 +08:00
|
|
|
; LINUX: sbbl
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: cmovne
|
|
|
|
; LINUX: cmovne
|
2015-05-27 02:35:10 +08:00
|
|
|
; LINUX: lock cmpxchg8b
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: jne [[LABEL]]
|
2012-09-26 02:08:13 +08:00
|
|
|
%4 = atomicrmw umin i64* @sc64, i64 8 acquire
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: [[LABEL:.LBB[0-9]+_[0-9]+]]
|
|
|
|
; LINUX: cmpl
|
X86: More efficient legalization of wide integer compares
In particular, this makes the code for 64-bit compares on 32-bit targets
much more efficient.
Example:
define i32 @test_slt(i64 %a, i64 %b) {
entry:
%cmp = icmp slt i64 %a, %b
br i1 %cmp, label %bb1, label %bb2
bb1:
ret i32 1
bb2:
ret i32 2
}
Before this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
setae %al
cmpl 16(%esp), %ecx
setge %cl
je .LBB2_2
movb %cl, %al
.LBB2_2:
testb %al, %al
jne .LBB2_4
movl $1, %eax
retl
.LBB2_4:
movl $2, %eax
retl
After this patch:
test_slt:
movl 4(%esp), %eax
movl 8(%esp), %ecx
cmpl 12(%esp), %eax
sbbl 16(%esp), %ecx
jge .LBB1_2
movl $1, %eax
retl
.LBB1_2:
movl $2, %eax
retl
Differential Revision: http://reviews.llvm.org/D14496
llvm-svn: 253572
2015-11-20 00:35:08 +08:00
|
|
|
; LINUX: sbbl
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: cmovne
|
|
|
|
; LINUX: cmovne
|
2015-05-27 02:35:10 +08:00
|
|
|
; LINUX: lock cmpxchg8b
|
2012-10-10 07:48:33 +08:00
|
|
|
; LINUX: jne [[LABEL]]
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; rdar://12453106
|
|
|
|
@id = internal global i64 0, align 8
|
|
|
|
|
|
|
|
define void @tf_bug(i8* %ptr) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; PIC-LABEL: tf_bug:
|
2014-07-02 02:53:31 +08:00
|
|
|
; PIC-DAG: movl _id-L1$pb(
|
|
|
|
; PIC-DAG: movl (_id-L1$pb)+4(
|
2012-10-10 07:48:33 +08:00
|
|
|
%tmp1 = atomicrmw add i64* @id, i64 1 seq_cst
|
|
|
|
%tmp2 = add i64 %tmp1, 1
|
|
|
|
%tmp3 = bitcast i8* %ptr to i64*
|
|
|
|
store i64 %tmp2, i64* %tmp3, align 4
|
2012-09-26 02:08:13 +08:00
|
|
|
ret void
|
|
|
|
}
|