2011-02-22 08:21:42 +01:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s
|
2010-01-04 21:53:54 +01:00
|
|
|
|
|
|
|
; Reuse the flags value from the add instructions instead of emitting separate
|
|
|
|
; testl instructions.
|
|
|
|
|
|
|
|
; Use the flags on the add.
|
|
|
|
|
2010-03-05 07:17:43 +01:00
|
|
|
; CHECK: test1:
|
2011-05-05 01:54:51 +02:00
|
|
|
; CHECK: addl
|
|
|
|
; CHECK-NOT: test
|
|
|
|
; CHECK: cmovnsl
|
|
|
|
; CHECK: ret
|
2010-01-04 21:53:54 +01:00
|
|
|
|
2010-03-05 07:17:43 +01:00
|
|
|
define i32 @test1(i32* %x, i32 %y, i32 %a, i32 %b) nounwind {
|
2010-01-04 21:53:54 +01:00
|
|
|
%tmp2 = load i32* %x, align 4 ; <i32> [#uses=1]
|
|
|
|
%tmp4 = add i32 %tmp2, %y ; <i32> [#uses=1]
|
|
|
|
%tmp5 = icmp slt i32 %tmp4, 0 ; <i1> [#uses=1]
|
|
|
|
%tmp.0 = select i1 %tmp5, i32 %a, i32 %b ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp.0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @foo(i32)
|
|
|
|
|
|
|
|
; Don't use the flags result of the and here, since the and has no
|
|
|
|
; other use. A simple test is better.
|
|
|
|
|
2010-03-05 07:17:43 +01:00
|
|
|
; CHECK: test2:
|
2011-02-22 08:21:42 +01:00
|
|
|
; CHECK: testb $16, {{%dil|%cl}}
|
2010-01-04 21:53:54 +01:00
|
|
|
|
2010-03-05 07:17:43 +01:00
|
|
|
define void @test2(i32 %x) nounwind {
|
2010-01-04 21:53:54 +01:00
|
|
|
%y = and i32 %x, 16
|
|
|
|
%t = icmp eq i32 %y, 0
|
|
|
|
br i1 %t, label %true, label %false
|
|
|
|
true:
|
|
|
|
call void @foo(i32 %x)
|
|
|
|
ret void
|
|
|
|
false:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Do use the flags result of the and here, since the and has another use.
|
|
|
|
|
2010-03-05 07:17:43 +01:00
|
|
|
; CHECK: test3:
|
2011-05-05 01:54:51 +02:00
|
|
|
; CHECK: andl $16, %e
|
2010-01-04 22:23:34 +01:00
|
|
|
; CHECK-NEXT: jne
|
2010-01-04 21:53:54 +01:00
|
|
|
|
2010-03-05 07:17:43 +01:00
|
|
|
define void @test3(i32 %x) nounwind {
|
2010-01-04 21:53:54 +01:00
|
|
|
%y = and i32 %x, 16
|
|
|
|
%t = icmp eq i32 %y, 0
|
|
|
|
br i1 %t, label %true, label %false
|
|
|
|
true:
|
|
|
|
call void @foo(i32 %y)
|
|
|
|
ret void
|
|
|
|
false:
|
|
|
|
ret void
|
|
|
|
}
|