blob: 5d572c1de500779c6a7b5b042702de498b2a96ab [file] [log] [blame]
Eli Friedman547eb4f2011-04-27 01:34:27 +00001; RUN: llc < %s -march=x86 -fast-isel | FileCheck %s
Dan Gohman14ea1ec2009-03-13 20:42:20 +00002
Eli Friedman547eb4f2011-04-27 01:34:27 +00003declare i64 @test1a(i64)
Dan Gohman14ea1ec2009-03-13 20:42:20 +00004
Eli Friedman547eb4f2011-04-27 01:34:27 +00005define i32 @test1(i64 %x) nounwind {
6; CHECK: test1:
7; CHECK: andb $1, %
8 %y = add i64 %x, -3
9 %t = call i64 @test1a(i64 %y)
10 %s = mul i64 %t, 77
11 %z = trunc i64 %s to i1
Dan Gohman14ea1ec2009-03-13 20:42:20 +000012 br label %next
13
14next: ; preds = %0
Eli Friedman547eb4f2011-04-27 01:34:27 +000015 %u = zext i1 %z to i32
16 %v = add i32 %u, 1999
Dan Gohman14ea1ec2009-03-13 20:42:20 +000017 br label %exit
18
19exit: ; preds = %next
20 ret i32 %v
21}
Eli Friedman547eb4f2011-04-27 01:34:27 +000022
23define void @test2(i8* %a) nounwind {
24entry:
25; CHECK: test2:
26; CHECK: movb {{.*}} %al
27; CHECK-NEXT: xorb $1, %al
28; CHECK-NEXT: testb $1
29 %tmp = load i8* %a, align 1
30 %tobool = trunc i8 %tmp to i1
31 %tobool2 = xor i1 %tobool, true
32 br i1 %tobool2, label %if.then, label %if.end
33
34if.then:
35 call void @test2(i8* null)
36 br label %if.end
37
38if.end:
39 ret void
40}