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