Add more strength reduction testcases
[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
6 ; RUN: if as < %s | opt -instcombine | dis | grep -v seteq | grep -v setne | grep set
7 ; RUN: then exit 1
8 ; RUN: else exit 0
9 ; RUN: fi
10
11 bool "test1"(uint %A) {
12         %B = setge uint %A, 1   ; setne %A, 0
13         ret bool %B
14 }
15
16 bool "test2"(uint %A) {
17         %B = setgt uint %A, 0   ; setne %A, 0
18         ret bool %B
19 }
20
21 bool "test3"(sbyte %A) {
22         %B = setge sbyte %A, -127   ; setne %A, -128
23         ret bool %B
24 }
25
26 bool %test4(sbyte %A) {
27         %B = setle sbyte %A, 126  ; setne %A, 127
28         ret bool %B
29 }
30
31 bool %test5(sbyte %A) {
32         %B = setlt sbyte %A, 127 ; setne %A, 127
33         ret bool %B
34 }