1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -show-mc-encoding | FileCheck %s
3 define i32 @test1(i32 %X, i32* %y) nounwind {
4 %tmp = load i32* %y ; <i32> [#uses=1]
5 %tmp.upgrd.1 = icmp eq i32 %tmp, 0 ; <i1> [#uses=1]
6 br i1 %tmp.upgrd.1, label %ReturnBlock, label %cond_true
8 cond_true: ; preds = %0
11 ReturnBlock: ; preds = %0
14 ; CHECK: cmpl $0, (%rsi)
17 define i32 @test2(i32 %X, i32* %y) nounwind {
18 %tmp = load i32* %y ; <i32> [#uses=1]
19 %tmp1 = shl i32 %tmp, 3 ; <i32> [#uses=1]
20 %tmp1.upgrd.2 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
21 br i1 %tmp1.upgrd.2, label %ReturnBlock, label %cond_true
23 cond_true: ; preds = %0
26 ReturnBlock: ; preds = %0
29 ; CHECK: movl (%rsi), %eax
30 ; CHECK: shll $3, %eax
31 ; CHECK: testl %eax, %eax
34 define i64 @test3(i64 %x) nounwind {
35 %t = icmp eq i64 %x, 0
36 %r = zext i1 %t to i64
39 ; CHECK: testq %rdi, %rdi
41 ; CHECK: movzbl %al, %eax
45 define i64 @test4(i64 %x) nounwind {
46 %t = icmp slt i64 %x, 1
47 %r = zext i1 %t to i64
50 ; CHECK: testq %rdi, %rdi
52 ; CHECK: movzbl %al, %eax
57 define i32 @test5(double %A) nounwind {
59 %tmp2 = fcmp ogt double %A, 1.500000e+02; <i1> [#uses=1]
60 %tmp5 = fcmp ult double %A, 7.500000e+01; <i1> [#uses=1]
61 %bothcond = or i1 %tmp2, %tmp5; <i1> [#uses=1]
62 br i1 %bothcond, label %bb8, label %bb12
65 %tmp9 = tail call i32 (...)* @foo( ) nounwind ; <i32> [#uses=1]
71 ; CHECK: ucomisd LCPI4_0(%rip), %xmm0
72 ; CHECK: ucomisd LCPI4_1(%rip), %xmm0
77 define i32 @test6() nounwind align 2 {
78 %A = alloca {i64, i64}, align 8
79 %B = getelementptr inbounds {i64, i64}* %A, i64 0, i32 1
81 %D = icmp eq i64 %C, 0
82 br i1 %D, label %T, label %F
89 ; CHECK: cmpq $0, -8(%rsp)
90 ; CHECK: encoding: [0x48,0x83,0x7c,0x24,0xf8,0x00]
94 define i32 @test7(i64 %res) nounwind {
98 ; CHECK: shrq $32, %rdi
99 ; CHECK: testl %edi, %edi
101 %lnot = icmp ult i64 %res, 4294967296
102 %lnot.ext = zext i1 %lnot to i32
106 define i32 @test8(i64 %res) nounwind {
110 ; CHECK: shrq $32, %rdi
111 ; CHECK: cmpl $3, %edi
112 %lnot = icmp ult i64 %res, 12884901888
113 %lnot.ext = zext i1 %lnot to i32
117 define i32 @test9(i64 %res) nounwind {
121 ; CHECK: shrq $33, %rdi
122 ; CHECK: testl %edi, %edi
124 %lnot = icmp ult i64 %res, 8589934592
125 %lnot.ext = zext i1 %lnot to i32
129 define i32 @test10(i64 %res) nounwind {
133 ; CHECK: shrq $32, %rdi
134 ; CHECK: cmpl $1, %edi
136 %lnot = icmp uge i64 %res, 4294967296
137 %lnot.ext = zext i1 %lnot to i32
142 define i32 @test11(i64 %l) nounwind {
147 ; CHECK: shrq $47, %rdi
148 ; CHECK: cmpq $1, %rdi
149 %shr.mask = and i64 %l, -140737488355328
150 %cmp = icmp eq i64 %shr.mask, 140737488355328
151 %conv = zext i1 %cmp to i32