1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instsimplify -S | 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 declare double @llvm.minnum.f64(double, double)
14 declare double @llvm.maxnum.f64(double, double)
15 declare <2 x double> @llvm.minnum.v2f64(<2 x double>, <2 x double>)
16 declare <2 x double> @llvm.maxnum.v2f64(<2 x double>, <2 x double>)
17 declare double @llvm.minimum.f64(double, double)
18 declare double @llvm.maximum.f64(double, double)
19 declare <2 x double> @llvm.minimum.v2f64(<2 x double>, <2 x double>)
20 declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>)
22 define float @test_minnum_const_nan(float %x) {
23 ; CHECK-LABEL: @test_minnum_const_nan(
24 ; CHECK-NEXT: ret float [[X:%.*]]
26 %r = call float @llvm.minnum.f32(float %x, float 0x7fff000000000000)
30 define float @test_maxnum_const_nan(float %x) {
31 ; CHECK-LABEL: @test_maxnum_const_nan(
32 ; CHECK-NEXT: ret float [[X:%.*]]
34 %r = call float @llvm.maxnum.f32(float %x, float 0x7fff000000000000)
38 define float @test_maximum_const_nan(float %x) {
39 ; CHECK-LABEL: @test_maximum_const_nan(
40 ; CHECK-NEXT: ret float 0x7FFF000000000000
42 %r = call float @llvm.maximum.f32(float %x, float 0x7fff000000000000)
46 define float @test_minimum_const_nan(float %x) {
47 ; CHECK-LABEL: @test_minimum_const_nan(
48 ; CHECK-NEXT: ret float 0x7FFF000000000000
50 %r = call float @llvm.minimum.f32(float %x, float 0x7fff000000000000)
54 define float @test_minnum_const_inf(float %x) {
55 ; CHECK-LABEL: @test_minnum_const_inf(
56 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 0x7FF0000000000000)
57 ; CHECK-NEXT: ret float [[R]]
59 %r = call float @llvm.minnum.f32(float %x, float 0x7ff0000000000000)
63 define float @test_maxnum_const_inf(float %x) {
64 ; CHECK-LABEL: @test_maxnum_const_inf(
65 ; CHECK-NEXT: ret float 0x7FF0000000000000
67 %r = call float @llvm.maxnum.f32(float %x, float 0x7ff0000000000000)
71 define float @test_maximum_const_inf(float %x) {
72 ; CHECK-LABEL: @test_maximum_const_inf(
73 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float 0x7FF0000000000000)
74 ; CHECK-NEXT: ret float [[R]]
76 %r = call float @llvm.maximum.f32(float %x, float 0x7ff0000000000000)
80 define float @test_minimum_const_inf(float %x) {
81 ; CHECK-LABEL: @test_minimum_const_inf(
82 ; CHECK-NEXT: ret float [[X:%.*]]
84 %r = call float @llvm.minimum.f32(float %x, float 0x7ff0000000000000)
88 define float @test_minnum_const_neg_inf(float %x) {
89 ; CHECK-LABEL: @test_minnum_const_neg_inf(
90 ; CHECK-NEXT: ret float 0xFFF0000000000000
92 %r = call float @llvm.minnum.f32(float %x, float 0xfff0000000000000)
96 define float @test_maxnum_const_neg_inf(float %x) {
97 ; CHECK-LABEL: @test_maxnum_const_neg_inf(
98 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 0xFFF0000000000000)
99 ; CHECK-NEXT: ret float [[R]]
101 %r = call float @llvm.maxnum.f32(float %x, float 0xfff0000000000000)
105 define float @test_maximum_const_neg_inf(float %x) {
106 ; CHECK-LABEL: @test_maximum_const_neg_inf(
107 ; CHECK-NEXT: ret float [[X:%.*]]
109 %r = call float @llvm.maximum.f32(float %x, float 0xfff0000000000000)
113 define float @test_minimum_const_neg_inf(float %x) {
114 ; CHECK-LABEL: @test_minimum_const_neg_inf(
115 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float 0xFFF0000000000000)
116 ; CHECK-NEXT: ret float [[R]]
118 %r = call float @llvm.minimum.f32(float %x, float 0xfff0000000000000)
122 define float @test_minnum_const_inf_nnan(float %x) {
123 ; CHECK-LABEL: @test_minnum_const_inf_nnan(
124 ; CHECK-NEXT: ret float [[X:%.*]]
126 %r = call nnan float @llvm.minnum.f32(float %x, float 0x7ff0000000000000)
130 define float @test_maxnum_const_inf_nnan(float %x) {
131 ; CHECK-LABEL: @test_maxnum_const_inf_nnan(
132 ; CHECK-NEXT: ret float 0x7FF0000000000000
134 %r = call nnan float @llvm.maxnum.f32(float %x, float 0x7ff0000000000000)
138 define float @test_maximum_const_inf_nnan(float %x) {
139 ; CHECK-LABEL: @test_maximum_const_inf_nnan(
140 ; CHECK-NEXT: ret float 0x7FF0000000000000
142 %r = call nnan float @llvm.maximum.f32(float %x, float 0x7ff0000000000000)
146 define float @test_minimum_const_inf_nnan(float %x) {
147 ; CHECK-LABEL: @test_minimum_const_inf_nnan(
148 ; CHECK-NEXT: ret float [[X:%.*]]
150 %r = call nnan float @llvm.minimum.f32(float %x, float 0x7ff0000000000000)
154 define float @test_minnum_const_inf_nnan_comm(float %x) {
155 ; CHECK-LABEL: @test_minnum_const_inf_nnan_comm(
156 ; CHECK-NEXT: ret float [[X:%.*]]
158 %r = call nnan float @llvm.minnum.f32(float 0x7ff0000000000000, float %x)
162 define float @test_maxnum_const_inf_nnan_comm(float %x) {
163 ; CHECK-LABEL: @test_maxnum_const_inf_nnan_comm(
164 ; CHECK-NEXT: ret float 0x7FF0000000000000
166 %r = call nnan float @llvm.maxnum.f32(float 0x7ff0000000000000, float %x)
170 define float @test_maximum_const_inf_nnan_comm(float %x) {
171 ; CHECK-LABEL: @test_maximum_const_inf_nnan_comm(
172 ; CHECK-NEXT: ret float 0x7FF0000000000000
174 %r = call nnan float @llvm.maximum.f32(float 0x7ff0000000000000, float %x)
178 define float @test_minimum_const_inf_nnan_comm(float %x) {
179 ; CHECK-LABEL: @test_minimum_const_inf_nnan_comm(
180 ; CHECK-NEXT: ret float [[X:%.*]]
182 %r = call nnan float @llvm.minimum.f32(float 0x7ff0000000000000, float %x)
186 define <2 x float> @test_minnum_const_inf_nnan_comm_vec(<2 x float> %x) {
187 ; CHECK-LABEL: @test_minnum_const_inf_nnan_comm_vec(
188 ; CHECK-NEXT: ret <2 x float> [[X:%.*]]
190 %r = call nnan <2 x float> @llvm.minnum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
194 define <2 x float> @test_maxnum_const_inf_nnan_comm_vec(<2 x float> %x) {
195 ; CHECK-LABEL: @test_maxnum_const_inf_nnan_comm_vec(
196 ; CHECK-NEXT: ret <2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>
198 %r = call nnan <2 x float> @llvm.maxnum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
202 define <2 x float> @test_maximum_const_inf_nnan_comm_vec(<2 x float> %x) {
203 ; CHECK-LABEL: @test_maximum_const_inf_nnan_comm_vec(
204 ; CHECK-NEXT: ret <2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>
206 %r = call nnan <2 x float> @llvm.maximum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
210 define <2 x float> @test_minimum_const_inf_nnan_comm_vec(<2 x float> %x) {
211 ; CHECK-LABEL: @test_minimum_const_inf_nnan_comm_vec(
212 ; CHECK-NEXT: ret <2 x float> [[X:%.*]]
214 %r = call nnan <2 x float> @llvm.minimum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
218 define float @test_minnum_const_neg_inf_nnan(float %x) {
219 ; CHECK-LABEL: @test_minnum_const_neg_inf_nnan(
220 ; CHECK-NEXT: ret float 0xFFF0000000000000
222 %r = call nnan float @llvm.minnum.f32(float %x, float 0xfff0000000000000)
226 define float @test_maxnum_const_neg_inf_nnan(float %x) {
227 ; CHECK-LABEL: @test_maxnum_const_neg_inf_nnan(
228 ; CHECK-NEXT: ret float [[X:%.*]]
230 %r = call nnan float @llvm.maxnum.f32(float %x, float 0xfff0000000000000)
234 define float @test_maximum_const_neg_inf_nnan(float %x) {
235 ; CHECK-LABEL: @test_maximum_const_neg_inf_nnan(
236 ; CHECK-NEXT: ret float [[X:%.*]]
238 %r = call nnan float @llvm.maximum.f32(float %x, float 0xfff0000000000000)
242 define float @test_minimum_const_neg_inf_nnan(float %x) {
243 ; CHECK-LABEL: @test_minimum_const_neg_inf_nnan(
244 ; CHECK-NEXT: ret float 0xFFF0000000000000
246 %r = call nnan float @llvm.minimum.f32(float %x, float 0xfff0000000000000)
250 define float @test_minnum_const_max(float %x) {
251 ; CHECK-LABEL: @test_minnum_const_max(
252 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 0x47EFFFFFE0000000)
253 ; CHECK-NEXT: ret float [[R]]
255 %r = call float @llvm.minnum.f32(float %x, float 0x47efffffe0000000)
259 define float @test_maxnum_const_max(float %x) {
260 ; CHECK-LABEL: @test_maxnum_const_max(
261 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 0x47EFFFFFE0000000)
262 ; CHECK-NEXT: ret float [[R]]
264 %r = call float @llvm.maxnum.f32(float %x, float 0x47efffffe0000000)
268 define float @test_maximum_const_max(float %x) {
269 ; CHECK-LABEL: @test_maximum_const_max(
270 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float 0x47EFFFFFE0000000)
271 ; CHECK-NEXT: ret float [[R]]
273 %r = call float @llvm.maximum.f32(float %x, float 0x47efffffe0000000)
277 define float @test_minimum_const_max(float %x) {
278 ; CHECK-LABEL: @test_minimum_const_max(
279 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float 0x47EFFFFFE0000000)
280 ; CHECK-NEXT: ret float [[R]]
282 %r = call float @llvm.minimum.f32(float %x, float 0x47efffffe0000000)
286 define float @test_minnum_const_neg_max(float %x) {
287 ; CHECK-LABEL: @test_minnum_const_neg_max(
288 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 0xC7EFFFFFE0000000)
289 ; CHECK-NEXT: ret float [[R]]
291 %r = call float @llvm.minnum.f32(float %x, float 0xc7efffffe0000000)
295 define float @test_maxnum_const_neg_max(float %x) {
296 ; CHECK-LABEL: @test_maxnum_const_neg_max(
297 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 0xC7EFFFFFE0000000)
298 ; CHECK-NEXT: ret float [[R]]
300 %r = call float @llvm.maxnum.f32(float %x, float 0xc7efffffe0000000)
304 define float @test_maximum_const_neg_max(float %x) {
305 ; CHECK-LABEL: @test_maximum_const_neg_max(
306 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float 0xC7EFFFFFE0000000)
307 ; CHECK-NEXT: ret float [[R]]
309 %r = call float @llvm.maximum.f32(float %x, float 0xc7efffffe0000000)
313 define float @test_minimum_const_neg_max(float %x) {
314 ; CHECK-LABEL: @test_minimum_const_neg_max(
315 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float 0xC7EFFFFFE0000000)
316 ; CHECK-NEXT: ret float [[R]]
318 %r = call float @llvm.minimum.f32(float %x, float 0xc7efffffe0000000)
322 define float @test_minnum_const_max_ninf(float %x) {
323 ; CHECK-LABEL: @test_minnum_const_max_ninf(
324 ; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.minnum.f32(float [[X:%.*]], float 0x47EFFFFFE0000000)
325 ; CHECK-NEXT: ret float [[R]]
327 %r = call ninf float @llvm.minnum.f32(float %x, float 0x47efffffe0000000)
331 define float @test_maxnum_const_max_ninf(float %x) {
332 ; CHECK-LABEL: @test_maxnum_const_max_ninf(
333 ; CHECK-NEXT: ret float 0x47EFFFFFE0000000
335 %r = call ninf float @llvm.maxnum.f32(float %x, float 0x47efffffe0000000)
339 define float @test_maximum_const_max_ninf(float %x) {
340 ; CHECK-LABEL: @test_maximum_const_max_ninf(
341 ; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.maximum.f32(float [[X:%.*]], float 0x47EFFFFFE0000000)
342 ; CHECK-NEXT: ret float [[R]]
344 %r = call ninf float @llvm.maximum.f32(float %x, float 0x47efffffe0000000)
348 define float @test_minimum_const_max_ninf(float %x) {
349 ; CHECK-LABEL: @test_minimum_const_max_ninf(
350 ; CHECK-NEXT: ret float [[X:%.*]]
352 %r = call ninf float @llvm.minimum.f32(float %x, float 0x47efffffe0000000)
356 define float @test_minnum_const_neg_max_ninf(float %x) {
357 ; CHECK-LABEL: @test_minnum_const_neg_max_ninf(
358 ; CHECK-NEXT: ret float 0xC7EFFFFFE0000000
360 %r = call ninf float @llvm.minnum.f32(float %x, float 0xc7efffffe0000000)
364 define float @test_maxnum_const_neg_max_ninf(float %x) {
365 ; CHECK-LABEL: @test_maxnum_const_neg_max_ninf(
366 ; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.maxnum.f32(float [[X:%.*]], float 0xC7EFFFFFE0000000)
367 ; CHECK-NEXT: ret float [[R]]
369 %r = call ninf float @llvm.maxnum.f32(float %x, float 0xc7efffffe0000000)
373 define float @test_maximum_const_neg_max_ninf(float %x) {
374 ; CHECK-LABEL: @test_maximum_const_neg_max_ninf(
375 ; CHECK-NEXT: ret float [[X:%.*]]
377 %r = call ninf float @llvm.maximum.f32(float %x, float 0xc7efffffe0000000)
381 define float @test_minimum_const_neg_max_ninf(float %x) {
382 ; CHECK-LABEL: @test_minimum_const_neg_max_ninf(
383 ; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.minimum.f32(float [[X:%.*]], float 0xC7EFFFFFE0000000)
384 ; CHECK-NEXT: ret float [[R]]
386 %r = call ninf float @llvm.minimum.f32(float %x, float 0xc7efffffe0000000)
390 define float @test_minnum_const_max_nnan_ninf(float %x) {
391 ; CHECK-LABEL: @test_minnum_const_max_nnan_ninf(
392 ; CHECK-NEXT: ret float [[X:%.*]]
394 %r = call nnan ninf float @llvm.minnum.f32(float %x, float 0x47efffffe0000000)
398 define float @test_maxnum_const_max_nnan_ninf(float %x) {
399 ; CHECK-LABEL: @test_maxnum_const_max_nnan_ninf(
400 ; CHECK-NEXT: ret float 0x47EFFFFFE0000000
402 %r = call nnan ninf float @llvm.maxnum.f32(float %x, float 0x47efffffe0000000)
406 define float @test_maximum_const_max_nnan_ninf(float %x) {
407 ; CHECK-LABEL: @test_maximum_const_max_nnan_ninf(
408 ; CHECK-NEXT: ret float 0x47EFFFFFE0000000
410 %r = call nnan ninf float @llvm.maximum.f32(float %x, float 0x47efffffe0000000)
414 define float @test_minimum_const_max_nnan_ninf(float %x) {
415 ; CHECK-LABEL: @test_minimum_const_max_nnan_ninf(
416 ; CHECK-NEXT: ret float [[X:%.*]]
418 %r = call nnan ninf float @llvm.minimum.f32(float %x, float 0x47efffffe0000000)
422 define float @test_minnum_const_neg_max_nnan_ninf(float %x) {
423 ; CHECK-LABEL: @test_minnum_const_neg_max_nnan_ninf(
424 ; CHECK-NEXT: ret float 0xC7EFFFFFE0000000
426 %r = call nnan ninf float @llvm.minnum.f32(float %x, float 0xc7efffffe0000000)
430 define float @test_maxnum_const_neg_max_nnan_ninf(float %x) {
431 ; CHECK-LABEL: @test_maxnum_const_neg_max_nnan_ninf(
432 ; CHECK-NEXT: ret float [[X:%.*]]
434 %r = call nnan ninf float @llvm.maxnum.f32(float %x, float 0xc7efffffe0000000)
438 define float @test_maximum_const_neg_max_nnan_ninf(float %x) {
439 ; CHECK-LABEL: @test_maximum_const_neg_max_nnan_ninf(
440 ; CHECK-NEXT: ret float [[X:%.*]]
442 %r = call nnan ninf float @llvm.maximum.f32(float %x, float 0xc7efffffe0000000)
446 define float @test_minimum_const_neg_max_nnan_ninf(float %x) {
447 ; CHECK-LABEL: @test_minimum_const_neg_max_nnan_ninf(
448 ; CHECK-NEXT: ret float 0xC7EFFFFFE0000000
450 %r = call nnan ninf float @llvm.minimum.f32(float %x, float 0xc7efffffe0000000)
454 ; From the LangRef for minnum/maxnum:
455 ; "If either operand is a NaN, returns the other non-NaN operand."
457 define double @maxnum_nan_op0(double %x) {
458 ; CHECK-LABEL: @maxnum_nan_op0(
459 ; CHECK-NEXT: ret double [[X:%.*]]
461 %r = call double @llvm.maxnum.f64(double 0x7ff8000000000000, double %x)
465 define double @maxnum_nan_op1(double %x) {
466 ; CHECK-LABEL: @maxnum_nan_op1(
467 ; CHECK-NEXT: ret double [[X:%.*]]
469 %r = call double @llvm.maxnum.f64(double %x, double 0x7ff800000000dead)
473 define double @minnum_nan_op0(double %x) {
474 ; CHECK-LABEL: @minnum_nan_op0(
475 ; CHECK-NEXT: ret double [[X:%.*]]
477 %r = call double @llvm.minnum.f64(double 0x7ff8000dead00000, double %x)
481 define double @minnum_nan_op1(double %x) {
482 ; CHECK-LABEL: @minnum_nan_op1(
483 ; CHECK-NEXT: ret double [[X:%.*]]
485 %r = call double @llvm.minnum.f64(double %x, double 0x7ff800dead00dead)
489 define <2 x double> @maxnum_nan_op0_vec(<2 x double> %x) {
490 ; CHECK-LABEL: @maxnum_nan_op0_vec(
491 ; CHECK-NEXT: ret <2 x double> [[X:%.*]]
493 %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> %x)
497 define <2 x double> @maxnum_nan_op1_vec(<2 x double> %x) {
498 ; CHECK-LABEL: @maxnum_nan_op1_vec(
499 ; CHECK-NEXT: ret <2 x double> [[X:%.*]]
501 %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %x, <2 x double> <double 0x7ff800000000dead, double 0x7ff8ffffffffffff>)
505 define <2 x double> @minnum_nan_op0_vec(<2 x double> %x) {
506 ; CHECK-LABEL: @minnum_nan_op0_vec(
507 ; CHECK-NEXT: ret <2 x double> [[X:%.*]]
509 %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double undef, double 0x7ff8000dead00000>, <2 x double> %x)
513 define <2 x double> @minnum_nan_op1_vec(<2 x double> %x) {
514 ; CHECK-LABEL: @minnum_nan_op1_vec(
515 ; CHECK-NEXT: ret <2 x double> [[X:%.*]]
517 %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> %x, <2 x double> <double 0x7ff800dead00dead, double 0x7ff800dead00dead>)
521 define float @maxnum_undef_op1(float %x) {
522 ; CHECK-LABEL: @maxnum_undef_op1(
523 ; CHECK-NEXT: ret float [[X:%.*]]
525 %val = call float @llvm.maxnum.f32(float %x, float undef)
529 define float @maxnum_poison_op1(float %x) {
530 ; CHECK-LABEL: @maxnum_poison_op1(
531 ; CHECK-NEXT: ret float [[X:%.*]]
533 %val = call float @llvm.maxnum.f32(float %x, float poison)
537 define float @maxnum_undef_op0(float %x) {
538 ; CHECK-LABEL: @maxnum_undef_op0(
539 ; CHECK-NEXT: ret float [[X:%.*]]
541 %val = call float @llvm.maxnum.f32(float undef, float %x)
545 define float @maxnum_poison_op0(float %x) {
546 ; CHECK-LABEL: @maxnum_poison_op0(
547 ; CHECK-NEXT: ret float [[X:%.*]]
549 %val = call float @llvm.maxnum.f32(float poison, float %x)
553 define float @minnum_undef_op1(float %x) {
554 ; CHECK-LABEL: @minnum_undef_op1(
555 ; CHECK-NEXT: ret float [[X:%.*]]
557 %val = call float @llvm.minnum.f32(float %x, float undef)
561 define float @minnum_poison_op1(float %x) {
562 ; CHECK-LABEL: @minnum_poison_op1(
563 ; CHECK-NEXT: ret float [[X:%.*]]
565 %val = call float @llvm.minnum.f32(float %x, float poison)
569 define float @minnum_undef_op0(float %x) {
570 ; CHECK-LABEL: @minnum_undef_op0(
571 ; CHECK-NEXT: ret float [[X:%.*]]
573 %val = call float @llvm.minnum.f32(float undef, float %x)
577 define float @minnum_poison_op0(float %x) {
578 ; CHECK-LABEL: @minnum_poison_op0(
579 ; CHECK-NEXT: ret float [[X:%.*]]
581 %val = call float @llvm.minnum.f32(float poison, float %x)
585 define float @minnum_undef_undef(float %x) {
586 ; CHECK-LABEL: @minnum_undef_undef(
587 ; CHECK-NEXT: ret float undef
589 %val = call float @llvm.minnum.f32(float undef, float undef)
593 define float @minnum_poison_undef(float %x) {
594 ; CHECK-LABEL: @minnum_poison_undef(
595 ; CHECK-NEXT: ret float undef
597 %val = call float @llvm.minnum.f32(float poison, float undef)
601 define float @minnum_undef_poison(float %x) {
602 ; CHECK-LABEL: @minnum_undef_poison(
603 ; CHECK-NEXT: ret float poison
605 %val = call float @llvm.minnum.f32(float undef, float poison)
609 define float @maxnum_undef_undef(float %x) {
610 ; CHECK-LABEL: @maxnum_undef_undef(
611 ; CHECK-NEXT: ret float undef
613 %val = call float @llvm.maxnum.f32(float undef, float undef)
617 define float @maxnum_poison_undef(float %x) {
618 ; CHECK-LABEL: @maxnum_poison_undef(
619 ; CHECK-NEXT: ret float undef
621 %val = call float @llvm.maxnum.f32(float poison, float undef)
625 define float @maxnum_undef_poison(float %x) {
626 ; CHECK-LABEL: @maxnum_undef_poison(
627 ; CHECK-NEXT: ret float poison
629 %val = call float @llvm.maxnum.f32(float undef, float poison)
633 define float @minnum_same_args(float %x) {
634 ; CHECK-LABEL: @minnum_same_args(
635 ; CHECK-NEXT: ret float [[X:%.*]]
637 %y = call float @llvm.minnum.f32(float %x, float %x)
641 define float @maxnum_same_args(float %x) {
642 ; CHECK-LABEL: @maxnum_same_args(
643 ; CHECK-NEXT: ret float [[X:%.*]]
645 %y = call float @llvm.maxnum.f32(float %x, float %x)
649 define float @minnum_x_minnum_x_y(float %x, float %y) {
650 ; CHECK-LABEL: @minnum_x_minnum_x_y(
651 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
652 ; CHECK-NEXT: ret float [[A]]
654 %a = call float @llvm.minnum.f32(float %x, float %y)
655 %b = call float @llvm.minnum.f32(float %x, float %a)
659 define float @minnum_y_minnum_x_y(float %x, float %y) {
660 ; CHECK-LABEL: @minnum_y_minnum_x_y(
661 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
662 ; CHECK-NEXT: ret float [[A]]
664 %a = call float @llvm.minnum.f32(float %x, float %y)
665 %b = call float @llvm.minnum.f32(float %y, float %a)
669 define float @minnum_x_y_minnum_x(float %x, float %y) {
670 ; CHECK-LABEL: @minnum_x_y_minnum_x(
671 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
672 ; CHECK-NEXT: ret float [[A]]
674 %a = call float @llvm.minnum.f32(float %x, float %y)
675 %b = call float @llvm.minnum.f32(float %a, float %x)
679 define float @minnum_x_y_minnum_y(float %x, float %y) {
680 ; CHECK-LABEL: @minnum_x_y_minnum_y(
681 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
682 ; CHECK-NEXT: ret float [[A]]
684 %a = call float @llvm.minnum.f32(float %x, float %y)
685 %b = call float @llvm.minnum.f32(float %a, float %y)
691 define float @minnum_z_minnum_x_y(float %x, float %y, float %z) {
692 ; CHECK-LABEL: @minnum_z_minnum_x_y(
693 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
694 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.minnum.f32(float [[Z:%.*]], float [[A]])
695 ; CHECK-NEXT: ret float [[B]]
697 %a = call float @llvm.minnum.f32(float %x, float %y)
698 %b = call float @llvm.minnum.f32(float %z, float %a)
704 define float @minnum_x_y_minnum_z(float %x, float %y, float %z) {
705 ; CHECK-LABEL: @minnum_x_y_minnum_z(
706 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
707 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.minnum.f32(float [[A]], float [[Z:%.*]])
708 ; CHECK-NEXT: ret float [[B]]
710 %a = call float @llvm.minnum.f32(float %x, float %y)
711 %b = call float @llvm.minnum.f32(float %a, float %z)
715 ; minnum(X, -INF) --> -INF
717 define float @minnum_neginf(float %x) {
718 ; CHECK-LABEL: @minnum_neginf(
719 ; CHECK-NEXT: ret float 0xFFF0000000000000
721 %val = call float @llvm.minnum.f32(float %x, float 0xFFF0000000000000)
725 define <2 x double> @minnum_neginf_commute_vec(<2 x double> %x) {
726 ; CHECK-LABEL: @minnum_neginf_commute_vec(
727 ; CHECK-NEXT: ret <2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>
729 %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>, <2 x double> %x)
735 define float @minnum_inf(float %x) {
736 ; CHECK-LABEL: @minnum_inf(
737 ; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.minnum.f32(float 0x7FF0000000000000, float [[X:%.*]])
738 ; CHECK-NEXT: ret float [[VAL]]
740 %val = call float @llvm.minnum.f32(float 0x7FF0000000000000, float %x)
743 define float @maxnum_x_maxnum_x_y(float %x, float %y) {
744 ; CHECK-LABEL: @maxnum_x_maxnum_x_y(
745 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
746 ; CHECK-NEXT: ret float [[A]]
748 %a = call float @llvm.maxnum.f32(float %x, float %y)
749 %b = call float @llvm.maxnum.f32(float %x, float %a)
753 define float @maxnum_y_maxnum_x_y(float %x, float %y) {
754 ; CHECK-LABEL: @maxnum_y_maxnum_x_y(
755 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
756 ; CHECK-NEXT: ret float [[A]]
758 %a = call float @llvm.maxnum.f32(float %x, float %y)
759 %b = call float @llvm.maxnum.f32(float %y, float %a)
763 define float @maxnum_x_y_maxnum_x(float %x, float %y) {
764 ; CHECK-LABEL: @maxnum_x_y_maxnum_x(
765 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
766 ; CHECK-NEXT: ret float [[A]]
768 %a = call float @llvm.maxnum.f32(float %x, float %y)
769 %b = call float @llvm.maxnum.f32(float %a, float %x)
773 define float @maxnum_x_y_maxnum_y(float %x, float %y) {
774 ; CHECK-LABEL: @maxnum_x_y_maxnum_y(
775 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
776 ; CHECK-NEXT: ret float [[A]]
778 %a = call float @llvm.maxnum.f32(float %x, float %y)
779 %b = call float @llvm.maxnum.f32(float %a, float %y)
785 define float @maxnum_z_maxnum_x_y(float %x, float %y, float %z) {
786 ; CHECK-LABEL: @maxnum_z_maxnum_x_y(
787 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
788 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.maxnum.f32(float [[Z:%.*]], float [[A]])
789 ; CHECK-NEXT: ret float [[B]]
791 %a = call float @llvm.maxnum.f32(float %x, float %y)
792 %b = call float @llvm.maxnum.f32(float %z, float %a)
798 define float @maxnum_x_y_maxnum_z(float %x, float %y, float %z) {
799 ; CHECK-LABEL: @maxnum_x_y_maxnum_z(
800 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
801 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.maxnum.f32(float [[A]], float [[Z:%.*]])
802 ; CHECK-NEXT: ret float [[B]]
804 %a = call float @llvm.maxnum.f32(float %x, float %y)
805 %b = call float @llvm.maxnum.f32(float %a, float %z)
809 ; maxnum(X, INF) --> INF
811 define <2 x double> @maxnum_inf(<2 x double> %x) {
812 ; CHECK-LABEL: @maxnum_inf(
813 ; CHECK-NEXT: ret <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>
815 %val = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %x, <2 x double><double 0x7FF0000000000000, double 0x7FF0000000000000>)
816 ret <2 x double> %val
819 define float @maxnum_inf_commute(float %x) {
820 ; CHECK-LABEL: @maxnum_inf_commute(
821 ; CHECK-NEXT: ret float 0x7FF0000000000000
823 %val = call float @llvm.maxnum.f32(float 0x7FF0000000000000, float %x)
829 define float @maxnum_neginf(float %x) {
830 ; CHECK-LABEL: @maxnum_neginf(
831 ; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.maxnum.f32(float 0xFFF0000000000000, float [[X:%.*]])
832 ; CHECK-NEXT: ret float [[VAL]]
834 %val = call float @llvm.maxnum.f32(float 0xFFF0000000000000, float %x)
838 ; From the LangRef for minimum/maximum:
839 ; "If either operand is a NaN, returns NaN."
841 define double @maximum_nan_op0(double %x) {
842 ; CHECK-LABEL: @maximum_nan_op0(
843 ; CHECK-NEXT: ret double 0x7FF8000000000000
845 %r = call double @llvm.maximum.f64(double 0x7ff8000000000000, double %x)
849 define double @maximum_nan_op1(double %x) {
850 ; CHECK-LABEL: @maximum_nan_op1(
851 ; CHECK-NEXT: ret double 0x7FF800000000DEAD
853 %r = call double @llvm.maximum.f64(double %x, double 0x7ff800000000dead)
857 define double @minimum_nan_op0(double %x) {
858 ; CHECK-LABEL: @minimum_nan_op0(
859 ; CHECK-NEXT: ret double 0x7FF8000DEAD00000
861 %r = call double @llvm.minimum.f64(double 0x7ff8000dead00000, double %x)
865 define double @minimum_nan_op1(double %x) {
866 ; CHECK-LABEL: @minimum_nan_op1(
867 ; CHECK-NEXT: ret double 0x7FF800DEAD00DEAD
869 %r = call double @llvm.minimum.f64(double %x, double 0x7ff800dead00dead)
873 define <2 x double> @maximum_nan_op0_vec_partial_undef(<2 x double> %x) {
874 ; CHECK-LABEL: @maximum_nan_op0_vec_partial_undef(
875 ; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
877 %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> %x)
881 define <2 x double> @maximum_nan_op1_vec_partial_undef(<2 x double> %x) {
882 ; CHECK-LABEL: @maximum_nan_op1_vec_partial_undef(
883 ; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
885 %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double> <double 0x7ff8000000000000, double undef>)
889 define <2 x double> @maximum_nan_op1_vec(<2 x double> %x) {
890 ; CHECK-LABEL: @maximum_nan_op1_vec(
891 ; CHECK-NEXT: ret <2 x double> <double 0x7FF800000000DEAD, double 0x7FF8FFFFFFFFFFFF>
893 %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double> <double 0x7ff800000000dead, double 0x7ff8ffffffffffff>)
897 define <2 x double> @minimum_nan_op0_vec_partial_undef(<2 x double> %x) {
898 ; CHECK-LABEL: @minimum_nan_op0_vec_partial_undef(
899 ; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
901 %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double undef, double 0x7ff8000dead00000>, <2 x double> %x)
905 define <2 x double> @minimum_nan_op1_vec_partial_undef(<2 x double> %x) {
906 ; CHECK-LABEL: @minimum_nan_op1_vec_partial_undef(
907 ; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
909 %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> %x, <2 x double> <double undef, double 0x7ff8000dead00000>)
913 define <2 x double> @minimum_nan_op1_vec(<2 x double> %x) {
914 ; CHECK-LABEL: @minimum_nan_op1_vec(
915 ; CHECK-NEXT: ret <2 x double> <double 0x7FF800DEAD00DEAD, double 0x7FF800DEAD00DEAD>
917 %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> %x, <2 x double> <double 0x7ff800dead00dead, double 0x7ff800dead00dead>)
921 define float @maximum_undef_op1(float %x) {
922 ; CHECK-LABEL: @maximum_undef_op1(
923 ; CHECK-NEXT: ret float [[X:%.*]]
925 %val = call float @llvm.maximum.f32(float %x, float undef)
929 define float @maximum_poison_op1(float %x) {
930 ; CHECK-LABEL: @maximum_poison_op1(
931 ; CHECK-NEXT: ret float [[X:%.*]]
933 %val = call float @llvm.maximum.f32(float %x, float poison)
937 define float @maximum_undef_op0(float %x) {
938 ; CHECK-LABEL: @maximum_undef_op0(
939 ; CHECK-NEXT: ret float [[X:%.*]]
941 %val = call float @llvm.maximum.f32(float undef, float %x)
945 define float @maximum_poison_op0(float %x) {
946 ; CHECK-LABEL: @maximum_poison_op0(
947 ; CHECK-NEXT: ret float [[X:%.*]]
949 %val = call float @llvm.maximum.f32(float poison, float %x)
953 define float @minimum_undef_op1(float %x) {
954 ; CHECK-LABEL: @minimum_undef_op1(
955 ; CHECK-NEXT: ret float [[X:%.*]]
957 %val = call float @llvm.minimum.f32(float %x, float undef)
961 define float @minimum_poison_op1(float %x) {
962 ; CHECK-LABEL: @minimum_poison_op1(
963 ; CHECK-NEXT: ret float [[X:%.*]]
965 %val = call float @llvm.minimum.f32(float %x, float poison)
969 define float @minimum_undef_op0(float %x) {
970 ; CHECK-LABEL: @minimum_undef_op0(
971 ; CHECK-NEXT: ret float [[X:%.*]]
973 %val = call float @llvm.minimum.f32(float undef, float %x)
977 define float @minimum_poison_op0(float %x) {
978 ; CHECK-LABEL: @minimum_poison_op0(
979 ; CHECK-NEXT: ret float [[X:%.*]]
981 %val = call float @llvm.minimum.f32(float poison, float %x)
985 define float @minimum_undef_undef(float %x) {
986 ; CHECK-LABEL: @minimum_undef_undef(
987 ; CHECK-NEXT: ret float undef
989 %val = call float @llvm.minimum.f32(float undef, float undef)
993 define float @maximum_undef_undef(float %x) {
994 ; CHECK-LABEL: @maximum_undef_undef(
995 ; CHECK-NEXT: ret float undef
997 %val = call float @llvm.maximum.f32(float undef, float undef)
1001 define float @minimum_same_args(float %x) {
1002 ; CHECK-LABEL: @minimum_same_args(
1003 ; CHECK-NEXT: ret float [[X:%.*]]
1005 %y = call float @llvm.minimum.f32(float %x, float %x)
1009 define float @maximum_same_args(float %x) {
1010 ; CHECK-LABEL: @maximum_same_args(
1011 ; CHECK-NEXT: ret float [[X:%.*]]
1013 %y = call float @llvm.maximum.f32(float %x, float %x)
1017 define float @minimum_x_minimum_x_y(float %x, float %y) {
1018 ; CHECK-LABEL: @minimum_x_minimum_x_y(
1019 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
1020 ; CHECK-NEXT: ret float [[A]]
1022 %a = call float @llvm.minimum.f32(float %x, float %y)
1023 %b = call float @llvm.minimum.f32(float %x, float %a)
1027 define float @minimum_y_minimum_x_y(float %x, float %y) {
1028 ; CHECK-LABEL: @minimum_y_minimum_x_y(
1029 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
1030 ; CHECK-NEXT: ret float [[A]]
1032 %a = call float @llvm.minimum.f32(float %x, float %y)
1033 %b = call float @llvm.minimum.f32(float %y, float %a)
1037 define float @minimum_x_y_minimum_x(float %x, float %y) {
1038 ; CHECK-LABEL: @minimum_x_y_minimum_x(
1039 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
1040 ; CHECK-NEXT: ret float [[A]]
1042 %a = call float @llvm.minimum.f32(float %x, float %y)
1043 %b = call float @llvm.minimum.f32(float %a, float %x)
1047 define float @minimum_x_y_minimum_y(float %x, float %y) {
1048 ; CHECK-LABEL: @minimum_x_y_minimum_y(
1049 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
1050 ; CHECK-NEXT: ret float [[A]]
1052 %a = call float @llvm.minimum.f32(float %x, float %y)
1053 %b = call float @llvm.minimum.f32(float %a, float %y)
1059 define float @minimum_z_minimum_x_y(float %x, float %y, float %z) {
1060 ; CHECK-LABEL: @minimum_z_minimum_x_y(
1061 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
1062 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.minimum.f32(float [[Z:%.*]], float [[A]])
1063 ; CHECK-NEXT: ret float [[B]]
1065 %a = call float @llvm.minimum.f32(float %x, float %y)
1066 %b = call float @llvm.minimum.f32(float %z, float %a)
1072 define float @minimum_x_y_minimum_z(float %x, float %y, float %z) {
1073 ; CHECK-LABEL: @minimum_x_y_minimum_z(
1074 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
1075 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.minimum.f32(float [[A]], float [[Z:%.*]])
1076 ; CHECK-NEXT: ret float [[B]]
1078 %a = call float @llvm.minimum.f32(float %x, float %y)
1079 %b = call float @llvm.minimum.f32(float %a, float %z)
1083 define float @maximum_x_maximum_x_y(float %x, float %y) {
1084 ; CHECK-LABEL: @maximum_x_maximum_x_y(
1085 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float [[Y:%.*]])
1086 ; CHECK-NEXT: ret float [[A]]
1088 %a = call float @llvm.maximum.f32(float %x, float %y)
1089 %b = call float @llvm.maximum.f32(float %x, float %a)
1093 define float @maximum_y_maximum_x_y(float %x, float %y) {
1094 ; CHECK-LABEL: @maximum_y_maximum_x_y(
1095 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float [[Y:%.*]])
1096 ; CHECK-NEXT: ret float [[A]]
1098 %a = call float @llvm.maximum.f32(float %x, float %y)
1099 %b = call float @llvm.maximum.f32(float %y, float %a)
1103 define float @maximum_x_y_maximum_x(float %x, float %y) {
1104 ; CHECK-LABEL: @maximum_x_y_maximum_x(
1105 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float [[Y:%.*]])
1106 ; CHECK-NEXT: ret float [[A]]
1108 %a = call float @llvm.maximum.f32(float %x, float %y)
1109 %b = call float @llvm.maximum.f32(float %a, float %x)
1113 define float @maximum_x_y_maximum_y(float %x, float %y) {
1114 ; CHECK-LABEL: @maximum_x_y_maximum_y(
1115 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float [[Y:%.*]])
1116 ; CHECK-NEXT: ret float [[A]]
1118 %a = call float @llvm.maximum.f32(float %x, float %y)
1119 %b = call float @llvm.maximum.f32(float %a, float %y)
1125 define float @maximum_z_maximum_x_y(float %x, float %y, float %z) {
1126 ; CHECK-LABEL: @maximum_z_maximum_x_y(
1127 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float [[Y:%.*]])
1128 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.maximum.f32(float [[Z:%.*]], float [[A]])
1129 ; CHECK-NEXT: ret float [[B]]
1131 %a = call float @llvm.maximum.f32(float %x, float %y)
1132 %b = call float @llvm.maximum.f32(float %z, float %a)
1138 define float @maximum_x_y_maximum_z(float %x, float %y, float %z) {
1139 ; CHECK-LABEL: @maximum_x_y_maximum_z(
1140 ; CHECK-NEXT: [[A:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float [[Y:%.*]])
1141 ; CHECK-NEXT: [[B:%.*]] = call float @llvm.maximum.f32(float [[A]], float [[Z:%.*]])
1142 ; CHECK-NEXT: ret float [[B]]
1144 %a = call float @llvm.maximum.f32(float %x, float %y)
1145 %b = call float @llvm.maximum.f32(float %a, float %z)
1149 ; negative test - minimum(X, -INF) != -INF because X could be NaN
1151 define float @minimum_neginf(float %x) {
1152 ; CHECK-LABEL: @minimum_neginf(
1153 ; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float 0xFFF0000000000000)
1154 ; CHECK-NEXT: ret float [[VAL]]
1156 %val = call float @llvm.minimum.f32(float %x, float 0xFFF0000000000000)
1160 ; negative test - minimum(-INF, X) != -INF because X could be NaN
1162 define <2 x double> @minimum_neginf_commute_vec(<2 x double> %x) {
1163 ; CHECK-LABEL: @minimum_neginf_commute_vec(
1164 ; CHECK-NEXT: [[R:%.*]] = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>, <2 x double> [[X:%.*]])
1165 ; CHECK-NEXT: ret <2 x double> [[R]]
1167 %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>, <2 x double> %x)
1171 ; TODO: minimum(INF, X) --> X
1173 define float @minimum_inf(float %x) {
1174 ; CHECK-LABEL: @minimum_inf(
1175 ; CHECK-NEXT: ret float [[X:%.*]]
1177 %val = call float @llvm.minimum.f32(float 0x7FF0000000000000, float %x)
1181 ; negative test - maximum(X, INF) != INF because X could be NaN
1183 define <2 x double> @maximum_inf(<2 x double> %x) {
1184 ; CHECK-LABEL: @maximum_inf(
1185 ; CHECK-NEXT: [[VAL:%.*]] = call <2 x double> @llvm.maximum.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>)
1186 ; CHECK-NEXT: ret <2 x double> [[VAL]]
1188 %val = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double><double 0x7FF0000000000000, double 0x7FF0000000000000>)
1189 ret <2 x double> %val
1192 ; negative test - maximum(INF, X) != INF because X could be NaN
1194 define float @maximum_inf_commute(float %x) {
1195 ; CHECK-LABEL: @maximum_inf_commute(
1196 ; CHECK-NEXT: [[VAL:%.*]] = call float @llvm.maximum.f32(float 0x7FF0000000000000, float [[X:%.*]])
1197 ; CHECK-NEXT: ret float [[VAL]]
1199 %val = call float @llvm.maximum.f32(float 0x7FF0000000000000, float %x)