1 ; Test 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) {
8 ; CHECK: vfcesb %v24, %v26, %v28
10 %cmp = fcmp oeq <4 x float> %val1, %val2
11 %ret = sext <4 x i1> %cmp to <4 x i32>
16 define <4 x i32> @f2(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
18 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
19 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v26, %v28
20 ; CHECK: vo %v24, [[REG1]], [[REG2]]
22 %cmp = fcmp one <4 x float> %val1, %val2
23 %ret = sext <4 x i1> %cmp to <4 x i32>
28 define <4 x i32> @f3(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
30 ; CHECK: vfchsb %v24, %v26, %v28
32 %cmp = fcmp ogt <4 x float> %val1, %val2
33 %ret = sext <4 x i1> %cmp to <4 x i32>
38 define <4 x i32> @f4(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
40 ; CHECK: vfchesb %v24, %v26, %v28
42 %cmp = fcmp oge <4 x float> %val1, %val2
43 %ret = sext <4 x i1> %cmp to <4 x i32>
48 define <4 x i32> @f5(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
50 ; CHECK: vfchesb %v24, %v28, %v26
52 %cmp = fcmp ole <4 x float> %val1, %val2
53 %ret = sext <4 x i1> %cmp to <4 x i32>
58 define <4 x i32> @f6(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
60 ; CHECK: vfchsb %v24, %v28, %v26
62 %cmp = fcmp olt <4 x float> %val1, %val2
63 %ret = sext <4 x i1> %cmp to <4 x i32>
68 define <4 x i32> @f7(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
70 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
71 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v26, %v28
72 ; CHECK: vno %v24, [[REG1]], [[REG2]]
74 %cmp = fcmp ueq <4 x float> %val1, %val2
75 %ret = sext <4 x i1> %cmp to <4 x i32>
80 define <4 x i32> @f8(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
82 ; CHECK: vfcesb [[REG:%v[0-9]+]], %v26, %v28
83 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
85 %cmp = fcmp une <4 x float> %val1, %val2
86 %ret = sext <4 x i1> %cmp to <4 x i32>
91 define <4 x i32> @f9(<4 x i32> %dummy, <4 x float> %val1, <4 x float> %val2) {
93 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v28, %v26
94 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
96 %cmp = fcmp ugt <4 x float> %val1, %val2
97 %ret = sext <4 x i1> %cmp to <4 x i32>
102 define <4 x i32> @f10(<4 x i32> %dummy, <4 x float> %val1,
105 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v28, %v26
106 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
107 ; CHECK-NEXT: br %r14
108 %cmp = fcmp uge <4 x float> %val1, %val2
109 %ret = sext <4 x i1> %cmp to <4 x i32>
114 define <4 x i32> @f11(<4 x i32> %dummy, <4 x float> %val1,
117 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v26, %v28
118 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
119 ; CHECK-NEXT: br %r14
120 %cmp = fcmp ule <4 x float> %val1, %val2
121 %ret = sext <4 x i1> %cmp to <4 x i32>
126 define <4 x i32> @f12(<4 x i32> %dummy, <4 x float> %val1,
129 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v26, %v28
130 ; CHECK-NEXT: vno %v24, [[REG]], [[REG]]
131 ; CHECK-NEXT: br %r14
132 %cmp = fcmp ult <4 x float> %val1, %val2
133 %ret = sext <4 x i1> %cmp to <4 x i32>
138 define <4 x i32> @f13(<4 x i32> %dummy, <4 x float> %val1,
141 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
142 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v26, %v28
143 ; CHECK: vo %v24, [[REG1]], [[REG2]]
144 ; CHECK-NEXT: br %r14
145 %cmp = fcmp ord <4 x float> %val1, %val2
146 %ret = sext <4 x i1> %cmp to <4 x i32>
151 define <4 x i32> @f14(<4 x i32> %dummy, <4 x float> %val1,
154 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v28, %v26
155 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v26, %v28
156 ; CHECK: vno %v24, [[REG1]], [[REG2]]
157 ; CHECK-NEXT: br %r14
158 %cmp = fcmp uno <4 x float> %val1, %val2
159 %ret = sext <4 x i1> %cmp to <4 x i32>
164 define <4 x float> @f15(<4 x float> %val1, <4 x float> %val2,
165 <4 x float> %val3, <4 x float> %val4) {
167 ; CHECK: vfcesb [[REG:%v[0-9]+]], %v24, %v26
168 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
169 ; CHECK-NEXT: br %r14
170 %cmp = fcmp oeq <4 x float> %val1, %val2
171 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
176 define <4 x float> @f16(<4 x float> %val1, <4 x float> %val2,
177 <4 x float> %val3, <4 x float> %val4) {
179 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
180 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v24, %v26
181 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
182 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
183 ; CHECK-NEXT: br %r14
184 %cmp = fcmp one <4 x float> %val1, %val2
185 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
190 define <4 x float> @f17(<4 x float> %val1, <4 x float> %val2,
191 <4 x float> %val3, <4 x float> %val4) {
193 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v24, %v26
194 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
195 ; CHECK-NEXT: br %r14
196 %cmp = fcmp ogt <4 x float> %val1, %val2
197 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
202 define <4 x float> @f18(<4 x float> %val1, <4 x float> %val2,
203 <4 x float> %val3, <4 x float> %val4) {
205 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v24, %v26
206 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
207 ; CHECK-NEXT: br %r14
208 %cmp = fcmp oge <4 x float> %val1, %val2
209 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
214 define <4 x float> @f19(<4 x float> %val1, <4 x float> %val2,
215 <4 x float> %val3, <4 x float> %val4) {
217 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v26, %v24
218 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
219 ; CHECK-NEXT: br %r14
220 %cmp = fcmp ole <4 x float> %val1, %val2
221 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
226 define <4 x float> @f20(<4 x float> %val1, <4 x float> %val2,
227 <4 x float> %val3, <4 x float> %val4) {
229 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v26, %v24
230 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
231 ; CHECK-NEXT: br %r14
232 %cmp = fcmp olt <4 x float> %val1, %val2
233 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
238 define <4 x float> @f21(<4 x float> %val1, <4 x float> %val2,
239 <4 x float> %val3, <4 x float> %val4) {
241 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
242 ; CHECK-DAG: vfchsb [[REG2:%v[0-9]+]], %v24, %v26
243 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
244 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
245 ; CHECK-NEXT: br %r14
246 %cmp = fcmp ueq <4 x float> %val1, %val2
247 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
252 define <4 x float> @f22(<4 x float> %val1, <4 x float> %val2,
253 <4 x float> %val3, <4 x float> %val4) {
255 ; CHECK: vfcesb [[REG:%v[0-9]+]], %v24, %v26
256 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
257 ; CHECK-NEXT: br %r14
258 %cmp = fcmp une <4 x float> %val1, %val2
259 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
264 define <4 x float> @f23(<4 x float> %val1, <4 x float> %val2,
265 <4 x float> %val3, <4 x float> %val4) {
267 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v26, %v24
268 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
269 ; CHECK-NEXT: br %r14
270 %cmp = fcmp ugt <4 x float> %val1, %val2
271 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
276 define <4 x float> @f24(<4 x float> %val1, <4 x float> %val2,
277 <4 x float> %val3, <4 x float> %val4) {
279 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v26, %v24
280 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
281 ; CHECK-NEXT: br %r14
282 %cmp = fcmp uge <4 x float> %val1, %val2
283 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
288 define <4 x float> @f25(<4 x float> %val1, <4 x float> %val2,
289 <4 x float> %val3, <4 x float> %val4) {
291 ; CHECK: vfchsb [[REG:%v[0-9]+]], %v24, %v26
292 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
293 ; CHECK-NEXT: br %r14
294 %cmp = fcmp ule <4 x float> %val1, %val2
295 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
300 define <4 x float> @f26(<4 x float> %val1, <4 x float> %val2,
301 <4 x float> %val3, <4 x float> %val4) {
303 ; CHECK: vfchesb [[REG:%v[0-9]+]], %v24, %v26
304 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
305 ; CHECK-NEXT: br %r14
306 %cmp = fcmp ult <4 x float> %val1, %val2
307 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
312 define <4 x float> @f27(<4 x float> %val1, <4 x float> %val2,
313 <4 x float> %val3, <4 x float> %val4) {
315 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
316 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v24, %v26
317 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
318 ; CHECK-NEXT: vsel %v24, %v28, %v30, [[REG]]
319 ; CHECK-NEXT: br %r14
320 %cmp = fcmp ord <4 x float> %val1, %val2
321 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
326 define <4 x float> @f28(<4 x float> %val1, <4 x float> %val2,
327 <4 x float> %val3, <4 x float> %val4) {
329 ; CHECK-DAG: vfchsb [[REG1:%v[0-9]+]], %v26, %v24
330 ; CHECK-DAG: vfchesb [[REG2:%v[0-9]+]], %v24, %v26
331 ; CHECK: vo [[REG:%v[0-9]+]], [[REG1]], [[REG2]]
332 ; CHECK-NEXT: vsel %v24, %v30, %v28, [[REG]]
333 ; CHECK-NEXT: br %r14
334 %cmp = fcmp uno <4 x float> %val1, %val2
335 %ret = select <4 x i1> %cmp, <4 x float> %val3, <4 x float> %val4
339 ; Test an f32 comparison that uses vector registers.
340 define i64 @f29(i64 %a, i64 %b, float %f1, <4 x float> %vec) {
342 ; CHECK: wfcsb %f0, %v24
343 ; CHECK-NEXT: locgrne %r2, %r3
345 %f2 = extractelement <4 x float> %vec, i32 0
346 %cond = fcmp oeq float %f1, %f2
347 %res = select i1 %cond, i64 %a, i64 %b