blob: 8e0196888f2f0aac379c97cb8e7eaddca0282d19 [file] [log] [blame]
Eli Friedman76927d732011-05-25 23:49:02 +00001; RUN: llc < %s -march=x86 -fast-isel -fast-isel-abort | FileCheck %s
2; RUN: llc < %s -march=x86-64 -fast-isel -fast-isel-abort | FileCheck %s
Dan Gohman14ea1ec2009-03-13 20:42:20 +00003
Eli Friedman76927d732011-05-25 23:49:02 +00004declare i32 @test1a(i32)
Dan Gohman14ea1ec2009-03-13 20:42:20 +00005
Eli Friedman76927d732011-05-25 23:49:02 +00006define i32 @test1(i32 %x) nounwind {
Eli Friedman547eb4f2011-04-27 01:34:27 +00007; CHECK: test1:
8; CHECK: andb $1, %
Eli Friedman76927d732011-05-25 23:49:02 +00009 %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
Dan Gohman14ea1ec2009-03-13 20:42:20 +000013 br label %next
14
15next: ; preds = %0
Eli Friedman547eb4f2011-04-27 01:34:27 +000016 %u = zext i1 %z to i32
17 %v = add i32 %u, 1999
Dan Gohman14ea1ec2009-03-13 20:42:20 +000018 br label %exit
19
20exit: ; preds = %next
21 ret i32 %v
22}
Eli Friedman547eb4f2011-04-27 01:34:27 +000023
24define void @test2(i8* %a) nounwind {
25entry:
26; CHECK: test2:
27; CHECK: movb {{.*}} %al
28; CHECK-NEXT: xorb $1, %al
29; CHECK-NEXT: testb $1
30 %tmp = load i8* %a, align 1
31 %tobool = trunc i8 %tmp to i1
32 %tobool2 = xor i1 %tobool, true
33 br i1 %tobool2, label %if.then, label %if.end
34
35if.then:
36 call void @test2(i8* null)
37 br label %if.end
38
39if.end:
40 ret void
41}