blob: 38db88af12c24cb6c95c65e23da0ffe7736c5d12 [file] [log] [blame]
Evan Chengc429ff52010-01-07 00:54:06 +00001; RUN: llc < %s -march=x86 | FileCheck %s
Dan Gohman563db992009-04-03 20:11:30 +00002
3; Don't duplicate the load.
4
5define fastcc i32 @foo(i32* %p) nounwind {
Evan Chengc429ff52010-01-07 00:54:06 +00006; CHECK: foo:
7; CHECK: andl $10, %eax
8; CHECK: je
Dan Gohman563db992009-04-03 20:11:30 +00009 %t0 = load i32* %p
10 %t2 = and i32 %t0, 10
11 %t3 = icmp ne i32 %t2, 0
12 br i1 %t3, label %bb63, label %bb76
Dan Gohman563db992009-04-03 20:11:30 +000013bb63:
14 ret i32 %t2
Dan Gohman563db992009-04-03 20:11:30 +000015bb76:
16 ret i32 0
17}
Evan Chengc429ff52010-01-07 00:54:06 +000018
19define fastcc double @bar(i32 %hash, double %x, double %y) nounwind {
20entry:
21; CHECK: bar:
22 %0 = and i32 %hash, 15
23 %1 = icmp ult i32 %0, 8
24 br i1 %1, label %bb11, label %bb10
25
26bb10:
27; CHECK: bb10
28; CHECK: testb $1
29 %2 = and i32 %hash, 1
30 %3 = icmp eq i32 %2, 0
31 br i1 %3, label %bb13, label %bb11
32
33bb11:
34 %4 = fsub double -0.000000e+00, %x
35 br label %bb13
36
37bb13:
38; CHECK: bb13
39; CHECK: testb $2
40 %iftmp.9.0 = phi double [ %4, %bb11 ], [ %x, %bb10 ]
41 %5 = and i32 %hash, 2
42 %6 = icmp eq i32 %5, 0
43 br i1 %6, label %bb16, label %bb14
44
45bb14:
46 %7 = fsub double -0.000000e+00, %y
47 br label %bb16
48
49bb16:
50 %iftmp.10.0 = phi double [ %7, %bb14 ], [ %y, %bb13 ]
51 %8 = fadd double %iftmp.9.0, %iftmp.10.0
52 ret double %8
53}