1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=armv8-eabi | FileCheck %s
4 declare float @llvm.minnum.f32(float, float)
5 declare float @llvm.maxnum.f32(float, float)
6 declare float @llvm.minimum.f32(float, float)
7 declare float @llvm.maximum.f32(float, float)
8 declare <2 x float> @llvm.minnum.v2f32(<2 x float>, <2 x float>)
9 declare <2 x float> @llvm.maxnum.v2f32(<2 x float>, <2 x float>)
10 declare <2 x float> @llvm.minimum.v2f32(<2 x float>, <2 x float>)
11 declare <2 x float> @llvm.maximum.v2f32(<2 x float>, <2 x float>)
13 define float @test_minnum_const_nan(float %x) {
14 ; CHECK-LABEL: test_minnum_const_nan:
17 %r = call float @llvm.minnum.f32(float %x, float 0x7fff000000000000)
21 define float @test_maxnum_const_nan(float %x) {
22 ; CHECK-LABEL: test_maxnum_const_nan:
25 %r = call float @llvm.maxnum.f32(float %x, float 0x7fff000000000000)
29 define float @test_maximum_const_nan(float %x) {
30 ; CHECK-LABEL: test_maximum_const_nan:
32 ; CHECK-NEXT: movw r0, #0
33 ; CHECK-NEXT: movt r0, #32760
35 %r = call float @llvm.maximum.f32(float %x, float 0x7fff000000000000)
39 define float @test_minimum_const_nan(float %x) {
40 ; CHECK-LABEL: test_minimum_const_nan:
42 ; CHECK-NEXT: movw r0, #0
43 ; CHECK-NEXT: movt r0, #32760
45 %r = call float @llvm.minimum.f32(float %x, float 0x7fff000000000000)
49 define float @test_minnum_const_inf(float %x) {
50 ; CHECK-LABEL: test_minnum_const_inf:
52 ; CHECK-NEXT: vldr s0, .LCPI4_0
53 ; CHECK-NEXT: vmov s2, r0
54 ; CHECK-NEXT: vminnm.f32 s0, s2, s0
55 ; CHECK-NEXT: vmov r0, s0
57 ; CHECK-NEXT: .p2align 2
58 ; CHECK-NEXT: @ %bb.1:
59 ; CHECK-NEXT: .LCPI4_0:
60 ; CHECK-NEXT: .long 0x7f800000 @ float +Inf
61 %r = call float @llvm.minnum.f32(float %x, float 0x7ff0000000000000)
65 define float @test_maxnum_const_inf(float %x) {
66 ; CHECK-LABEL: test_maxnum_const_inf:
68 ; CHECK-NEXT: movw r0, #0
69 ; CHECK-NEXT: movt r0, #32640
71 %r = call float @llvm.maxnum.f32(float %x, float 0x7ff0000000000000)
75 define float @test_maximum_const_inf(float %x) {
76 ; CHECK-LABEL: test_maximum_const_inf:
78 ; CHECK-NEXT: vldr s0, .LCPI6_0
79 ; CHECK-NEXT: vmov s2, r0
80 ; CHECK-NEXT: vmax.f32 d0, d1, d0
81 ; CHECK-NEXT: vmov r0, s0
83 ; CHECK-NEXT: .p2align 2
84 ; CHECK-NEXT: @ %bb.1:
85 ; CHECK-NEXT: .LCPI6_0:
86 ; CHECK-NEXT: .long 0x7f800000 @ float +Inf
87 %r = call float @llvm.maximum.f32(float %x, float 0x7ff0000000000000)
91 define float @test_minimum_const_inf(float %x) {
92 ; CHECK-LABEL: test_minimum_const_inf:
95 %r = call float @llvm.minimum.f32(float %x, float 0x7ff0000000000000)
99 define float @test_minnum_const_neg_inf(float %x) {
100 ; CHECK-LABEL: test_minnum_const_neg_inf:
102 ; CHECK-NEXT: movw r0, #0
103 ; CHECK-NEXT: movt r0, #65408
105 %r = call float @llvm.minnum.f32(float %x, float 0xfff0000000000000)
109 define float @test_maxnum_const_neg_inf(float %x) {
110 ; CHECK-LABEL: test_maxnum_const_neg_inf:
112 ; CHECK-NEXT: vldr s0, .LCPI9_0
113 ; CHECK-NEXT: vmov s2, r0
114 ; CHECK-NEXT: vmaxnm.f32 s0, s2, s0
115 ; CHECK-NEXT: vmov r0, s0
117 ; CHECK-NEXT: .p2align 2
118 ; CHECK-NEXT: @ %bb.1:
119 ; CHECK-NEXT: .LCPI9_0:
120 ; CHECK-NEXT: .long 0xff800000 @ float -Inf
121 %r = call float @llvm.maxnum.f32(float %x, float 0xfff0000000000000)
125 define float @test_maximum_const_neg_inf(float %x) {
126 ; CHECK-LABEL: test_maximum_const_neg_inf:
129 %r = call float @llvm.maximum.f32(float %x, float 0xfff0000000000000)
133 define float @test_minimum_const_neg_inf(float %x) {
134 ; CHECK-LABEL: test_minimum_const_neg_inf:
136 ; CHECK-NEXT: vldr s0, .LCPI11_0
137 ; CHECK-NEXT: vmov s2, r0
138 ; CHECK-NEXT: vmin.f32 d0, d1, d0
139 ; CHECK-NEXT: vmov r0, s0
141 ; CHECK-NEXT: .p2align 2
142 ; CHECK-NEXT: @ %bb.1:
143 ; CHECK-NEXT: .LCPI11_0:
144 ; CHECK-NEXT: .long 0xff800000 @ float -Inf
145 %r = call float @llvm.minimum.f32(float %x, float 0xfff0000000000000)
149 define float @test_minnum_const_inf_nnan(float %x) {
150 ; CHECK-LABEL: test_minnum_const_inf_nnan:
153 %r = call nnan float @llvm.minnum.f32(float %x, float 0x7ff0000000000000)
157 define float @test_maxnum_const_inf_nnan(float %x) {
158 ; CHECK-LABEL: test_maxnum_const_inf_nnan:
160 ; CHECK-NEXT: movw r0, #0
161 ; CHECK-NEXT: movt r0, #32640
163 %r = call nnan float @llvm.maxnum.f32(float %x, float 0x7ff0000000000000)
167 define float @test_maximum_const_inf_nnan(float %x) {
168 ; CHECK-LABEL: test_maximum_const_inf_nnan:
170 ; CHECK-NEXT: movw r0, #0
171 ; CHECK-NEXT: movt r0, #32640
173 %r = call nnan float @llvm.maximum.f32(float %x, float 0x7ff0000000000000)
177 define float @test_minimum_const_inf_nnan(float %x) {
178 ; CHECK-LABEL: test_minimum_const_inf_nnan:
181 %r = call nnan float @llvm.minimum.f32(float %x, float 0x7ff0000000000000)
185 define float @test_minnum_const_inf_nnan_comm(float %x) {
186 ; CHECK-LABEL: test_minnum_const_inf_nnan_comm:
189 %r = call nnan float @llvm.minnum.f32(float 0x7ff0000000000000, float %x)
193 define float @test_maxnum_const_inf_nnan_comm(float %x) {
194 ; CHECK-LABEL: test_maxnum_const_inf_nnan_comm:
196 ; CHECK-NEXT: movw r0, #0
197 ; CHECK-NEXT: movt r0, #32640
199 %r = call nnan float @llvm.maxnum.f32(float 0x7ff0000000000000, float %x)
203 define float @test_maximum_const_inf_nnan_comm(float %x) {
204 ; CHECK-LABEL: test_maximum_const_inf_nnan_comm:
206 ; CHECK-NEXT: movw r0, #0
207 ; CHECK-NEXT: movt r0, #32640
209 %r = call nnan float @llvm.maximum.f32(float 0x7ff0000000000000, float %x)
213 define float @test_minimum_const_inf_nnan_comm(float %x) {
214 ; CHECK-LABEL: test_minimum_const_inf_nnan_comm:
217 %r = call nnan float @llvm.minimum.f32(float 0x7ff0000000000000, float %x)
221 define <2 x float> @test_minnum_const_inf_nnan_comm_vec(<2 x float> %x) {
222 ; CHECK-LABEL: test_minnum_const_inf_nnan_comm_vec:
225 %r = call nnan <2 x float> @llvm.minnum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
229 define <2 x float> @test_maxnum_const_inf_nnan_comm_vec(<2 x float> %x) {
230 ; CHECK-LABEL: test_maxnum_const_inf_nnan_comm_vec:
232 ; CHECK-NEXT: vldr d16, .LCPI21_0
233 ; CHECK-NEXT: vmov r0, r1, d16
235 ; CHECK-NEXT: .p2align 3
236 ; CHECK-NEXT: @ %bb.1:
237 ; CHECK-NEXT: .LCPI21_0:
238 ; CHECK-NEXT: .long 0x7f800000 @ float +Inf
239 ; CHECK-NEXT: .long 0x7f800000 @ float +Inf
240 %r = call nnan <2 x float> @llvm.maxnum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
244 define <2 x float> @test_maximum_const_inf_nnan_comm_vec(<2 x float> %x) {
245 ; CHECK-LABEL: test_maximum_const_inf_nnan_comm_vec:
247 ; CHECK-NEXT: vldr d16, .LCPI22_0
248 ; CHECK-NEXT: vmov r0, r1, d16
250 ; CHECK-NEXT: .p2align 3
251 ; CHECK-NEXT: @ %bb.1:
252 ; CHECK-NEXT: .LCPI22_0:
253 ; CHECK-NEXT: .long 0x7f800000 @ float +Inf
254 ; CHECK-NEXT: .long 0x7f800000 @ float +Inf
255 %r = call nnan <2 x float> @llvm.maximum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
259 define <2 x float> @test_minimum_const_inf_nnan_comm_vec(<2 x float> %x) {
260 ; CHECK-LABEL: test_minimum_const_inf_nnan_comm_vec:
263 %r = call nnan <2 x float> @llvm.minimum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
267 define float @test_minnum_const_neg_inf_nnan(float %x) {
268 ; CHECK-LABEL: test_minnum_const_neg_inf_nnan:
270 ; CHECK-NEXT: movw r0, #0
271 ; CHECK-NEXT: movt r0, #65408
273 %r = call nnan float @llvm.minnum.f32(float %x, float 0xfff0000000000000)
277 define float @test_maxnum_const_neg_inf_nnan(float %x) {
278 ; CHECK-LABEL: test_maxnum_const_neg_inf_nnan:
281 %r = call nnan float @llvm.maxnum.f32(float %x, float 0xfff0000000000000)
285 define float @test_maximum_const_neg_inf_nnan(float %x) {
286 ; CHECK-LABEL: test_maximum_const_neg_inf_nnan:
289 %r = call nnan float @llvm.maximum.f32(float %x, float 0xfff0000000000000)
293 define float @test_minimum_const_neg_inf_nnan(float %x) {
294 ; CHECK-LABEL: test_minimum_const_neg_inf_nnan:
296 ; CHECK-NEXT: movw r0, #0
297 ; CHECK-NEXT: movt r0, #65408
299 %r = call nnan float @llvm.minimum.f32(float %x, float 0xfff0000000000000)
303 define float @test_minnum_const_max(float %x) {
304 ; CHECK-LABEL: test_minnum_const_max:
306 ; CHECK-NEXT: vldr s0, .LCPI28_0
307 ; CHECK-NEXT: vmov s2, r0
308 ; CHECK-NEXT: vminnm.f32 s0, s2, s0
309 ; CHECK-NEXT: vmov r0, s0
311 ; CHECK-NEXT: .p2align 2
312 ; CHECK-NEXT: @ %bb.1:
313 ; CHECK-NEXT: .LCPI28_0:
314 ; CHECK-NEXT: .long 0x7f7fffff @ float 3.40282347E+38
315 %r = call float @llvm.minnum.f32(float %x, float 0x47efffffe0000000)
319 define float @test_maxnum_const_max(float %x) {
320 ; CHECK-LABEL: test_maxnum_const_max:
322 ; CHECK-NEXT: vldr s0, .LCPI29_0
323 ; CHECK-NEXT: vmov s2, r0
324 ; CHECK-NEXT: vmaxnm.f32 s0, s2, s0
325 ; CHECK-NEXT: vmov r0, s0
327 ; CHECK-NEXT: .p2align 2
328 ; CHECK-NEXT: @ %bb.1:
329 ; CHECK-NEXT: .LCPI29_0:
330 ; CHECK-NEXT: .long 0x7f7fffff @ float 3.40282347E+38
331 %r = call float @llvm.maxnum.f32(float %x, float 0x47efffffe0000000)
335 define float @test_maximum_const_max(float %x) {
336 ; CHECK-LABEL: test_maximum_const_max:
338 ; CHECK-NEXT: vldr s0, .LCPI30_0
339 ; CHECK-NEXT: vmov s2, r0
340 ; CHECK-NEXT: vmax.f32 d0, d1, d0
341 ; CHECK-NEXT: vmov r0, s0
343 ; CHECK-NEXT: .p2align 2
344 ; CHECK-NEXT: @ %bb.1:
345 ; CHECK-NEXT: .LCPI30_0:
346 ; CHECK-NEXT: .long 0x7f7fffff @ float 3.40282347E+38
347 %r = call float @llvm.maximum.f32(float %x, float 0x47efffffe0000000)
351 define float @test_minimum_const_max(float %x) {
352 ; CHECK-LABEL: test_minimum_const_max:
354 ; CHECK-NEXT: vldr s0, .LCPI31_0
355 ; CHECK-NEXT: vmov s2, r0
356 ; CHECK-NEXT: vmin.f32 d0, d1, d0
357 ; CHECK-NEXT: vmov r0, s0
359 ; CHECK-NEXT: .p2align 2
360 ; CHECK-NEXT: @ %bb.1:
361 ; CHECK-NEXT: .LCPI31_0:
362 ; CHECK-NEXT: .long 0x7f7fffff @ float 3.40282347E+38
363 %r = call float @llvm.minimum.f32(float %x, float 0x47efffffe0000000)
367 define float @test_minnum_const_neg_max(float %x) {
368 ; CHECK-LABEL: test_minnum_const_neg_max:
370 ; CHECK-NEXT: vldr s0, .LCPI32_0
371 ; CHECK-NEXT: vmov s2, r0
372 ; CHECK-NEXT: vminnm.f32 s0, s2, s0
373 ; CHECK-NEXT: vmov r0, s0
375 ; CHECK-NEXT: .p2align 2
376 ; CHECK-NEXT: @ %bb.1:
377 ; CHECK-NEXT: .LCPI32_0:
378 ; CHECK-NEXT: .long 0xff7fffff @ float -3.40282347E+38
379 %r = call float @llvm.minnum.f32(float %x, float 0xc7efffffe0000000)
383 define float @test_maxnum_const_neg_max(float %x) {
384 ; CHECK-LABEL: test_maxnum_const_neg_max:
386 ; CHECK-NEXT: vldr s0, .LCPI33_0
387 ; CHECK-NEXT: vmov s2, r0
388 ; CHECK-NEXT: vmaxnm.f32 s0, s2, s0
389 ; CHECK-NEXT: vmov r0, s0
391 ; CHECK-NEXT: .p2align 2
392 ; CHECK-NEXT: @ %bb.1:
393 ; CHECK-NEXT: .LCPI33_0:
394 ; CHECK-NEXT: .long 0xff7fffff @ float -3.40282347E+38
395 %r = call float @llvm.maxnum.f32(float %x, float 0xc7efffffe0000000)
399 define float @test_maximum_const_neg_max(float %x) {
400 ; CHECK-LABEL: test_maximum_const_neg_max:
402 ; CHECK-NEXT: vldr s0, .LCPI34_0
403 ; CHECK-NEXT: vmov s2, r0
404 ; CHECK-NEXT: vmax.f32 d0, d1, d0
405 ; CHECK-NEXT: vmov r0, s0
407 ; CHECK-NEXT: .p2align 2
408 ; CHECK-NEXT: @ %bb.1:
409 ; CHECK-NEXT: .LCPI34_0:
410 ; CHECK-NEXT: .long 0xff7fffff @ float -3.40282347E+38
411 %r = call float @llvm.maximum.f32(float %x, float 0xc7efffffe0000000)
415 define float @test_minimum_const_neg_max(float %x) {
416 ; CHECK-LABEL: test_minimum_const_neg_max:
418 ; CHECK-NEXT: vldr s0, .LCPI35_0
419 ; CHECK-NEXT: vmov s2, r0
420 ; CHECK-NEXT: vmin.f32 d0, d1, d0
421 ; CHECK-NEXT: vmov r0, s0
423 ; CHECK-NEXT: .p2align 2
424 ; CHECK-NEXT: @ %bb.1:
425 ; CHECK-NEXT: .LCPI35_0:
426 ; CHECK-NEXT: .long 0xff7fffff @ float -3.40282347E+38
427 %r = call float @llvm.minimum.f32(float %x, float 0xc7efffffe0000000)
431 define float @test_minnum_const_max_ninf(float %x) {
432 ; CHECK-LABEL: test_minnum_const_max_ninf:
434 ; CHECK-NEXT: vldr s0, .LCPI36_0
435 ; CHECK-NEXT: vmov s2, r0
436 ; CHECK-NEXT: vminnm.f32 s0, s2, s0
437 ; CHECK-NEXT: vmov r0, s0
439 ; CHECK-NEXT: .p2align 2
440 ; CHECK-NEXT: @ %bb.1:
441 ; CHECK-NEXT: .LCPI36_0:
442 ; CHECK-NEXT: .long 0x7f7fffff @ float 3.40282347E+38
443 %r = call ninf float @llvm.minnum.f32(float %x, float 0x47efffffe0000000)
447 define float @test_maxnum_const_max_ninf(float %x) {
448 ; CHECK-LABEL: test_maxnum_const_max_ninf:
450 ; CHECK-NEXT: movw r0, #65535
451 ; CHECK-NEXT: movt r0, #32639
453 %r = call ninf float @llvm.maxnum.f32(float %x, float 0x47efffffe0000000)
457 define float @test_maximum_const_max_ninf(float %x) {
458 ; CHECK-LABEL: test_maximum_const_max_ninf:
460 ; CHECK-NEXT: vldr s0, .LCPI38_0
461 ; CHECK-NEXT: vmov s2, r0
462 ; CHECK-NEXT: vmax.f32 d0, d1, d0
463 ; CHECK-NEXT: vmov r0, s0
465 ; CHECK-NEXT: .p2align 2
466 ; CHECK-NEXT: @ %bb.1:
467 ; CHECK-NEXT: .LCPI38_0:
468 ; CHECK-NEXT: .long 0x7f7fffff @ float 3.40282347E+38
469 %r = call ninf float @llvm.maximum.f32(float %x, float 0x47efffffe0000000)
473 define float @test_minimum_const_max_ninf(float %x) {
474 ; CHECK-LABEL: test_minimum_const_max_ninf:
477 %r = call ninf float @llvm.minimum.f32(float %x, float 0x47efffffe0000000)
481 define float @test_minnum_const_neg_max_ninf(float %x) {
482 ; CHECK-LABEL: test_minnum_const_neg_max_ninf:
484 ; CHECK-NEXT: mvn r0, #8388608
486 %r = call ninf float @llvm.minnum.f32(float %x, float 0xc7efffffe0000000)
490 define float @test_maxnum_const_neg_max_ninf(float %x) {
491 ; CHECK-LABEL: test_maxnum_const_neg_max_ninf:
493 ; CHECK-NEXT: vldr s0, .LCPI41_0
494 ; CHECK-NEXT: vmov s2, r0
495 ; CHECK-NEXT: vmaxnm.f32 s0, s2, s0
496 ; CHECK-NEXT: vmov r0, s0
498 ; CHECK-NEXT: .p2align 2
499 ; CHECK-NEXT: @ %bb.1:
500 ; CHECK-NEXT: .LCPI41_0:
501 ; CHECK-NEXT: .long 0xff7fffff @ float -3.40282347E+38
502 %r = call ninf float @llvm.maxnum.f32(float %x, float 0xc7efffffe0000000)
506 define float @test_maximum_const_neg_max_ninf(float %x) {
507 ; CHECK-LABEL: test_maximum_const_neg_max_ninf:
510 %r = call ninf float @llvm.maximum.f32(float %x, float 0xc7efffffe0000000)
514 define float @test_minimum_const_neg_max_ninf(float %x) {
515 ; CHECK-LABEL: test_minimum_const_neg_max_ninf:
517 ; CHECK-NEXT: vldr s0, .LCPI43_0
518 ; CHECK-NEXT: vmov s2, r0
519 ; CHECK-NEXT: vmin.f32 d0, d1, d0
520 ; CHECK-NEXT: vmov r0, s0
522 ; CHECK-NEXT: .p2align 2
523 ; CHECK-NEXT: @ %bb.1:
524 ; CHECK-NEXT: .LCPI43_0:
525 ; CHECK-NEXT: .long 0xff7fffff @ float -3.40282347E+38
526 %r = call ninf float @llvm.minimum.f32(float %x, float 0xc7efffffe0000000)
530 define float @test_minnum_const_max_nnan_ninf(float %x) {
531 ; CHECK-LABEL: test_minnum_const_max_nnan_ninf:
534 %r = call nnan ninf float @llvm.minnum.f32(float %x, float 0x47efffffe0000000)
538 define float @test_maxnum_const_max_nnan_ninf(float %x) {
539 ; CHECK-LABEL: test_maxnum_const_max_nnan_ninf:
541 ; CHECK-NEXT: movw r0, #65535
542 ; CHECK-NEXT: movt r0, #32639
544 %r = call nnan ninf float @llvm.maxnum.f32(float %x, float 0x47efffffe0000000)
548 define float @test_maximum_const_max_nnan_ninf(float %x) {
549 ; CHECK-LABEL: test_maximum_const_max_nnan_ninf:
551 ; CHECK-NEXT: movw r0, #65535
552 ; CHECK-NEXT: movt r0, #32639
554 %r = call nnan ninf float @llvm.maximum.f32(float %x, float 0x47efffffe0000000)
558 define float @test_minimum_const_max_nnan_ninf(float %x) {
559 ; CHECK-LABEL: test_minimum_const_max_nnan_ninf:
562 %r = call nnan ninf float @llvm.minimum.f32(float %x, float 0x47efffffe0000000)
566 define float @test_minnum_const_neg_max_nnan_ninf(float %x) {
567 ; CHECK-LABEL: test_minnum_const_neg_max_nnan_ninf:
569 ; CHECK-NEXT: mvn r0, #8388608
571 %r = call nnan ninf float @llvm.minnum.f32(float %x, float 0xc7efffffe0000000)
575 define float @test_maxnum_const_neg_max_nnan_ninf(float %x) {
576 ; CHECK-LABEL: test_maxnum_const_neg_max_nnan_ninf:
579 %r = call nnan ninf float @llvm.maxnum.f32(float %x, float 0xc7efffffe0000000)
583 define float @test_maximum_const_neg_max_nnan_ninf(float %x) {
584 ; CHECK-LABEL: test_maximum_const_neg_max_nnan_ninf:
587 %r = call nnan ninf float @llvm.maximum.f32(float %x, float 0xc7efffffe0000000)
591 define float @test_minimum_const_neg_max_nnan_ninf(float %x) {
592 ; CHECK-LABEL: test_minimum_const_neg_max_nnan_ninf:
594 ; CHECK-NEXT: mvn r0, #8388608
596 %r = call nnan ninf float @llvm.minimum.f32(float %x, float 0xc7efffffe0000000)