aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/setcc-strength-reduce.ll
blob: 375dac607146a00f831ec61c0f7cae28346b3d30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
; 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.
;

; RUN: if as < %s | opt -instcombine | dis | grep -v seteq | grep -v setne | grep set
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi

bool "test1"(uint %A) {
	%B = setge uint %A, 1   ; setne %A, 0
	ret bool %B
}

bool "test2"(uint %A) {
	%B = setgt uint %A, 0   ; setne %A, 0
	ret bool %B
}

bool "test3"(sbyte %A) {
	%B = setge sbyte %A, -127   ; setne %A, -128
	ret bool %B
}

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
}