2002-08-03 20:30:26 +00:00
|
|
|
; This test ensures that "strength reduction" of conditional expressions are
|
|
|
|
; working. Basically this boils down to converting setlt,gt,le,ge instructions
|
|
|
|
; into equivalent setne,eq instructions.
|
|
|
|
;
|
|
|
|
|
2003-09-16 15:29:54 +00:00
|
|
|
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v seteq | grep -v setne | not grep set
|
2002-08-03 20:30:26 +00:00
|
|
|
|
2003-07-24 19:42:28 +00:00
|
|
|
bool %test1(uint %A) {
|
2002-08-03 20:30:26 +00:00
|
|
|
%B = setge uint %A, 1 ; setne %A, 0
|
|
|
|
ret bool %B
|
|
|
|
}
|
|
|
|
|
2003-07-24 19:42:28 +00:00
|
|
|
bool %test2(uint %A) {
|
2002-08-03 20:30:26 +00:00
|
|
|
%B = setgt uint %A, 0 ; setne %A, 0
|
|
|
|
ret bool %B
|
|
|
|
}
|
|
|
|
|
2003-07-24 19:42:28 +00:00
|
|
|
bool %test3(sbyte %A) {
|
2002-08-03 20:30:26 +00:00
|
|
|
%B = setge sbyte %A, -127 ; setne %A, -128
|
|
|
|
ret bool %B
|
|
|
|
}
|
2002-08-09 23:33:58 +00:00
|
|
|
|
|
|
|
bool %test4(sbyte %A) {
|
|
|
|
%B = setle sbyte %A, 126 ; setne %A, 127
|
|
|
|
ret bool %B
|
|
|
|
}
|
|
|
|
|
|
|
|
bool %test5(sbyte %A) {
|
|
|
|
%B = setlt sbyte %A, 127 ; setne %A, 127
|
|
|
|
ret bool %B
|
|
|
|
}
|