1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64 -enable-no-nans-fp-math -enable-no-signed-zeros-fp-math -mattr=+avx512f | FileCheck %s --check-prefix=CHECK_UNSAFE
3 ; RUN: llc < %s -mtriple=x86_64 -enable-no-nans-fp-math -mattr=+avx512f | FileCheck %s
4 ; RUN: llc < %s -mtriple=x86_64 -enable-no-signed-zeros-fp-math -mattr=+avx512f | FileCheck %s
5 ; RUN: llc < %s -mtriple=x86_64 -enable-unsafe-fp-math -mattr=+avx512f | FileCheck %s
6 ; RUN: llc < %s -mtriple=x86_64 -mattr=+avx512f | FileCheck %s
8 define <16 x float> @test_max_v16f32(ptr %a_ptr, <16 x float> %b) {
9 ; CHECK_UNSAFE-LABEL: test_max_v16f32:
10 ; CHECK_UNSAFE: # %bb.0:
11 ; CHECK_UNSAFE-NEXT: vmaxps (%rdi), %zmm0, %zmm0
12 ; CHECK_UNSAFE-NEXT: retq
14 ; CHECK-LABEL: test_max_v16f32:
16 ; CHECK-NEXT: vmovaps (%rdi), %zmm1
17 ; CHECK-NEXT: vmaxps %zmm0, %zmm1, %zmm0
19 %a = load <16 x float>, ptr %a_ptr
20 %tmp = fcmp fast ogt <16 x float> %a, %b
21 %tmp4 = select <16 x i1> %tmp, <16 x float> %a, <16 x float> %b
22 ret <16 x float> %tmp4;
25 define <16 x float> @test_min_v16f32(ptr %a_ptr, <16 x float> %b) {
26 ; CHECK_UNSAFE-LABEL: test_min_v16f32:
27 ; CHECK_UNSAFE: # %bb.0:
28 ; CHECK_UNSAFE-NEXT: vminps (%rdi), %zmm0, %zmm0
29 ; CHECK_UNSAFE-NEXT: retq
31 ; CHECK-LABEL: test_min_v16f32:
33 ; CHECK-NEXT: vmovaps (%rdi), %zmm1
34 ; CHECK-NEXT: vminps %zmm0, %zmm1, %zmm0
36 %a = load <16 x float>, ptr %a_ptr
37 %tmp = fcmp fast olt <16 x float> %a, %b
38 %tmp4 = select <16 x i1> %tmp, <16 x float> %a, <16 x float> %b
39 ret <16 x float> %tmp4;
42 define <8 x double> @test_max_v8f64(ptr %a_ptr, <8 x double> %b) {
43 ; CHECK_UNSAFE-LABEL: test_max_v8f64:
44 ; CHECK_UNSAFE: # %bb.0:
45 ; CHECK_UNSAFE-NEXT: vmaxpd (%rdi), %zmm0, %zmm0
46 ; CHECK_UNSAFE-NEXT: retq
48 ; CHECK-LABEL: test_max_v8f64:
50 ; CHECK-NEXT: vmovapd (%rdi), %zmm1
51 ; CHECK-NEXT: vmaxpd %zmm0, %zmm1, %zmm0
53 %a = load <8 x double>, ptr %a_ptr
54 %tmp = fcmp fast ogt <8 x double> %a, %b
55 %tmp4 = select <8 x i1> %tmp, <8 x double> %a, <8 x double> %b
56 ret <8 x double> %tmp4;
59 define <8 x double> @test_min_v8f64(ptr %a_ptr, <8 x double> %b) {
60 ; CHECK_UNSAFE-LABEL: test_min_v8f64:
61 ; CHECK_UNSAFE: # %bb.0:
62 ; CHECK_UNSAFE-NEXT: vminpd (%rdi), %zmm0, %zmm0
63 ; CHECK_UNSAFE-NEXT: retq
65 ; CHECK-LABEL: test_min_v8f64:
67 ; CHECK-NEXT: vmovapd (%rdi), %zmm1
68 ; CHECK-NEXT: vminpd %zmm0, %zmm1, %zmm0
70 %a = load <8 x double>, ptr %a_ptr
71 %tmp = fcmp fast olt <8 x double> %a, %b
72 %tmp4 = select <8 x i1> %tmp, <8 x double> %a, <8 x double> %b
73 ret <8 x double> %tmp4;
76 define float @test_min_f32(float %a, ptr %ptr) {
77 ; CHECK_UNSAFE-LABEL: test_min_f32:
78 ; CHECK_UNSAFE: # %bb.0: # %entry
79 ; CHECK_UNSAFE-NEXT: vminss (%rdi), %xmm0, %xmm0
80 ; CHECK_UNSAFE-NEXT: retq
82 ; CHECK-LABEL: test_min_f32:
83 ; CHECK: # %bb.0: # %entry
84 ; CHECK-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
85 ; CHECK-NEXT: vminss %xmm0, %xmm1, %xmm0
88 %0 = load float, ptr %ptr
89 %1 = fcmp fast olt float %0, %a
90 %2 = select i1 %1, float %0, float %a
94 define double @test_max_f64(double %a, ptr %ptr) {
95 ; CHECK_UNSAFE-LABEL: test_max_f64:
96 ; CHECK_UNSAFE: # %bb.0: # %entry
97 ; CHECK_UNSAFE-NEXT: vmaxsd (%rdi), %xmm0, %xmm0
98 ; CHECK_UNSAFE-NEXT: retq
100 ; CHECK-LABEL: test_max_f64:
101 ; CHECK: # %bb.0: # %entry
102 ; CHECK-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
103 ; CHECK-NEXT: vmaxsd %xmm0, %xmm1, %xmm0
106 %0 = load double, ptr %ptr
107 %1 = fcmp fast ogt double %0, %a
108 %2 = select i1 %1, double %0, double %a