1; RUN: llc < %s -mtriple=i686-apple-darwin10 -fast-isel -fast-isel-abort=1 | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -fast-isel -fast-isel-abort=1 | FileCheck %s
3
4declare i32 @test1a(i32)
5
6define i32 @test1(i32 %x) nounwind {
7; CHECK-LABEL: test1:
8; CHECK: andb $1, %
9	%y = add i32 %x, -3
10	%t = call i32 @test1a(i32 %y)
11	%s = mul i32 %t, 77
12	%z = trunc i32 %s to i1
13	br label %next
14
15next:		; preds = %0
16	%u = zext i1 %z to i32
17	%v = add i32 %u, 1999
18	br label %exit
19
20exit:		; preds = %next
21	ret i32 %v
22}
23
24define void @test2(i8* %a) nounwind {
25entry:
26; clang uses i8 constants for booleans, so we test with an i8 1.
27; CHECK-LABEL: test2:
28; CHECK: movb {{.*}} %al
29; CHECK-NEXT: xorb $1, %al
30; CHECK-NEXT: testb $1
31  %tmp = load i8, i8* %a, align 1
32  %xor = xor i8 %tmp, 1
33  %tobool = trunc i8 %xor to i1
34  br i1 %tobool, label %if.then, label %if.end
35
36if.then:
37  call void @test2(i8* null)
38  br label %if.end
39
40if.end:
41  ret void
42}
43