new testcase
[oota-llvm.git] / test / Transforms / InstCombine / setcc-strength-reduce.ll
1 ; This test ensures that "strength reduction" of conditional expressions are
2 ; working.  Basically this boils down to converting setlt,gt,le,ge instructions
3 ; into equivalent setne,eq instructions.
4 ;
5 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
6 ; RUN:    grep -v {icmp eq} | grep -v {icmp ne} | not grep icmp
7 ; END.
8
9 bool %test1(uint %A) {
10         %B = setge uint %A, 1   ; setne %A, 0
11         ret bool %B
12 }
13
14 bool %test2(uint %A) {
15         %B = setgt uint %A, 0   ; setne %A, 0
16         ret bool %B
17 }
18
19 bool %test3(sbyte %A) {
20         %B = setge sbyte %A, -127   ; setne %A, -128
21         ret bool %B
22 }
23
24 bool %test4(sbyte %A) {
25         %B = setle sbyte %A, 126  ; setne %A, 127
26         ret bool %B
27 }
28
29 bool %test5(sbyte %A) {
30         %B = setlt sbyte %A, 127 ; setne %A, 127
31         ret bool %B
32 }