1 ; Test strict f32 and v4f32 comparisons on z14.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
6 define <4 x i32> @f1(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
8 ; CHECK: vfcesb %v24, %v26, %v28
10 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
11 <4 x float> %val1, <4 x float> %val2,
13 metadata !"fpexcept.strict") #0
14 %ret = sext <4 x i1> %cmp to <4 x i32>
19 define <4 x i32> @f2(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
21 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
22 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v26, %v28
23 ; CHECK: vo %v24, [[REG1]], [[REG2]]
25 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
26 <4 x float> %val1, <4 x float> %val2,
28 metadata !"fpexcept.strict") #0
29 %ret = sext <4 x i1> %cmp to <4 x i32>
34 define <4 x i32> @f3(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
36 ; CHECK: vfchsb %v24, %v26, %v28
38 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
39 <4 x float> %val1, <4 x float> %val2,
41 metadata !"fpexcept.strict") #0
42 %ret = sext <4 x i1> %cmp to <4 x i32>
47 define <4 x i32> @f4(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
49 ; CHECK: vfchesb %v24, %v26, %v28
51 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
52 <4 x float> %val1, <4 x float> %val2,
54 metadata !"fpexcept.strict") #0
55 %ret = sext <4 x i1> %cmp to <4 x i32>
60 define <4 x i32> @f5(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
62 ; CHECK: vfchesb %v24, %v28, %v26
64 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
65 <4 x float> %val1, <4 x float> %val2,
67 metadata !"fpexcept.strict") #0
68 %ret = sext <4 x i1> %cmp to <4 x i32>
73 define <4 x i32> @f6(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
75 ; CHECK: vfchsb %v24, %v28, %v26
77 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
78 <4 x float> %val1, <4 x float> %val2,
80 metadata !"fpexcept.strict") #0
81 %ret = sext <4 x i1> %cmp to <4 x i32>
86 define <4 x i32> @f7(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
88 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
89 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v26, %v28
90 ; CHECK: vno %v24, [[REG1]], [[REG2]]
92 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
93 <4 x float> %val1, <4 x float> %val2,
95 metadata !"fpexcept.strict") #0
96 %ret = sext <4 x i1> %cmp to <4 x i32>
101 define <4 x i32> @f8(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
103 ; CHECK: vfcesb [[REG:%v[0-9]+]], %v26, %v28
104 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
105 ; CHECK-NEXT: br %r14
106 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
107 <4 x float> %val1, <4 x float> %val2,
109 metadata !"fpexcept.strict") #0
110 %ret = sext <4 x i1> %cmp to <4 x i32>
115 define <4 x i32> @f9(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) #0 {
117 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v28, %v26
118 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
119 ; CHECK-NEXT: br %r14
120 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
121 <4 x float> %val1, <4 x float> %val2,
123 metadata !"fpexcept.strict") #0
124 %ret = sext <4 x i1> %cmp to <4 x i32>
129 define <4 x i32> @f10(<4 x i32> %dummy, <4 x float> %val1,
130 <4 x float> %val2) #0 {
132 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v28, %v26
133 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
134 ; CHECK-NEXT: br %r14
135 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
136 <4 x float> %val1, <4 x float> %val2,
138 metadata !"fpexcept.strict") #0
139 %ret = sext <4 x i1> %cmp to <4 x i32>
144 define <4 x i32> @f11(<4 x i32> %dummy, <4 x float> %val1,
145 <4 x float> %val2) #0 {
147 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v26, %v28
148 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
149 ; CHECK-NEXT: br %r14
150 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
151 <4 x float> %val1, <4 x float> %val2,
153 metadata !"fpexcept.strict") #0
154 %ret = sext <4 x i1> %cmp to <4 x i32>
159 define <4 x i32> @f12(<4 x i32> %dummy, <4 x float> %val1,
160 <4 x float> %val2) #0 {
162 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v26, %v28
163 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
164 ; CHECK-NEXT: br %r14
165 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
166 <4 x float> %val1, <4 x float> %val2,
168 metadata !"fpexcept.strict") #0
169 %ret = sext <4 x i1> %cmp to <4 x i32>
174 define <4 x i32> @f13(<4 x i32> %dummy, <4 x float> %val1,
175 <4 x float> %val2) #0 {
177 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
178 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v26, %v28
179 ; CHECK: vo %v24, [[REG1]], [[REG2]]
180 ; CHECK-NEXT: br %r14
181 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
182 <4 x float> %val1, <4 x float> %val2,
184 metadata !"fpexcept.strict") #0
185 %ret = sext <4 x i1> %cmp to <4 x i32>
190 define <4 x i32> @f14(<4 x i32> %dummy, <4 x float> %val1,
191 <4 x float> %val2) #0 {
193 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
194 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v26, %v28
195 ; CHECK: vno %v24, [[REG1]], [[REG2]]
196 ; CHECK-NEXT: br %r14
197 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
198 <4 x float> %val1, <4 x float> %val2,
200 metadata !"fpexcept.strict") #0
201 %ret = sext <4 x i1> %cmp to <4 x i32>
206 define <4 x float> @f15(<4 x float> %val1, <4 x float> %val2,
207 <4 x float> %val3, <4 x float> %val4) #0 {
209 ; CHECK: vfcesb [[REG:%v[0-9]+]], %v24, %v26
210 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
211 ; CHECK-NEXT: br %r14
212 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
213 <4 x float> %val1, <4 x float> %val2,
215 metadata !"fpexcept.strict") #0
216 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
221 define <4 x float> @f16(<4 x float> %val1, <4 x float> %val2,
222 <4 x float> %val3, <4 x float> %val4) #0 {
224 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
225 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v24, %v26
226 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
227 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
228 ; CHECK-NEXT: br %r14
229 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
230 <4 x float> %val1, <4 x float> %val2,
232 metadata !"fpexcept.strict") #0
233 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
238 define <4 x float> @f17(<4 x float> %val1, <4 x float> %val2,
239 <4 x float> %val3, <4 x float> %val4) #0 {
241 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v24, %v26
242 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
243 ; CHECK-NEXT: br %r14
244 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
245 <4 x float> %val1, <4 x float> %val2,
247 metadata !"fpexcept.strict") #0
248 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
253 define <4 x float> @f18(<4 x float> %val1, <4 x float> %val2,
254 <4 x float> %val3, <4 x float> %val4) #0 {
256 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v24, %v26
257 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
258 ; CHECK-NEXT: br %r14
259 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
260 <4 x float> %val1, <4 x float> %val2,
262 metadata !"fpexcept.strict") #0
263 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
268 define <4 x float> @f19(<4 x float> %val1, <4 x float> %val2,
269 <4 x float> %val3, <4 x float> %val4) #0 {
271 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v26, %v24
272 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
273 ; CHECK-NEXT: br %r14
274 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
275 <4 x float> %val1, <4 x float> %val2,
277 metadata !"fpexcept.strict") #0
278 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
283 define <4 x float> @f20(<4 x float> %val1, <4 x float> %val2,
284 <4 x float> %val3, <4 x float> %val4) #0 {
286 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v26, %v24
287 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
288 ; CHECK-NEXT: br %r14
289 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
290 <4 x float> %val1, <4 x float> %val2,
292 metadata !"fpexcept.strict") #0
293 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
298 define <4 x float> @f21(<4 x float> %val1, <4 x float> %val2,
299 <4 x float> %val3, <4 x float> %val4) #0 {
301 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
302 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v24, %v26
303 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
304 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
305 ; CHECK-NEXT: br %r14
306 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
307 <4 x float> %val1, <4 x float> %val2,
309 metadata !"fpexcept.strict") #0
310 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
315 define <4 x float> @f22(<4 x float> %val1, <4 x float> %val2,
316 <4 x float> %val3, <4 x float> %val4) #0 {
318 ; CHECK: vfcesb [[REG:%v[0-9]+]], %v24, %v26
319 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
320 ; CHECK-NEXT: br %r14
321 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
322 <4 x float> %val1, <4 x float> %val2,
324 metadata !"fpexcept.strict") #0
325 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
330 define <4 x float> @f23(<4 x float> %val1, <4 x float> %val2,
331 <4 x float> %val3, <4 x float> %val4) #0 {
333 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v26, %v24
334 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
335 ; CHECK-NEXT: br %r14
336 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
337 <4 x float> %val1, <4 x float> %val2,
339 metadata !"fpexcept.strict") #0
340 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
345 define <4 x float> @f24(<4 x float> %val1, <4 x float> %val2,
346 <4 x float> %val3, <4 x float> %val4) #0 {
348 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v26, %v24
349 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
350 ; CHECK-NEXT: br %r14
351 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
352 <4 x float> %val1, <4 x float> %val2,
354 metadata !"fpexcept.strict") #0
355 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
360 define <4 x float> @f25(<4 x float> %val1, <4 x float> %val2,
361 <4 x float> %val3, <4 x float> %val4) #0 {
363 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v24, %v26
364 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
365 ; CHECK-NEXT: br %r14
366 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
367 <4 x float> %val1, <4 x float> %val2,
369 metadata !"fpexcept.strict") #0
370 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
375 define <4 x float> @f26(<4 x float> %val1, <4 x float> %val2,
376 <4 x float> %val3, <4 x float> %val4) #0 {
378 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v24, %v26
379 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
380 ; CHECK-NEXT: br %r14
381 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
382 <4 x float> %val1, <4 x float> %val2,
384 metadata !"fpexcept.strict") #0
385 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
390 define <4 x float> @f27(<4 x float> %val1, <4 x float> %val2,
391 <4 x float> %val3, <4 x float> %val4) #0 {
393 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
394 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v24, %v26
395 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
396 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
397 ; CHECK-NEXT: br %r14
398 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
399 <4 x float> %val1, <4 x float> %val2,
401 metadata !"fpexcept.strict") #0
402 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
407 define <4 x float> @f28(<4 x float> %val1, <4 x float> %val2,
408 <4 x float> %val3, <4 x float> %val4) #0 {
410 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
411 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v24, %v26
412 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
413 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
414 ; CHECK-NEXT: br %r14
415 %cmp = call <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(
416 <4 x float> %val1, <4 x float> %val2,
418 metadata !"fpexcept.strict") #0
419 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
423 ; Test an f32 comparison that uses vector registers.
424 define i64 @f29(i64 %a, i64 %b, float %f1, <4 x float> %vec) #0 {
426 ; CHECK: wfcsb %f0, %v24
427 ; CHECK-NEXT: locgrne %r2, %r3
429 %f2 = extractelement <4 x float> %vec, i32 0
430 %cond = call i1 @llvm.experimental.constrained.fcmp.f32(
431 float %f1, float %f2,
433 metadata !"fpexcept.strict") #0
434 %res = select i1 %cond, i64 %a, i64 %b
438 attributes #0 = { strictfp }
440 declare <4 x i1> @llvm.experimental.constrained.fcmp.v4f32(<4 x float>, <4 x float>, metadata, metadata)
441 declare i1 @llvm.experimental.constrained.fcmp.f32(float, float, metadata, metadata)