blob: b5ea83707d4f73c2488b9dd891c748144edd2445 [file] [log] [blame]
Chris Lattner419bda12002-08-03 20:30:26 +00001; 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;
Reid Spencer91948d42007-04-14 20:13:02 +00005; 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.
Chris Lattner419bda12002-08-03 20:30:26 +00008
Chris Lattner4f6a4112003-07-24 19:42:28 +00009bool %test1(uint %A) {
Chris Lattner419bda12002-08-03 20:30:26 +000010 %B = setge uint %A, 1 ; setne %A, 0
11 ret bool %B
12}
13
Chris Lattner4f6a4112003-07-24 19:42:28 +000014bool %test2(uint %A) {
Chris Lattner419bda12002-08-03 20:30:26 +000015 %B = setgt uint %A, 0 ; setne %A, 0
16 ret bool %B
17}
18
Chris Lattner4f6a4112003-07-24 19:42:28 +000019bool %test3(sbyte %A) {
Chris Lattner419bda12002-08-03 20:30:26 +000020 %B = setge sbyte %A, -127 ; setne %A, -128
21 ret bool %B
22}
Chris Lattner840d4692002-08-09 23:33:58 +000023
24bool %test4(sbyte %A) {
25 %B = setle sbyte %A, 126 ; setne %A, 127
26 ret bool %B
27}
28
29bool %test5(sbyte %A) {
30 %B = setlt sbyte %A, 127 ; setne %A, 127
31 ret bool %B
32}