Chris Lattner | 419bda1 | 2002-08-03 20:30:26 +0000 | [diff] [blame^] | 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 | } |