[opaque pointer type] Add textual IR support for explicit type parameter to load...
[oota-llvm.git] / test / Transforms / InstCombine / 2007-12-28-IcmpSub2.ll
1 ; RUN: opt < %s -mem2reg -instcombine -S | grep "ret i32 1" | count 8
2
3 define i32 @test1() {
4 entry:
5         %z = alloca i32
6         store i32 0, i32* %z
7         %tmp = load i32, i32* %z
8         %sub = sub i32 %tmp, 1
9         %cmp = icmp ule i32 %sub, 0
10         %retval = select i1 %cmp, i32 0, i32 1
11         ret i32 %retval
12 }
13
14 define i32 @test2() {
15 entry:
16         %z = alloca i32
17         store i32 0, i32* %z
18         %tmp = load i32, i32* %z
19         %sub = sub i32 %tmp, 1
20         %cmp = icmp ugt i32 %sub, 0
21         %retval = select i1 %cmp, i32 1, i32 0
22         ret i32 %retval
23 }
24
25 define i32 @test3() {
26 entry:
27         %z = alloca i32
28         store i32 0, i32* %z
29         %tmp = load i32, i32* %z
30         %sub = sub i32 %tmp, 1
31         %cmp = icmp slt i32 %sub, 0
32         %retval = select i1 %cmp, i32 1, i32 0
33         ret i32 %retval
34 }
35
36 define i32 @test4() {
37 entry:
38         %z = alloca i32
39         store i32 0, i32* %z
40         %tmp = load i32, i32* %z
41         %sub = sub i32 %tmp, 1
42         %cmp = icmp sle i32 %sub, 0
43         %retval = select i1 %cmp, i32 1, i32 0
44         ret i32 %retval
45 }
46
47 define i32 @test5() {
48 entry:
49         %z = alloca i32
50         store i32 0, i32* %z
51         %tmp = load i32, i32* %z
52         %sub = sub i32 %tmp, 1
53         %cmp = icmp sge i32 %sub, 0
54         %retval = select i1 %cmp, i32 0, i32 1
55         ret i32 %retval
56 }
57
58 define i32 @test6() {
59 entry:
60         %z = alloca i32
61         store i32 0, i32* %z
62         %tmp = load i32, i32* %z
63         %sub = sub i32 %tmp, 1
64         %cmp = icmp sgt i32 %sub, 0
65         %retval = select i1 %cmp, i32 0, i32 1
66         ret i32 %retval
67 }
68
69 define i32 @test7() {
70 entry:
71         %z = alloca i32
72         store i32 0, i32* %z
73         %tmp = load i32, i32* %z
74         %sub = sub i32 %tmp, 1
75         %cmp = icmp eq i32 %sub, 0
76         %retval = select i1 %cmp, i32 0, i32 1
77         ret i32 %retval
78 }
79
80 define i32 @test8() {
81 entry:
82         %z = alloca i32
83         store i32 0, i32* %z
84         %tmp = load i32, i32* %z
85         %sub = sub i32 %tmp, 1
86         %cmp = icmp ne i32 %sub, 0
87         %retval = select i1 %cmp, i32 1, i32 0
88         ret i32 %retval
89 }