blob: 375dac607146a00f831ec61c0f7cae28346b3d30 [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;
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
11bool "test1"(uint %A) {
12 %B = setge uint %A, 1 ; setne %A, 0
13 ret bool %B
14}
15
16bool "test2"(uint %A) {
17 %B = setgt uint %A, 0 ; setne %A, 0
18 ret bool %B
19}
20
21bool "test3"(sbyte %A) {
22 %B = setge sbyte %A, -127 ; setne %A, -128
23 ret bool %B
24}
Chris Lattner840d4692002-08-09 23:33:58 +000025
26bool %test4(sbyte %A) {
27 %B = setle sbyte %A, 126 ; setne %A, 127
28 ret bool %B
29}
30
31bool %test5(sbyte %A) {
32 %B = setlt sbyte %A, 127 ; setne %A, 127
33 ret bool %B
34}