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(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
12 %1 = load <4 x float>, <4 x float>* %a
13 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %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(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
28 %1 = load <2 x double>, <2 x double>* %a
29 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %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(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
44 %1 = load <4 x float>, <4 x float>* %a
45 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
46 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
52 ; CHECK-DAG: st.w [[R3]], 0($4)
55 ; CHECK: .size oeq_v4f32
58 define void @oeq_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
61 %1 = load <2 x double>, <2 x double>* %a
62 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
63 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
69 ; CHECK-DAG: st.d [[R3]], 0($4)
72 ; CHECK: .size oeq_v2f64
75 define void @oge_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
78 %1 = load <4 x float>, <4 x float>* %a
79 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
80 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
86 ; CHECK-DAG: st.w [[R3]], 0($4)
89 ; CHECK: .size oge_v4f32
92 define void @oge_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
95 %1 = load <2 x double>, <2 x double>* %a
96 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
97 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
103 ; CHECK-DAG: st.d [[R3]], 0($4)
106 ; CHECK: .size oge_v2f64
109 define void @ogt_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
112 %1 = load <4 x float>, <4 x float>* %a
113 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
114 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
120 ; CHECK-DAG: st.w [[R3]], 0($4)
123 ; CHECK: .size ogt_v4f32
126 define void @ogt_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
129 %1 = load <2 x double>, <2 x double>* %a
130 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
131 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
137 ; CHECK-DAG: st.d [[R3]], 0($4)
140 ; CHECK: .size ogt_v2f64
143 define void @ole_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
146 %1 = load <4 x float>, <4 x float>* %a
147 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
148 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
154 ; CHECK-DAG: st.w [[R3]], 0($4)
157 ; CHECK: .size ole_v4f32
160 define void @ole_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
163 %1 = load <2 x double>, <2 x double>* %a
164 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
165 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
171 ; CHECK-DAG: st.d [[R3]], 0($4)
174 ; CHECK: .size ole_v2f64
177 define void @olt_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
180 %1 = load <4 x float>, <4 x float>* %a
181 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
182 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
188 ; CHECK-DAG: st.w [[R3]], 0($4)
191 ; CHECK: .size olt_v4f32
194 define void @olt_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
197 %1 = load <2 x double>, <2 x double>* %a
198 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
199 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
205 ; CHECK-DAG: st.d [[R3]], 0($4)
208 ; CHECK: .size olt_v2f64
211 define void @one_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
214 %1 = load <4 x float>, <4 x float>* %a
215 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
216 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
222 ; CHECK-DAG: st.w [[R3]], 0($4)
225 ; CHECK: .size one_v4f32
228 define void @one_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
231 %1 = load <2 x double>, <2 x double>* %a
232 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
233 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
239 ; CHECK-DAG: st.d [[R3]], 0($4)
242 ; CHECK: .size one_v2f64
245 define void @ord_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
248 %1 = load <4 x float>, <4 x float>* %a
249 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
250 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
256 ; CHECK-DAG: st.w [[R3]], 0($4)
259 ; CHECK: .size ord_v4f32
262 define void @ord_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
265 %1 = load <2 x double>, <2 x double>* %a
266 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
267 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
273 ; CHECK-DAG: st.d [[R3]], 0($4)
276 ; CHECK: .size ord_v2f64
279 define void @ueq_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
282 %1 = load <4 x float>, <4 x float>* %a
283 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
284 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
290 ; CHECK-DAG: st.w [[R3]], 0($4)
293 ; CHECK: .size ueq_v4f32
296 define void @ueq_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
299 %1 = load <2 x double>, <2 x double>* %a
300 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
301 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
307 ; CHECK-DAG: st.d [[R3]], 0($4)
310 ; CHECK: .size ueq_v2f64
313 define void @uge_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
316 %1 = load <4 x float>, <4 x float>* %a
317 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
318 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
324 ; CHECK-DAG: st.w [[R3]], 0($4)
327 ; CHECK: .size uge_v4f32
330 define void @uge_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
333 %1 = load <2 x double>, <2 x double>* %a
334 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
335 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
341 ; CHECK-DAG: st.d [[R3]], 0($4)
344 ; CHECK: .size uge_v2f64
347 define void @ugt_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
350 %1 = load <4 x float>, <4 x float>* %a
351 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
352 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
358 ; CHECK-DAG: st.w [[R3]], 0($4)
361 ; CHECK: .size ugt_v4f32
364 define void @ugt_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
367 %1 = load <2 x double>, <2 x double>* %a
368 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
369 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
375 ; CHECK-DAG: st.d [[R3]], 0($4)
378 ; CHECK: .size ugt_v2f64
381 define void @ule_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
384 %1 = load <4 x float>, <4 x float>* %a
385 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
386 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
392 ; CHECK-DAG: st.w [[R3]], 0($4)
395 ; CHECK: .size ule_v4f32
398 define void @ule_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
401 %1 = load <2 x double>, <2 x double>* %a
402 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
403 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
409 ; CHECK-DAG: st.d [[R3]], 0($4)
412 ; CHECK: .size ule_v2f64
415 define void @ult_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
418 %1 = load <4 x float>, <4 x float>* %a
419 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
420 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
426 ; CHECK-DAG: st.w [[R3]], 0($4)
429 ; CHECK: .size ult_v4f32
432 define void @ult_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
435 %1 = load <2 x double>, <2 x double>* %a
436 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
437 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
443 ; CHECK-DAG: st.d [[R3]], 0($4)
446 ; CHECK: .size ult_v2f64
449 define void @uno_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
452 %1 = load <4 x float>, <4 x float>* %a
453 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
454 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %c
460 ; CHECK-DAG: st.w [[R3]], 0($4)
463 ; CHECK: .size uno_v4f32
466 define void @uno_v2f64(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
469 %1 = load <2 x double>, <2 x double>* %a
470 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
471 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %c
477 ; CHECK-DAG: st.d [[R3]], 0($4)
480 ; CHECK: .size uno_v2f64
483 define void @true_v4f32(<4 x i32>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
486 %1 = load <4 x float>, <4 x float>* %a
487 %2 = load <4 x float>, <4 x float>* %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, <4 x i32>* %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(<2 x i64>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
502 %1 = load <2 x double>, <2 x double>* %a
503 %2 = load <2 x double>, <2 x double>* %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, <2 x i64>* %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(<4 x float>* %d, <4 x float>* %a, <4 x float>* %b,
516 <4 x float>* %c) nounwind {
519 %1 = load <4 x float>, <4 x float>* %a
520 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
521 %2 = load <4 x float>, <4 x float>* %b
522 ; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
523 %3 = load <4 x float>, <4 x float>* %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, <4 x float>* %d
531 ; CHECK-DAG: st.w [[R4]], 0($4)
534 ; CHECK: .size bsel_v4f32
537 define void @bsel_v2f64(<2 x double>* %d, <2 x double>* %a, <2 x double>* %b,
538 <2 x double>* %c) nounwind {
541 %1 = load <2 x double>, <2 x double>* %a
542 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
543 %2 = load <2 x double>, <2 x double>* %b
544 ; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
545 %3 = load <2 x double>, <2 x double>* %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, <2 x double>* %d
553 ; CHECK-DAG: st.d [[R4]], 0($4)
556 ; CHECK: .size bsel_v2f64
559 define void @bseli_v4f32(<4 x float>* %d, <4 x float>* %a, <4 x float>* %b,
560 <4 x float>* %c) nounwind {
561 ; CHECK: bseli_v4f32:
563 %1 = load <4 x float>, <4 x float>* %a
564 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
565 %2 = load <4 x float>, <4 x float>* %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, <4 x float>* %d
573 ; CHECK-DAG: st.w [[R4]], 0($4)
576 ; CHECK: .size bseli_v4f32
579 define void @bseli_v2f64(<2 x double>* %d, <2 x double>* %a, <2 x double>* %b,
580 <2 x double>* %c) nounwind {
581 ; CHECK: bseli_v2f64:
583 %1 = load <2 x double>, <2 x double>* %a
584 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
585 %2 = load <2 x double>, <2 x double>* %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, <2 x double>* %d
593 ; CHECK-DAG: st.d [[R4]], 0($4)
596 ; CHECK: .size bseli_v2f64
599 define void @max_v4f32(<4 x float>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
602 %1 = load <4 x float>, <4 x float>* %a
603 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
604 %2 = load <4 x float>, <4 x float>* %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, <4 x float>* %c
609 ; CHECK-DAG: st.w [[R3]], 0($4)
612 ; CHECK: .size max_v4f32
615 define void @max_v2f64(<2 x double>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
618 %1 = load <2 x double>, <2 x double>* %a
619 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
620 %2 = load <2 x double>, <2 x double>* %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, <2 x double>* %c
625 ; CHECK-DAG: st.d [[R3]], 0($4)
628 ; CHECK: .size max_v2f64
631 define void @min_v4f32(<4 x float>* %c, <4 x float>* %a, <4 x float>* %b) nounwind {
634 %1 = load <4 x float>, <4 x float>* %a
635 ; CHECK-DAG: ld.w [[R1:\$w[0-9]+]], 0($5)
636 %2 = load <4 x float>, <4 x float>* %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, <4 x float>* %c
641 ; CHECK-DAG: st.w [[R3]], 0($4)
644 ; CHECK: .size min_v4f32
647 define void @min_v2f64(<2 x double>* %c, <2 x double>* %a, <2 x double>* %b) nounwind {
650 %1 = load <2 x double>, <2 x double>* %a
651 ; CHECK-DAG: ld.d [[R1:\$w[0-9]+]], 0($5)
652 %2 = load <2 x double>, <2 x double>* %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, <2 x double>* %c
657 ; CHECK-DAG: st.d [[R3]], 0($4)
660 ; CHECK: .size min_v2f64