1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512vl | FileCheck %s --check-prefixes=CHECK,AVX512VL
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512vl,+avx512dq | FileCheck %s --check-prefixes=CHECK,AVX512DQVL
5 define <4 x i64> @PR32546(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d) {
6 ; AVX512VL-LABEL: PR32546:
7 ; AVX512VL: ## %bb.0: ## %entry
8 ; AVX512VL-NEXT: vcmpltps %ymm1, %ymm0, %k0
9 ; AVX512VL-NEXT: vcmpltps %ymm3, %ymm2, %k1
10 ; AVX512VL-NEXT: kandw %k0, %k1, %k0
11 ; AVX512VL-NEXT: kmovw %k0, %eax
12 ; AVX512VL-NEXT: movzbl %al, %eax
13 ; AVX512VL-NEXT: vpbroadcastd %eax, %ymm0
16 ; AVX512DQVL-LABEL: PR32546:
17 ; AVX512DQVL: ## %bb.0: ## %entry
18 ; AVX512DQVL-NEXT: vcmpltps %ymm1, %ymm0, %k0
19 ; AVX512DQVL-NEXT: vcmpltps %ymm3, %ymm2, %k1
20 ; AVX512DQVL-NEXT: kandb %k0, %k1, %k0
21 ; AVX512DQVL-NEXT: kmovb %k0, %eax
22 ; AVX512DQVL-NEXT: vpbroadcastd %eax, %ymm0
23 ; AVX512DQVL-NEXT: retq
25 %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %a, <8 x float> %b, i32 1, i8 -1)
26 %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %c, <8 x float> %d, i32 1, i8 -1)
27 %and17 = and i8 %1, %0
28 %and = zext i8 %and17 to i32
29 %2 = insertelement <8 x i32> undef, i32 %and, i32 0
30 %vecinit7.i = shufflevector <8 x i32> %2, <8 x i32> undef, <8 x i32> zeroinitializer
31 %3 = bitcast <8 x i32> %vecinit7.i to <4 x i64>
35 define void @PR32547(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d, float* %p) {
36 ; CHECK-LABEL: PR32547:
37 ; CHECK: ## %bb.0: ## %entry
38 ; CHECK-NEXT: vcmpltps %ymm1, %ymm0, %k0
39 ; CHECK-NEXT: vcmpltps %ymm3, %ymm2, %k1
40 ; CHECK-NEXT: kunpckbw %k1, %k0, %k1
41 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
42 ; CHECK-NEXT: vmovaps %zmm0, (%rdi) {%k1}
43 ; CHECK-NEXT: vzeroupper
46 %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %a, <8 x float> %b, i32 1, i8 -1)
47 %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %c, <8 x float> %d, i32 1, i8 -1)
48 %conv.i = zext i8 %0 to i16
49 %conv.i18 = zext i8 %1 to i16
50 %shl = shl nuw i16 %conv.i, 8
51 %or = or i16 %shl, %conv.i18
52 %2 = bitcast float* %p to <16 x float>*
53 %3 = bitcast i16 %or to <16 x i1>
54 tail call void @llvm.masked.store.v16f32.p0v16f32(<16 x float> zeroinitializer, <16 x float>* %2, i32 64, <16 x i1> %3)
58 define void @PR32547_swap(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d, float* %p) {
59 ; CHECK-LABEL: PR32547_swap:
60 ; CHECK: ## %bb.0: ## %entry
61 ; CHECK-NEXT: vcmpltps %ymm1, %ymm0, %k0
62 ; CHECK-NEXT: vcmpltps %ymm3, %ymm2, %k1
63 ; CHECK-NEXT: kunpckbw %k1, %k0, %k1
64 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
65 ; CHECK-NEXT: vmovaps %zmm0, (%rdi) {%k1}
66 ; CHECK-NEXT: vzeroupper
69 %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %a, <8 x float> %b, i32 1, i8 -1)
70 %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %c, <8 x float> %d, i32 1, i8 -1)
71 %conv.i = zext i8 %0 to i16
72 %conv.i18 = zext i8 %1 to i16
73 %shl = shl nuw i16 %conv.i, 8
74 %or = or i16 %conv.i18, %shl
75 %2 = bitcast float* %p to <16 x float>*
76 %3 = bitcast i16 %or to <16 x i1>
77 tail call void @llvm.masked.store.v16f32.p0v16f32(<16 x float> zeroinitializer, <16 x float>* %2, i32 64, <16 x i1> %3)
81 define void @mask_cmp_128(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x float> %d, float* %p) {
82 ; AVX512VL-LABEL: mask_cmp_128:
83 ; AVX512VL: ## %bb.0: ## %entry
84 ; AVX512VL-NEXT: vcmpltps %xmm1, %xmm0, %k0
85 ; AVX512VL-NEXT: kmovw %k0, %eax
86 ; AVX512VL-NEXT: vcmpltps %xmm3, %xmm2, %k0
87 ; AVX512VL-NEXT: shlb $4, %al
88 ; AVX512VL-NEXT: kmovw %eax, %k1
89 ; AVX512VL-NEXT: korw %k1, %k0, %k1
90 ; AVX512VL-NEXT: vxorps %xmm0, %xmm0, %xmm0
91 ; AVX512VL-NEXT: vmovaps %ymm0, (%rdi) {%k1}
92 ; AVX512VL-NEXT: vzeroupper
95 ; AVX512DQVL-LABEL: mask_cmp_128:
96 ; AVX512DQVL: ## %bb.0: ## %entry
97 ; AVX512DQVL-NEXT: vcmpltps %xmm1, %xmm0, %k0
98 ; AVX512DQVL-NEXT: vcmpltps %xmm3, %xmm2, %k1
99 ; AVX512DQVL-NEXT: kshiftlb $4, %k0, %k0
100 ; AVX512DQVL-NEXT: korb %k0, %k1, %k1
101 ; AVX512DQVL-NEXT: vxorps %xmm0, %xmm0, %xmm0
102 ; AVX512DQVL-NEXT: vmovaps %ymm0, (%rdi) {%k1}
103 ; AVX512DQVL-NEXT: vzeroupper
104 ; AVX512DQVL-NEXT: retq
106 %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.128(<4 x float> %a, <4 x float> %b, i32 1, i8 -1)
107 %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.128(<4 x float> %c, <4 x float> %d, i32 1, i8 -1)
108 %shl = shl nuw i8 %0, 4
110 %2 = bitcast float* %p to <8 x float>*
111 %3 = bitcast i8 %or to <8 x i1>
112 tail call void @llvm.masked.store.v8f32.p0v8f32(<8 x float> zeroinitializer, <8 x float>* %2, i32 64, <8 x i1> %3)
116 define <16 x float> @mask_cmp_512(<16 x float> %a, <16 x float> %b, <16 x float> %c, <16 x float> %d, float* %p) {
117 ; CHECK-LABEL: mask_cmp_512:
118 ; CHECK: ## %bb.0: ## %entry
119 ; CHECK-NEXT: vcmpltps {sae}, %zmm1, %zmm0, %k0
120 ; CHECK-NEXT: vcmpltps %zmm3, %zmm2, %k1
121 ; CHECK-NEXT: kxnorw %k1, %k0, %k1
122 ; CHECK-NEXT: vmovaps (%rdi), %zmm0 {%k1} {z}
125 %0 = tail call i16 @llvm.x86.avx512.mask.cmp.ps.512(<16 x float> %a, <16 x float> %b, i32 1, i16 -1, i32 8)
126 %1 = tail call i16 @llvm.x86.avx512.mask.cmp.ps.512(<16 x float> %c, <16 x float> %d, i32 1, i16 -1, i32 4)
127 %2 = bitcast float* %p to <16 x float>*
128 %3 = load <16 x float>, <16 x float>* %2
130 %5 = bitcast i16 %4 to <16 x i1>
131 %6 = select <16 x i1> %5, <16 x float> zeroinitializer, <16 x float> %3
134 declare i8 @llvm.x86.avx512.mask.cmp.ps.128(<4 x float>, <4 x float>, i32, i8)
135 declare i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float>, <8 x float>, i32, i8)
136 declare i16 @llvm.x86.avx512.mask.cmp.ps.512(<16 x float>, <16 x float>, i32, i16, i32)
137 declare void @llvm.masked.store.v8f32.p0v8f32(<8 x float>, <8 x float>*, i32, <8 x i1>)
138 declare void @llvm.masked.store.v16f32.p0v16f32(<16 x float>, <16 x float>*, i32, <16 x i1>)