1 ; RUN: llc -march=mips -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s
2 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s
4 declare <4 x float> @llvm.mips.fmax.w(<4 x float>, <4 x float>) nounwind
5 declare <2 x double> @llvm.mips.fmax.d(<2 x double>, <2 x double>) nounwind
6 declare <4 x float> @llvm.mips.fmin.w(<4 x float>, <4 x float>) nounwind
7 declare <2 x double> @llvm.mips.fmin.d(<2 x double>, <2 x double>) nounwind
9 define void @false_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
12 %1 = load <4 x float>, ptr %a
13 %2 = load <4 x float>, ptr %b
14 %3 = fcmp false <4 x float> %1, %2
15 %4 = sext <4 x i1> %3 to <4 x i32>
16 store <4 x i32> %4, ptr %c
19 ; (setcc $a, $b, SETFALSE) is always folded, so we won't get fcaf:
20 ; CHECK-DAG: ldi.b [[R1:\$w[0-9]+]], 0
21 ; CHECK-DAG: st.w [[R1]], 0($4)
22 ; CHECK: .size false_v4f32
25 define void @false_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
28 %1 = load <2 x double>, ptr %a
29 %2 = load <2 x double>, ptr %b
30 %3 = fcmp false <2 x double> %1, %2
31 %4 = sext <2 x i1> %3 to <2 x i64>
32 store <2 x i64> %4, ptr %c
35 ; (setcc $a, $b, SETFALSE) is always folded
36 ; CHECK-DAG: ldi.b [[R1:\$w[0-9]+]], 0
37 ; CHECK-DAG: st.w [[R1]], 0($4)
38 ; CHECK: .size false_v2f64
41 define void @oeq_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
44 %1 = load <4 x float>, ptr %a
45 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
46 %2 = load <4 x float>, ptr %b
47 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
48 %3 = fcmp oeq <4 x float> %1, %2
49 %4 = sext <4 x i1> %3 to <4 x i32>
50 ; CHECK-DAG: fceq.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
51 store <4 x i32> %4, ptr %c
52 ; CHECK-DAG: st.w [[R3]], 0($4)
55 ; CHECK: .size oeq_v4f32
58 define void @oeq_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
61 %1 = load <2 x double>, ptr %a
62 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
63 %2 = load <2 x double>, ptr %b
64 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
65 %3 = fcmp oeq <2 x double> %1, %2
66 %4 = sext <2 x i1> %3 to <2 x i64>
67 ; CHECK-DAG: fceq.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
68 store <2 x i64> %4, ptr %c
69 ; CHECK-DAG: st.d [[R3]], 0($4)
72 ; CHECK: .size oeq_v2f64
75 define void @oge_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
78 %1 = load <4 x float>, ptr %a
79 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
80 %2 = load <4 x float>, ptr %b
81 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
82 %3 = fcmp oge <4 x float> %1, %2
83 %4 = sext <4 x i1> %3 to <4 x i32>
84 ; CHECK-DAG: fcle.w [[R3:\$w[0-9]+]], [[R2]], [[R1]]
85 store <4 x i32> %4, ptr %c
86 ; CHECK-DAG: st.w [[R3]], 0($4)
89 ; CHECK: .size oge_v4f32
92 define void @oge_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
95 %1 = load <2 x double>, ptr %a
96 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
97 %2 = load <2 x double>, ptr %b
98 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
99 %3 = fcmp oge <2 x double> %1, %2
100 %4 = sext <2 x i1> %3 to <2 x i64>
101 ; CHECK-DAG: fcle.d [[R3:\$w[0-9]+]], [[R2]], [[R1]]
102 store <2 x i64> %4, ptr %c
103 ; CHECK-DAG: st.d [[R3]], 0($4)
106 ; CHECK: .size oge_v2f64
109 define void @ogt_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
112 %1 = load <4 x float>, ptr %a
113 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
114 %2 = load <4 x float>, ptr %b
115 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
116 %3 = fcmp ogt <4 x float> %1, %2
117 %4 = sext <4 x i1> %3 to <4 x i32>
118 ; CHECK-DAG: fclt.w [[R3:\$w[0-9]+]], [[R2]], [[R1]]
119 store <4 x i32> %4, ptr %c
120 ; CHECK-DAG: st.w [[R3]], 0($4)
123 ; CHECK: .size ogt_v4f32
126 define void @ogt_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
129 %1 = load <2 x double>, ptr %a
130 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
131 %2 = load <2 x double>, ptr %b
132 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
133 %3 = fcmp ogt <2 x double> %1, %2
134 %4 = sext <2 x i1> %3 to <2 x i64>
135 ; CHECK-DAG: fclt.d [[R3:\$w[0-9]+]], [[R2]], [[R1]]
136 store <2 x i64> %4, ptr %c
137 ; CHECK-DAG: st.d [[R3]], 0($4)
140 ; CHECK: .size ogt_v2f64
143 define void @ole_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
146 %1 = load <4 x float>, ptr %a
147 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
148 %2 = load <4 x float>, ptr %b
149 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
150 %3 = fcmp ole <4 x float> %1, %2
151 %4 = sext <4 x i1> %3 to <4 x i32>
152 ; CHECK-DAG: fcle.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
153 store <4 x i32> %4, ptr %c
154 ; CHECK-DAG: st.w [[R3]], 0($4)
157 ; CHECK: .size ole_v4f32
160 define void @ole_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
163 %1 = load <2 x double>, ptr %a
164 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
165 %2 = load <2 x double>, ptr %b
166 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
167 %3 = fcmp ole <2 x double> %1, %2
168 %4 = sext <2 x i1> %3 to <2 x i64>
169 ; CHECK-DAG: fcle.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
170 store <2 x i64> %4, ptr %c
171 ; CHECK-DAG: st.d [[R3]], 0($4)
174 ; CHECK: .size ole_v2f64
177 define void @olt_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
180 %1 = load <4 x float>, ptr %a
181 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
182 %2 = load <4 x float>, ptr %b
183 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
184 %3 = fcmp olt <4 x float> %1, %2
185 %4 = sext <4 x i1> %3 to <4 x i32>
186 ; CHECK-DAG: fclt.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
187 store <4 x i32> %4, ptr %c
188 ; CHECK-DAG: st.w [[R3]], 0($4)
191 ; CHECK: .size olt_v4f32
194 define void @olt_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
197 %1 = load <2 x double>, ptr %a
198 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
199 %2 = load <2 x double>, ptr %b
200 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
201 %3 = fcmp olt <2 x double> %1, %2
202 %4 = sext <2 x i1> %3 to <2 x i64>
203 ; CHECK-DAG: fclt.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
204 store <2 x i64> %4, ptr %c
205 ; CHECK-DAG: st.d [[R3]], 0($4)
208 ; CHECK: .size olt_v2f64
211 define void @one_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
214 %1 = load <4 x float>, ptr %a
215 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
216 %2 = load <4 x float>, ptr %b
217 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
218 %3 = fcmp one <4 x float> %1, %2
219 %4 = sext <4 x i1> %3 to <4 x i32>
220 ; CHECK-DAG: fcne.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
221 store <4 x i32> %4, ptr %c
222 ; CHECK-DAG: st.w [[R3]], 0($4)
225 ; CHECK: .size one_v4f32
228 define void @one_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
231 %1 = load <2 x double>, ptr %a
232 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
233 %2 = load <2 x double>, ptr %b
234 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
235 %3 = fcmp one <2 x double> %1, %2
236 %4 = sext <2 x i1> %3 to <2 x i64>
237 ; CHECK-DAG: fcne.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
238 store <2 x i64> %4, ptr %c
239 ; CHECK-DAG: st.d [[R3]], 0($4)
242 ; CHECK: .size one_v2f64
245 define void @ord_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
248 %1 = load <4 x float>, ptr %a
249 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
250 %2 = load <4 x float>, ptr %b
251 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
252 %3 = fcmp ord <4 x float> %1, %2
253 %4 = sext <4 x i1> %3 to <4 x i32>
254 ; CHECK-DAG: fcor.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
255 store <4 x i32> %4, ptr %c
256 ; CHECK-DAG: st.w [[R3]], 0($4)
259 ; CHECK: .size ord_v4f32
262 define void @ord_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
265 %1 = load <2 x double>, ptr %a
266 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
267 %2 = load <2 x double>, ptr %b
268 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
269 %3 = fcmp ord <2 x double> %1, %2
270 %4 = sext <2 x i1> %3 to <2 x i64>
271 ; CHECK-DAG: fcor.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
272 store <2 x i64> %4, ptr %c
273 ; CHECK-DAG: st.d [[R3]], 0($4)
276 ; CHECK: .size ord_v2f64
279 define void @ueq_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
282 %1 = load <4 x float>, ptr %a
283 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
284 %2 = load <4 x float>, ptr %b
285 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
286 %3 = fcmp ueq <4 x float> %1, %2
287 %4 = sext <4 x i1> %3 to <4 x i32>
288 ; CHECK-DAG: fcueq.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
289 store <4 x i32> %4, ptr %c
290 ; CHECK-DAG: st.w [[R3]], 0($4)
293 ; CHECK: .size ueq_v4f32
296 define void @ueq_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
299 %1 = load <2 x double>, ptr %a
300 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
301 %2 = load <2 x double>, ptr %b
302 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
303 %3 = fcmp ueq <2 x double> %1, %2
304 %4 = sext <2 x i1> %3 to <2 x i64>
305 ; CHECK-DAG: fcueq.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
306 store <2 x i64> %4, ptr %c
307 ; CHECK-DAG: st.d [[R3]], 0($4)
310 ; CHECK: .size ueq_v2f64
313 define void @uge_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
316 %1 = load <4 x float>, ptr %a
317 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
318 %2 = load <4 x float>, ptr %b
319 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
320 %3 = fcmp uge <4 x float> %1, %2
321 %4 = sext <4 x i1> %3 to <4 x i32>
322 ; CHECK-DAG: fcule.w [[R3:\$w[0-9]+]], [[R2]], [[R1]]
323 store <4 x i32> %4, ptr %c
324 ; CHECK-DAG: st.w [[R3]], 0($4)
327 ; CHECK: .size uge_v4f32
330 define void @uge_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
333 %1 = load <2 x double>, ptr %a
334 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
335 %2 = load <2 x double>, ptr %b
336 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
337 %3 = fcmp uge <2 x double> %1, %2
338 %4 = sext <2 x i1> %3 to <2 x i64>
339 ; CHECK-DAG: fcule.d [[R3:\$w[0-9]+]], [[R2]], [[R1]]
340 store <2 x i64> %4, ptr %c
341 ; CHECK-DAG: st.d [[R3]], 0($4)
344 ; CHECK: .size uge_v2f64
347 define void @ugt_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
350 %1 = load <4 x float>, ptr %a
351 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
352 %2 = load <4 x float>, ptr %b
353 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
354 %3 = fcmp ugt <4 x float> %1, %2
355 %4 = sext <4 x i1> %3 to <4 x i32>
356 ; CHECK-DAG: fcult.w [[R3:\$w[0-9]+]], [[R2]], [[R1]]
357 store <4 x i32> %4, ptr %c
358 ; CHECK-DAG: st.w [[R3]], 0($4)
361 ; CHECK: .size ugt_v4f32
364 define void @ugt_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
367 %1 = load <2 x double>, ptr %a
368 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
369 %2 = load <2 x double>, ptr %b
370 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
371 %3 = fcmp ugt <2 x double> %1, %2
372 %4 = sext <2 x i1> %3 to <2 x i64>
373 ; CHECK-DAG: fcult.d [[R3:\$w[0-9]+]], [[R2]], [[R1]]
374 store <2 x i64> %4, ptr %c
375 ; CHECK-DAG: st.d [[R3]], 0($4)
378 ; CHECK: .size ugt_v2f64
381 define void @ule_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
384 %1 = load <4 x float>, ptr %a
385 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
386 %2 = load <4 x float>, ptr %b
387 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
388 %3 = fcmp ule <4 x float> %1, %2
389 %4 = sext <4 x i1> %3 to <4 x i32>
390 ; CHECK-DAG: fcule.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
391 store <4 x i32> %4, ptr %c
392 ; CHECK-DAG: st.w [[R3]], 0($4)
395 ; CHECK: .size ule_v4f32
398 define void @ule_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
401 %1 = load <2 x double>, ptr %a
402 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
403 %2 = load <2 x double>, ptr %b
404 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
405 %3 = fcmp ule <2 x double> %1, %2
406 %4 = sext <2 x i1> %3 to <2 x i64>
407 ; CHECK-DAG: fcule.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
408 store <2 x i64> %4, ptr %c
409 ; CHECK-DAG: st.d [[R3]], 0($4)
412 ; CHECK: .size ule_v2f64
415 define void @ult_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
418 %1 = load <4 x float>, ptr %a
419 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
420 %2 = load <4 x float>, ptr %b
421 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
422 %3 = fcmp ult <4 x float> %1, %2
423 %4 = sext <4 x i1> %3 to <4 x i32>
424 ; CHECK-DAG: fcult.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
425 store <4 x i32> %4, ptr %c
426 ; CHECK-DAG: st.w [[R3]], 0($4)
429 ; CHECK: .size ult_v4f32
432 define void @ult_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
435 %1 = load <2 x double>, ptr %a
436 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
437 %2 = load <2 x double>, ptr %b
438 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
439 %3 = fcmp ult <2 x double> %1, %2
440 %4 = sext <2 x i1> %3 to <2 x i64>
441 ; CHECK-DAG: fcult.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
442 store <2 x i64> %4, ptr %c
443 ; CHECK-DAG: st.d [[R3]], 0($4)
446 ; CHECK: .size ult_v2f64
449 define void @uno_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
452 %1 = load <4 x float>, ptr %a
453 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
454 %2 = load <4 x float>, ptr %b
455 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
456 %3 = fcmp uno <4 x float> %1, %2
457 %4 = sext <4 x i1> %3 to <4 x i32>
458 ; CHECK-DAG: fcun.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
459 store <4 x i32> %4, ptr %c
460 ; CHECK-DAG: st.w [[R3]], 0($4)
463 ; CHECK: .size uno_v4f32
466 define void @uno_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
469 %1 = load <2 x double>, ptr %a
470 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
471 %2 = load <2 x double>, ptr %b
472 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
473 %3 = fcmp uno <2 x double> %1, %2
474 %4 = sext <2 x i1> %3 to <2 x i64>
475 ; CHECK-DAG: fcun.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
476 store <2 x i64> %4, ptr %c
477 ; CHECK-DAG: st.d [[R3]], 0($4)
480 ; CHECK: .size uno_v2f64
483 define void @true_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
486 %1 = load <4 x float>, ptr %a
487 %2 = load <4 x float>, ptr %b
488 %3 = fcmp true <4 x float> %1, %2
489 %4 = sext <4 x i1> %3 to <4 x i32>
490 store <4 x i32> %4, ptr %c
493 ; (setcc $a, $b, SETTRUE) is always folded, so we won't get fcaf:
494 ; CHECK-DAG: ldi.b [[R1:\$w[0-9]+]], -1
495 ; CHECK-DAG: st.w [[R1]], 0($4)
496 ; CHECK: .size true_v4f32
499 define void @true_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
502 %1 = load <2 x double>, ptr %a
503 %2 = load <2 x double>, ptr %b
504 %3 = fcmp true <2 x double> %1, %2
505 %4 = sext <2 x i1> %3 to <2 x i64>
506 store <2 x i64> %4, ptr %c
509 ; (setcc $a, $b, SETTRUE) is always folded.
510 ; CHECK-DAG: ldi.b [[R1:\$w[0-9]+]], -1
511 ; CHECK-DAG: st.w [[R1]], 0($4)
512 ; CHECK: .size true_v2f64
515 define void @bsel_v4f32(ptr %d, ptr %a, ptr %b,
519 %1 = load <4 x float>, ptr %a
520 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
521 %2 = load <4 x float>, ptr %b
522 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
523 %3 = load <4 x float>, ptr %c
524 ; CHECK-DAG: ld.w [[R3:\$w[0-9]+]], 0($7)
525 %4 = fcmp ogt <4 x float> %1, %2
526 ; CHECK-DAG: fclt.w [[R4:\$w[0-9]+]], [[R2]], [[R1]]
527 %5 = select <4 x i1> %4, <4 x float> %1, <4 x float> %3
528 ; Note that IfSet and IfClr are swapped since the condition is inverted
529 ; CHECK-DAG: bsel.v [[R4]], [[R3]], [[R1]]
530 store <4 x float> %5, ptr %d
531 ; CHECK-DAG: st.w [[R4]], 0($4)
534 ; CHECK: .size bsel_v4f32
537 define void @bsel_v2f64(ptr %d, ptr %a, ptr %b,
541 %1 = load <2 x double>, ptr %a
542 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
543 %2 = load <2 x double>, ptr %b
544 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
545 %3 = load <2 x double>, ptr %c
546 ; CHECK-DAG: ld.d [[R3:\$w[0-9]+]], 0($7)
547 %4 = fcmp ogt <2 x double> %1, %2
548 ; CHECK-DAG: fclt.d [[R4:\$w[0-9]+]], [[R2]], [[R1]]
549 %5 = select <2 x i1> %4, <2 x double> %1, <2 x double> %3
550 ; Note that IfSet and IfClr are swapped since the condition is inverted
551 ; CHECK-DAG: bsel.v [[R4]], [[R3]], [[R1]]
552 store <2 x double> %5, ptr %d
553 ; CHECK-DAG: st.d [[R4]], 0($4)
556 ; CHECK: .size bsel_v2f64
559 define void @bseli_v4f32(ptr %d, ptr %a, ptr %b,
561 ; CHECK: bseli_v4f32:
563 %1 = load <4 x float>, ptr %a
564 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
565 %2 = load <4 x float>, ptr %b
566 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
567 %3 = fcmp ogt <4 x float> %1, %2
568 ; CHECK-DAG: fclt.w [[R4:\$w[0-9]+]], [[R2]], [[R1]]
569 %4 = select <4 x i1> %3, <4 x float> %1, <4 x float> zeroinitializer
570 ; Note that IfSet and IfClr are swapped since the condition is inverted
571 ; CHECK-DAG: bsel.v [[R4]], [[R3:\$w[0-9]+]], [[R1]]
572 store <4 x float> %4, ptr %d
573 ; CHECK-DAG: st.w [[R4]], 0($4)
576 ; CHECK: .size bseli_v4f32
579 define void @bseli_v2f64(ptr %d, ptr %a, ptr %b,
581 ; CHECK: bseli_v2f64:
583 %1 = load <2 x double>, ptr %a
584 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
585 %2 = load <2 x double>, ptr %b
586 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
587 %3 = fcmp ogt <2 x double> %1, %2
588 ; CHECK-DAG: fclt.d [[R4:\$w[0-9]+]], [[R2]], [[R1]]
589 %4 = select <2 x i1> %3, <2 x double> %1, <2 x double> zeroinitializer
590 ; Note that IfSet and IfClr are swapped since the condition is inverted
591 ; CHECK-DAG: bsel.v [[R4]], [[R3:\$w[0-9]+]], [[R1]]
592 store <2 x double> %4, ptr %d
593 ; CHECK-DAG: st.d [[R4]], 0($4)
596 ; CHECK: .size bseli_v2f64
599 define void @max_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
602 %1 = load <4 x float>, ptr %a
603 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
604 %2 = load <4 x float>, ptr %b
605 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
606 %3 = tail call <4 x float> @llvm.mips.fmax.w(<4 x float> %1, <4 x float> %2)
607 ; CHECK-DAG: fmax.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
608 store <4 x float> %3, ptr %c
609 ; CHECK-DAG: st.w [[R3]], 0($4)
612 ; CHECK: .size max_v4f32
615 define void @max_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
618 %1 = load <2 x double>, ptr %a
619 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
620 %2 = load <2 x double>, ptr %b
621 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
622 %3 = tail call <2 x double> @llvm.mips.fmax.d(<2 x double> %1, <2 x double> %2)
623 ; CHECK-DAG: fmax.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
624 store <2 x double> %3, ptr %c
625 ; CHECK-DAG: st.d [[R3]], 0($4)
628 ; CHECK: .size max_v2f64
631 define void @min_v4f32(ptr %c, ptr %a, ptr %b) nounwind {
634 %1 = load <4 x float>, ptr %a
635 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
636 %2 = load <4 x float>, ptr %b
637 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
638 %3 = tail call <4 x float> @llvm.mips.fmin.w(<4 x float> %1, <4 x float> %2)
639 ; CHECK-DAG: fmin.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
640 store <4 x float> %3, ptr %c
641 ; CHECK-DAG: st.w [[R3]], 0($4)
644 ; CHECK: .size min_v4f32
647 define void @min_v2f64(ptr %c, ptr %a, ptr %b) nounwind {
650 %1 = load <2 x double>, ptr %a
651 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
652 %2 = load <2 x double>, ptr %b
653 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
654 %3 = tail call <2 x double> @llvm.mips.fmin.d(<2 x double> %1, <2 x double> %2)
655 ; CHECK-DAG: fmin.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
656 store <2 x double> %3, ptr %c
657 ; CHECK-DAG: st.d [[R3]], 0($4)
660 ; CHECK: .size min_v2f64