1 ; Test 32-bit signed comparison in which the second operand is constant.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Check comparisons with 0.
6 define double @f1(double %a, double %b, i32 %i1) {
11 %cond = icmp slt i32 %i1, 0
12 %tmp = select i1 %cond, double %a, double %b
13 %res = fadd double %tmp, 1.0
17 ; Check comparisons with 2.
18 define double @f2(double %a, double %b, i32 %i1) {
23 %cond = icmp slt i32 %i1, 2
24 %tmp = select i1 %cond, double %a, double %b
25 %res = fadd double %tmp, 1.0
29 ; Check the high end of the CIJ range.
30 define double @f3(double %a, double %b, i32 %i1) {
32 ; CHECK: cijl %r2, 127
35 %cond = icmp slt i32 %i1, 127
36 %tmp = select i1 %cond, double %a, double %b
37 %res = fadd double %tmp, 1.0
41 ; Check the next value up, which must use CHI instead.
42 define double @f4(double %a, double %b, i32 %i1) {
48 %cond = icmp slt i32 %i1, 128
49 %tmp = select i1 %cond, double %a, double %b
50 %res = fadd double %tmp, 1.0
54 ; Check the high end of the CHI range.
55 define double @f5(double %a, double %b, i32 %i1) {
57 ; CHECK: chi %r2, 32767
61 %cond = icmp slt i32 %i1, 32767
62 %tmp = select i1 %cond, double %a, double %b
63 %res = fadd double %tmp, 1.0
67 ; Check the next value up, which must use CFI.
68 define double @f6(double %a, double %b, i32 %i1) {
70 ; CHECK: cfi %r2, 32768
74 %cond = icmp slt i32 %i1, 32768
75 %tmp = select i1 %cond, double %a, double %b
76 %res = fadd double %tmp, 1.0
80 ; Check the high end of the signed 32-bit range.
81 define double @f7(double %a, double %b, i32 %i1) {
83 ; CHECK: cfi %r2, 2147483647
87 %cond = icmp eq i32 %i1, 2147483647
88 %tmp = select i1 %cond, double %a, double %b
89 %res = fadd double %tmp, 1.0
93 ; Check the next value up, which should be treated as a negative value.
94 define double @f8(double %a, double %b, i32 %i1) {
96 ; CHECK: cfi %r2, -2147483648
100 %cond = icmp eq i32 %i1, 2147483648
101 %tmp = select i1 %cond, double %a, double %b
102 %res = fadd double %tmp, 1.0
106 ; Check the high end of the negative CIJ range.
107 define double @f9(double %a, double %b, i32 %i1) {
109 ; CHECK: cijl %r2, -1
110 ; CHECK: ldr %f0, %f2
112 %cond = icmp slt i32 %i1, -1
113 %tmp = select i1 %cond, double %a, double %b
114 %res = fadd double %tmp, 1.0
118 ; Check the low end of the CIJ range.
119 define double @f10(double %a, double %b, i32 %i1) {
121 ; CHECK: cijl %r2, -128
122 ; CHECK: ldr %f0, %f2
124 %cond = icmp slt i32 %i1, -128
125 %tmp = select i1 %cond, double %a, double %b
126 %res = fadd double %tmp, 1.0
130 ; Check the next value down, which must use CHI instead.
131 define double @f11(double %a, double %b, i32 %i1) {
133 ; CHECK: chi %r2, -129
135 ; CHECK: ldr %f0, %f2
137 %cond = icmp slt i32 %i1, -129
138 %tmp = select i1 %cond, double %a, double %b
139 %res = fadd double %tmp, 1.0
143 ; Check the low end of the CHI range.
144 define double @f12(double %a, double %b, i32 %i1) {
146 ; CHECK: chi %r2, -32768
148 ; CHECK: ldr %f0, %f2
150 %cond = icmp slt i32 %i1, -32768
151 %tmp = select i1 %cond, double %a, double %b
152 %res = fadd double %tmp, 1.0
156 ; Check the next value down, which must use CFI instead.
157 define double @f13(double %a, double %b, i32 %i1) {
159 ; CHECK: cfi %r2, -32769
161 ; CHECK: ldr %f0, %f2
163 %cond = icmp slt i32 %i1, -32769
164 %tmp = select i1 %cond, double %a, double %b
165 %res = fadd double %tmp, 1.0
169 ; Check the low end of the signed 32-bit range.
170 define double @f14(double %a, double %b, i32 %i1) {
172 ; CHECK: cfi %r2, -2147483648
174 ; CHECK: ldr %f0, %f2
176 %cond = icmp eq i32 %i1, -2147483648
177 %tmp = select i1 %cond, double %a, double %b
178 %res = fadd double %tmp, 1.0
182 ; Check the next value down, which should be treated as a positive value.
183 define double @f15(double %a, double %b, i32 %i1) {
185 ; CHECK: cfi %r2, 2147483647
187 ; CHECK: ldr %f0, %f2
189 %cond = icmp eq i32 %i1, -2147483649
190 %tmp = select i1 %cond, double %a, double %b
191 %res = fadd double %tmp, 1.0
195 ; Check that < 1 becomes <= 0.
196 define double @f16(double %a, double %b, i32 %i1) {
198 ; CHECK: cijle %r2, 0
199 ; CHECK: ldr %f0, %f2
201 %cond = icmp slt i32 %i1, 1
202 %tmp = select i1 %cond, double %a, double %b
203 %res = fadd double %tmp, 1.0
207 ; Check that >= 1 becomes > 0.
208 define double @f17(double %a, double %b, i32 %i1) {
211 ; CHECK: ldr %f0, %f2
213 %cond = icmp sge i32 %i1, 1
214 %tmp = select i1 %cond, double %a, double %b
215 %res = fadd double %tmp, 1.0
219 ; Check that > -1 becomes >= 0.
220 define double @f18(double %a, double %b, i32 %i1) {
222 ; CHECK: cijhe %r2, 0
223 ; CHECK: ldr %f0, %f2
225 %cond = icmp sgt i32 %i1, -1
226 %tmp = select i1 %cond, double %a, double %b
227 %res = fadd double %tmp, 1.0
231 ; Check that <= -1 becomes < 0.
232 define double @f19(double %a, double %b, i32 %i1) {
235 ; CHECK: ldr %f0, %f2
237 %cond = icmp sle i32 %i1, -1
238 %tmp = select i1 %cond, double %a, double %b
239 %res = fadd double %tmp, 1.0