1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -show-mc-encoding -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=KNL
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -show-mc-encoding -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512BW
4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -show-mc-encoding -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq | FileCheck %s --check-prefix=CHECK --check-prefix=SKX
6 define <16 x float> @test1(<16 x float> %x, <16 x float> %y) nounwind {
9 ; CHECK-NEXT: vcmpleps %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xc9,0x02]
10 ; CHECK-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
11 ; CHECK-NEXT: retq ## encoding: [0xc3]
12 %mask = fcmp ole <16 x float> %x, %y
13 %max = select <16 x i1> %mask, <16 x float> %x, <16 x float> %y
17 define <8 x double> @test2(<8 x double> %x, <8 x double> %y) nounwind {
20 ; CHECK-NEXT: vcmplepd %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0xc9,0x02]
21 ; CHECK-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
22 ; CHECK-NEXT: retq ## encoding: [0xc3]
23 %mask = fcmp ole <8 x double> %x, %y
24 %max = select <8 x i1> %mask, <8 x double> %x, <8 x double> %y
28 define <16 x i32> @test3(<16 x i32> %x, <16 x i32> %x1, <16 x i32>* %yp) nounwind {
31 ; CHECK-NEXT: vpcmpeqd (%rdi), %zmm0, %k1 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0x0f]
32 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
33 ; CHECK-NEXT: retq ## encoding: [0xc3]
34 %y = load <16 x i32>, <16 x i32>* %yp, align 4
35 %mask = icmp eq <16 x i32> %x, %y
36 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %x1
40 define <16 x i32> @test4_unsigned(<16 x i32> %x, <16 x i32> %y, <16 x i32> %x1) nounwind {
41 ; CHECK-LABEL: test4_unsigned:
43 ; CHECK-NEXT: vpcmpnltud %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf3,0x7d,0x48,0x1e,0xc9,0x05]
44 ; CHECK-NEXT: vpblendmd %zmm2, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc2]
45 ; CHECK-NEXT: retq ## encoding: [0xc3]
46 %mask = icmp uge <16 x i32> %x, %y
47 %max = select <16 x i1> %mask, <16 x i32> %x1, <16 x i32> %y
51 define <8 x i64> @test5(<8 x i64> %x, <8 x i64> %y) nounwind {
54 ; CHECK-NEXT: vpcmpeqq %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf2,0xfd,0x48,0x29,0xc9]
55 ; CHECK-NEXT: vpblendmq %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x64,0xc0]
56 ; CHECK-NEXT: retq ## encoding: [0xc3]
57 %mask = icmp eq <8 x i64> %x, %y
58 %max = select <8 x i1> %mask, <8 x i64> %x, <8 x i64> %y
62 define <8 x i64> @test6_unsigned(<8 x i64> %x, <8 x i64> %y, <8 x i64> %x1) nounwind {
63 ; CHECK-LABEL: test6_unsigned:
65 ; CHECK-NEXT: vpcmpnleuq %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf3,0xfd,0x48,0x1e,0xc9,0x06]
66 ; CHECK-NEXT: vpblendmq %zmm2, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x64,0xc2]
67 ; CHECK-NEXT: retq ## encoding: [0xc3]
68 %mask = icmp ugt <8 x i64> %x, %y
69 %max = select <8 x i1> %mask, <8 x i64> %x1, <8 x i64> %y
73 define <4 x float> @test7(<4 x float> %a, <4 x float> %b) {
74 ; AVX512-LABEL: test7:
76 ; AVX512-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
77 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
78 ; AVX512-NEXT: vxorps %xmm2, %xmm2, %xmm2 ## encoding: [0xc5,0xe8,0x57,0xd2]
79 ; AVX512-NEXT: vcmpltps %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xca,0x01]
80 ; AVX512-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
81 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
82 ; AVX512-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
83 ; AVX512-NEXT: retq ## encoding: [0xc3]
87 ; SKX-NEXT: vxorps %xmm2, %xmm2, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xe8,0x57,0xd2]
88 ; SKX-NEXT: vcmpltps %xmm2, %xmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x08,0xc2,0xca,0x01]
89 ; SKX-NEXT: vblendmps %xmm0, %xmm1, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x09,0x65,0xc0]
90 ; SKX-NEXT: retq ## encoding: [0xc3]
92 %mask = fcmp olt <4 x float> %a, zeroinitializer
93 %c = select <4 x i1>%mask, <4 x float>%a, <4 x float>%b
97 define <2 x double> @test8(<2 x double> %a, <2 x double> %b) {
98 ; AVX512-LABEL: test8:
100 ; AVX512-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
101 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
102 ; AVX512-NEXT: vxorpd %xmm2, %xmm2, %xmm2 ## encoding: [0xc5,0xe9,0x57,0xd2]
103 ; AVX512-NEXT: vcmpltpd %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0xca,0x01]
104 ; AVX512-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
105 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
106 ; AVX512-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
107 ; AVX512-NEXT: retq ## encoding: [0xc3]
111 ; SKX-NEXT: vxorpd %xmm2, %xmm2, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xe9,0x57,0xd2]
112 ; SKX-NEXT: vcmpltpd %xmm2, %xmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x08,0xc2,0xca,0x01]
113 ; SKX-NEXT: vblendmpd %xmm0, %xmm1, %xmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x09,0x65,0xc0]
114 ; SKX-NEXT: retq ## encoding: [0xc3]
115 %mask = fcmp olt <2 x double> %a, zeroinitializer
116 %c = select <2 x i1>%mask, <2 x double>%a, <2 x double>%b
120 define <8 x i32> @test9(<8 x i32> %x, <8 x i32> %y) nounwind {
121 ; AVX512-LABEL: test9:
123 ; AVX512-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
124 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
125 ; AVX512-NEXT: vpcmpeqd %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0xc9]
126 ; AVX512-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
127 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
128 ; AVX512-NEXT: retq ## encoding: [0xc3]
132 ; SKX-NEXT: vpcmpeqd %ymm1, %ymm0, %k1 ## encoding: [0x62,0xf1,0x7d,0x28,0x76,0xc9]
133 ; SKX-NEXT: vpblendmd %ymm0, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x29,0x64,0xc0]
134 ; SKX-NEXT: retq ## encoding: [0xc3]
135 %mask = icmp eq <8 x i32> %x, %y
136 %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %y
140 define <8 x float> @test10(<8 x float> %x, <8 x float> %y) nounwind {
141 ; AVX512-LABEL: test10:
143 ; AVX512-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
144 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
145 ; AVX512-NEXT: vcmpeqps %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xc9,0x00]
146 ; AVX512-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
147 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
148 ; AVX512-NEXT: retq ## encoding: [0xc3]
152 ; SKX-NEXT: vcmpeqps %ymm1, %ymm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x28,0xc2,0xc9,0x00]
153 ; SKX-NEXT: vblendmps %ymm0, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x29,0x65,0xc0]
154 ; SKX-NEXT: retq ## encoding: [0xc3]
156 %mask = fcmp oeq <8 x float> %x, %y
157 %max = select <8 x i1> %mask, <8 x float> %x, <8 x float> %y
161 define <8 x i32> @test11_unsigned(<8 x i32> %x, <8 x i32> %y) nounwind {
162 ; AVX512-LABEL: test11_unsigned:
164 ; AVX512-NEXT: vpmaxud %ymm1, %ymm0, %ymm0 ## encoding: [0xc4,0xe2,0x7d,0x3f,0xc1]
165 ; AVX512-NEXT: retq ## encoding: [0xc3]
167 ; SKX-LABEL: test11_unsigned:
169 ; SKX-NEXT: vpmaxud %ymm1, %ymm0, %ymm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0x3f,0xc1]
170 ; SKX-NEXT: retq ## encoding: [0xc3]
171 %mask = icmp ugt <8 x i32> %x, %y
172 %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %y
176 define i16 @test12(<16 x i64> %a, <16 x i64> %b) nounwind {
179 ; KNL-NEXT: vpcmpeqq %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf2,0xfd,0x48,0x29,0xc2]
180 ; KNL-NEXT: vpcmpeqq %zmm3, %zmm1, %k1 ## encoding: [0x62,0xf2,0xf5,0x48,0x29,0xcb]
181 ; KNL-NEXT: kunpckbw %k0, %k1, %k0 ## encoding: [0xc5,0xf5,0x4b,0xc0]
182 ; KNL-NEXT: kmovw %k0, %eax ## encoding: [0xc5,0xf8,0x93,0xc0]
183 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
184 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
185 ; KNL-NEXT: retq ## encoding: [0xc3]
187 ; AVX512BW-LABEL: test12:
188 ; AVX512BW: ## %bb.0:
189 ; AVX512BW-NEXT: vpcmpeqq %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf2,0xfd,0x48,0x29,0xc2]
190 ; AVX512BW-NEXT: vpcmpeqq %zmm3, %zmm1, %k1 ## encoding: [0x62,0xf2,0xf5,0x48,0x29,0xcb]
191 ; AVX512BW-NEXT: kunpckbw %k0, %k1, %k0 ## encoding: [0xc5,0xf5,0x4b,0xc0]
192 ; AVX512BW-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
193 ; AVX512BW-NEXT: ## kill: def $ax killed $ax killed $eax
194 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
195 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
199 ; SKX-NEXT: vpcmpeqq %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf2,0xfd,0x48,0x29,0xc2]
200 ; SKX-NEXT: vpcmpeqq %zmm3, %zmm1, %k1 ## encoding: [0x62,0xf2,0xf5,0x48,0x29,0xcb]
201 ; SKX-NEXT: kunpckbw %k0, %k1, %k0 ## encoding: [0xc5,0xf5,0x4b,0xc0]
202 ; SKX-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
203 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
204 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
205 ; SKX-NEXT: retq ## encoding: [0xc3]
206 %res = icmp eq <16 x i64> %a, %b
207 %res1 = bitcast <16 x i1> %res to i16
211 define i32 @test12_v32i32(<32 x i32> %a, <32 x i32> %b) nounwind {
212 ; KNL-LABEL: test12_v32i32:
214 ; KNL-NEXT: vpcmpeqd %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0xc2]
215 ; KNL-NEXT: kmovw %k0, %ecx ## encoding: [0xc5,0xf8,0x93,0xc8]
216 ; KNL-NEXT: vpcmpeqd %zmm3, %zmm1, %k0 ## encoding: [0x62,0xf1,0x75,0x48,0x76,0xc3]
217 ; KNL-NEXT: kmovw %k0, %eax ## encoding: [0xc5,0xf8,0x93,0xc0]
218 ; KNL-NEXT: shll $16, %eax ## encoding: [0xc1,0xe0,0x10]
219 ; KNL-NEXT: orl %ecx, %eax ## encoding: [0x09,0xc8]
220 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
221 ; KNL-NEXT: retq ## encoding: [0xc3]
223 ; AVX512BW-LABEL: test12_v32i32:
224 ; AVX512BW: ## %bb.0:
225 ; AVX512BW-NEXT: vpcmpeqd %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0xc2]
226 ; AVX512BW-NEXT: vpcmpeqd %zmm3, %zmm1, %k1 ## encoding: [0x62,0xf1,0x75,0x48,0x76,0xcb]
227 ; AVX512BW-NEXT: kunpckwd %k0, %k1, %k0 ## encoding: [0xc5,0xf4,0x4b,0xc0]
228 ; AVX512BW-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
229 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
230 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
232 ; SKX-LABEL: test12_v32i32:
234 ; SKX-NEXT: vpcmpeqd %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0xc2]
235 ; SKX-NEXT: vpcmpeqd %zmm3, %zmm1, %k1 ## encoding: [0x62,0xf1,0x75,0x48,0x76,0xcb]
236 ; SKX-NEXT: kunpckwd %k0, %k1, %k0 ## encoding: [0xc5,0xf4,0x4b,0xc0]
237 ; SKX-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
238 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
239 ; SKX-NEXT: retq ## encoding: [0xc3]
240 %res = icmp eq <32 x i32> %a, %b
241 %res1 = bitcast <32 x i1> %res to i32
245 define i64 @test12_v64i16(<64 x i16> %a, <64 x i16> %b) nounwind {
246 ; KNL-LABEL: test12_v64i16:
248 ; KNL-NEXT: vpcmpeqw %ymm4, %ymm0, %ymm0 ## encoding: [0xc5,0xfd,0x75,0xc4]
249 ; KNL-NEXT: vpmovsxwd %ymm0, %zmm0 ## encoding: [0x62,0xf2,0x7d,0x48,0x23,0xc0]
250 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0 ## encoding: [0x62,0xf2,0x7d,0x48,0x27,0xc0]
251 ; KNL-NEXT: kmovw %k0, %eax ## encoding: [0xc5,0xf8,0x93,0xc0]
252 ; KNL-NEXT: vpcmpeqw %ymm5, %ymm1, %ymm0 ## encoding: [0xc5,0xf5,0x75,0xc5]
253 ; KNL-NEXT: vpmovsxwd %ymm0, %zmm0 ## encoding: [0x62,0xf2,0x7d,0x48,0x23,0xc0]
254 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0 ## encoding: [0x62,0xf2,0x7d,0x48,0x27,0xc0]
255 ; KNL-NEXT: kmovw %k0, %ecx ## encoding: [0xc5,0xf8,0x93,0xc8]
256 ; KNL-NEXT: shll $16, %ecx ## encoding: [0xc1,0xe1,0x10]
257 ; KNL-NEXT: orl %eax, %ecx ## encoding: [0x09,0xc1]
258 ; KNL-NEXT: vpcmpeqw %ymm6, %ymm2, %ymm0 ## encoding: [0xc5,0xed,0x75,0xc6]
259 ; KNL-NEXT: vpmovsxwd %ymm0, %zmm0 ## encoding: [0x62,0xf2,0x7d,0x48,0x23,0xc0]
260 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0 ## encoding: [0x62,0xf2,0x7d,0x48,0x27,0xc0]
261 ; KNL-NEXT: kmovw %k0, %edx ## encoding: [0xc5,0xf8,0x93,0xd0]
262 ; KNL-NEXT: vpcmpeqw %ymm7, %ymm3, %ymm0 ## encoding: [0xc5,0xe5,0x75,0xc7]
263 ; KNL-NEXT: vpmovsxwd %ymm0, %zmm0 ## encoding: [0x62,0xf2,0x7d,0x48,0x23,0xc0]
264 ; KNL-NEXT: vptestmd %zmm0, %zmm0, %k0 ## encoding: [0x62,0xf2,0x7d,0x48,0x27,0xc0]
265 ; KNL-NEXT: kmovw %k0, %eax ## encoding: [0xc5,0xf8,0x93,0xc0]
266 ; KNL-NEXT: shll $16, %eax ## encoding: [0xc1,0xe0,0x10]
267 ; KNL-NEXT: orl %edx, %eax ## encoding: [0x09,0xd0]
268 ; KNL-NEXT: shlq $32, %rax ## encoding: [0x48,0xc1,0xe0,0x20]
269 ; KNL-NEXT: orq %rcx, %rax ## encoding: [0x48,0x09,0xc8]
270 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
271 ; KNL-NEXT: retq ## encoding: [0xc3]
273 ; AVX512BW-LABEL: test12_v64i16:
274 ; AVX512BW: ## %bb.0:
275 ; AVX512BW-NEXT: vpcmpeqw %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x75,0xc2]
276 ; AVX512BW-NEXT: vpcmpeqw %zmm3, %zmm1, %k1 ## encoding: [0x62,0xf1,0x75,0x48,0x75,0xcb]
277 ; AVX512BW-NEXT: kunpckdq %k0, %k1, %k0 ## encoding: [0xc4,0xe1,0xf4,0x4b,0xc0]
278 ; AVX512BW-NEXT: kmovq %k0, %rax ## encoding: [0xc4,0xe1,0xfb,0x93,0xc0]
279 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
280 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
282 ; SKX-LABEL: test12_v64i16:
284 ; SKX-NEXT: vpcmpeqw %zmm2, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x75,0xc2]
285 ; SKX-NEXT: vpcmpeqw %zmm3, %zmm1, %k1 ## encoding: [0x62,0xf1,0x75,0x48,0x75,0xcb]
286 ; SKX-NEXT: kunpckdq %k0, %k1, %k0 ## encoding: [0xc4,0xe1,0xf4,0x4b,0xc0]
287 ; SKX-NEXT: kmovq %k0, %rax ## encoding: [0xc4,0xe1,0xfb,0x93,0xc0]
288 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
289 ; SKX-NEXT: retq ## encoding: [0xc3]
290 %res = icmp eq <64 x i16> %a, %b
291 %res1 = bitcast <64 x i1> %res to i64
295 define <16 x i32> @test13(<16 x float>%a, <16 x float>%b)
296 ; AVX512-LABEL: test13:
298 ; AVX512-NEXT: vcmpeqps %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xc9,0x00]
299 ; AVX512-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf3,0x7d,0xc9,0x25,0xc0,0xff]
300 ; AVX512-NEXT: vpsrld $31, %zmm0, %zmm0 ## encoding: [0x62,0xf1,0x7d,0x48,0x72,0xd0,0x1f]
301 ; AVX512-NEXT: retq ## encoding: [0xc3]
305 ; SKX-NEXT: vcmpeqps %zmm1, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xc1,0x00]
306 ; SKX-NEXT: vpmovm2d %k0, %zmm0 ## encoding: [0x62,0xf2,0x7e,0x48,0x38,0xc0]
307 ; SKX-NEXT: vpsrld $31, %zmm0, %zmm0 ## encoding: [0x62,0xf1,0x7d,0x48,0x72,0xd0,0x1f]
308 ; SKX-NEXT: retq ## encoding: [0xc3]
310 %cmpvector_i = fcmp oeq <16 x float> %a, %b
311 %conv = zext <16 x i1> %cmpvector_i to <16 x i32>
315 define <16 x i32> @test14(<16 x i32>%a, <16 x i32>%b) {
316 ; CHECK-LABEL: test14:
318 ; CHECK-NEXT: vpsubd %zmm1, %zmm0, %zmm2 ## encoding: [0x62,0xf1,0x7d,0x48,0xfa,0xd1]
319 ; CHECK-NEXT: vpcmpgtd %zmm0, %zmm2, %k1 ## encoding: [0x62,0xf1,0x6d,0x48,0x66,0xc8]
320 ; CHECK-NEXT: vpsubd %zmm1, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7d,0xc9,0xfa,0xc1]
321 ; CHECK-NEXT: retq ## encoding: [0xc3]
322 %sub_r = sub <16 x i32> %a, %b
323 %cmp.i2.i = icmp sgt <16 x i32> %sub_r, %a
324 %sext.i3.i = sext <16 x i1> %cmp.i2.i to <16 x i32>
325 %mask = icmp eq <16 x i32> %sext.i3.i, zeroinitializer
326 %res = select <16 x i1> %mask, <16 x i32> zeroinitializer, <16 x i32> %sub_r
330 define <8 x i64> @test15(<8 x i64>%a, <8 x i64>%b) {
331 ; CHECK-LABEL: test15:
333 ; CHECK-NEXT: vpsubq %zmm1, %zmm0, %zmm2 ## encoding: [0x62,0xf1,0xfd,0x48,0xfb,0xd1]
334 ; CHECK-NEXT: vpcmpgtq %zmm0, %zmm2, %k1 ## encoding: [0x62,0xf2,0xed,0x48,0x37,0xc8]
335 ; CHECK-NEXT: vpsubq %zmm1, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0xfd,0xc9,0xfb,0xc1]
336 ; CHECK-NEXT: retq ## encoding: [0xc3]
337 %sub_r = sub <8 x i64> %a, %b
338 %cmp.i2.i = icmp sgt <8 x i64> %sub_r, %a
339 %sext.i3.i = sext <8 x i1> %cmp.i2.i to <8 x i64>
340 %mask = icmp eq <8 x i64> %sext.i3.i, zeroinitializer
341 %res = select <8 x i1> %mask, <8 x i64> zeroinitializer, <8 x i64> %sub_r
345 define <16 x i32> @test16(<16 x i32> %x, <16 x i32> %y, <16 x i32> %x1) nounwind {
346 ; CHECK-LABEL: test16:
348 ; CHECK-NEXT: vpcmpnltd %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf3,0x7d,0x48,0x1f,0xc9,0x05]
349 ; CHECK-NEXT: vpblendmd %zmm2, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc2]
350 ; CHECK-NEXT: retq ## encoding: [0xc3]
351 %mask = icmp sge <16 x i32> %x, %y
352 %max = select <16 x i1> %mask, <16 x i32> %x1, <16 x i32> %y
356 define <16 x i32> @test17(<16 x i32> %x, <16 x i32> %x1, <16 x i32>* %y.ptr) nounwind {
357 ; CHECK-LABEL: test17:
359 ; CHECK-NEXT: vpcmpgtd (%rdi), %zmm0, %k1 ## encoding: [0x62,0xf1,0x7d,0x48,0x66,0x0f]
360 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
361 ; CHECK-NEXT: retq ## encoding: [0xc3]
362 %y = load <16 x i32>, <16 x i32>* %y.ptr, align 4
363 %mask = icmp sgt <16 x i32> %x, %y
364 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %x1
368 define <16 x i32> @test18(<16 x i32> %x, <16 x i32> %x1, <16 x i32>* %y.ptr) nounwind {
369 ; CHECK-LABEL: test18:
371 ; CHECK-NEXT: vpcmpled (%rdi), %zmm0, %k1 ## encoding: [0x62,0xf3,0x7d,0x48,0x1f,0x0f,0x02]
372 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
373 ; CHECK-NEXT: retq ## encoding: [0xc3]
374 %y = load <16 x i32>, <16 x i32>* %y.ptr, align 4
375 %mask = icmp sle <16 x i32> %x, %y
376 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %x1
380 define <16 x i32> @test19(<16 x i32> %x, <16 x i32> %x1, <16 x i32>* %y.ptr) nounwind {
381 ; CHECK-LABEL: test19:
383 ; CHECK-NEXT: vpcmpleud (%rdi), %zmm0, %k1 ## encoding: [0x62,0xf3,0x7d,0x48,0x1e,0x0f,0x02]
384 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
385 ; CHECK-NEXT: retq ## encoding: [0xc3]
386 %y = load <16 x i32>, <16 x i32>* %y.ptr, align 4
387 %mask = icmp ule <16 x i32> %x, %y
388 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %x1
392 define <16 x i32> @test20(<16 x i32> %x, <16 x i32> %y, <16 x i32> %x1, <16 x i32> %y1) nounwind {
393 ; CHECK-LABEL: test20:
395 ; CHECK-NEXT: vpcmpeqd %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0xc9]
396 ; CHECK-NEXT: vpcmpeqd %zmm3, %zmm2, %k1 {%k1} ## encoding: [0x62,0xf1,0x6d,0x49,0x76,0xcb]
397 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
398 ; CHECK-NEXT: retq ## encoding: [0xc3]
399 %mask1 = icmp eq <16 x i32> %x1, %y1
400 %mask0 = icmp eq <16 x i32> %x, %y
401 %mask = select <16 x i1> %mask0, <16 x i1> %mask1, <16 x i1> zeroinitializer
402 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %y
406 define <8 x i64> @test21(<8 x i64> %x, <8 x i64> %y, <8 x i64> %x1, <8 x i64> %y1) nounwind {
407 ; CHECK-LABEL: test21:
409 ; CHECK-NEXT: vpcmpleq %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf3,0xfd,0x48,0x1f,0xc9,0x02]
410 ; CHECK-NEXT: vpcmpnltq %zmm3, %zmm2, %k1 {%k1} ## encoding: [0x62,0xf3,0xed,0x49,0x1f,0xcb,0x05]
411 ; CHECK-NEXT: vpblendmq %zmm0, %zmm2, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xed,0x49,0x64,0xc0]
412 ; CHECK-NEXT: retq ## encoding: [0xc3]
413 %mask1 = icmp sge <8 x i64> %x1, %y1
414 %mask0 = icmp sle <8 x i64> %x, %y
415 %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
416 %max = select <8 x i1> %mask, <8 x i64> %x, <8 x i64> %x1
420 define <8 x i64> @test22(<8 x i64> %x, <8 x i64>* %y.ptr, <8 x i64> %x1, <8 x i64> %y1) nounwind {
421 ; CHECK-LABEL: test22:
423 ; CHECK-NEXT: vpcmpgtq %zmm2, %zmm1, %k1 ## encoding: [0x62,0xf2,0xf5,0x48,0x37,0xca]
424 ; CHECK-NEXT: vpcmpgtq (%rdi), %zmm0, %k1 {%k1} ## encoding: [0x62,0xf2,0xfd,0x49,0x37,0x0f]
425 ; CHECK-NEXT: vpblendmq %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x64,0xc0]
426 ; CHECK-NEXT: retq ## encoding: [0xc3]
427 %mask1 = icmp sgt <8 x i64> %x1, %y1
428 %y = load <8 x i64>, <8 x i64>* %y.ptr, align 4
429 %mask0 = icmp sgt <8 x i64> %x, %y
430 %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
431 %max = select <8 x i1> %mask, <8 x i64> %x, <8 x i64> %x1
435 define <16 x i32> @test23(<16 x i32> %x, <16 x i32>* %y.ptr, <16 x i32> %x1, <16 x i32> %y1) nounwind {
436 ; CHECK-LABEL: test23:
438 ; CHECK-NEXT: vpcmpnltd %zmm2, %zmm1, %k1 ## encoding: [0x62,0xf3,0x75,0x48,0x1f,0xca,0x05]
439 ; CHECK-NEXT: vpcmpleud (%rdi), %zmm0, %k1 {%k1} ## encoding: [0x62,0xf3,0x7d,0x49,0x1e,0x0f,0x02]
440 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
441 ; CHECK-NEXT: retq ## encoding: [0xc3]
442 %mask1 = icmp sge <16 x i32> %x1, %y1
443 %y = load <16 x i32>, <16 x i32>* %y.ptr, align 4
444 %mask0 = icmp ule <16 x i32> %x, %y
445 %mask = select <16 x i1> %mask0, <16 x i1> %mask1, <16 x i1> zeroinitializer
446 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %x1
450 define <8 x i64> @test24(<8 x i64> %x, <8 x i64> %x1, i64* %yb.ptr) nounwind {
451 ; CHECK-LABEL: test24:
453 ; CHECK-NEXT: vpcmpeqq (%rdi){1to8}, %zmm0, %k1 ## encoding: [0x62,0xf2,0xfd,0x58,0x29,0x0f]
454 ; CHECK-NEXT: vpblendmq %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x64,0xc0]
455 ; CHECK-NEXT: retq ## encoding: [0xc3]
456 %yb = load i64, i64* %yb.ptr, align 4
457 %y.0 = insertelement <8 x i64> undef, i64 %yb, i32 0
458 %y = shufflevector <8 x i64> %y.0, <8 x i64> undef, <8 x i32> zeroinitializer
459 %mask = icmp eq <8 x i64> %x, %y
460 %max = select <8 x i1> %mask, <8 x i64> %x, <8 x i64> %x1
464 define <16 x i32> @test25(<16 x i32> %x, i32* %yb.ptr, <16 x i32> %x1) nounwind {
465 ; CHECK-LABEL: test25:
467 ; CHECK-NEXT: vpcmpled (%rdi){1to16}, %zmm0, %k1 ## encoding: [0x62,0xf3,0x7d,0x58,0x1f,0x0f,0x02]
468 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
469 ; CHECK-NEXT: retq ## encoding: [0xc3]
470 %yb = load i32, i32* %yb.ptr, align 4
471 %y.0 = insertelement <16 x i32> undef, i32 %yb, i32 0
472 %y = shufflevector <16 x i32> %y.0, <16 x i32> undef, <16 x i32> zeroinitializer
473 %mask = icmp sle <16 x i32> %x, %y
474 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %x1
478 define <16 x i32> @test26(<16 x i32> %x, i32* %yb.ptr, <16 x i32> %x1, <16 x i32> %y1) nounwind {
479 ; CHECK-LABEL: test26:
481 ; CHECK-NEXT: vpcmpnltd %zmm2, %zmm1, %k1 ## encoding: [0x62,0xf3,0x75,0x48,0x1f,0xca,0x05]
482 ; CHECK-NEXT: vpcmpgtd (%rdi){1to16}, %zmm0, %k1 {%k1} ## encoding: [0x62,0xf1,0x7d,0x59,0x66,0x0f]
483 ; CHECK-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x64,0xc0]
484 ; CHECK-NEXT: retq ## encoding: [0xc3]
485 %mask1 = icmp sge <16 x i32> %x1, %y1
486 %yb = load i32, i32* %yb.ptr, align 4
487 %y.0 = insertelement <16 x i32> undef, i32 %yb, i32 0
488 %y = shufflevector <16 x i32> %y.0, <16 x i32> undef, <16 x i32> zeroinitializer
489 %mask0 = icmp sgt <16 x i32> %x, %y
490 %mask = select <16 x i1> %mask0, <16 x i1> %mask1, <16 x i1> zeroinitializer
491 %max = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %x1
495 define <8 x i64> @test27(<8 x i64> %x, i64* %yb.ptr, <8 x i64> %x1, <8 x i64> %y1) nounwind {
496 ; CHECK-LABEL: test27:
498 ; CHECK-NEXT: vpcmpnltq %zmm2, %zmm1, %k1 ## encoding: [0x62,0xf3,0xf5,0x48,0x1f,0xca,0x05]
499 ; CHECK-NEXT: vpcmpleq (%rdi){1to8}, %zmm0, %k1 {%k1} ## encoding: [0x62,0xf3,0xfd,0x59,0x1f,0x0f,0x02]
500 ; CHECK-NEXT: vpblendmq %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x64,0xc0]
501 ; CHECK-NEXT: retq ## encoding: [0xc3]
502 %mask1 = icmp sge <8 x i64> %x1, %y1
503 %yb = load i64, i64* %yb.ptr, align 4
504 %y.0 = insertelement <8 x i64> undef, i64 %yb, i32 0
505 %y = shufflevector <8 x i64> %y.0, <8 x i64> undef, <8 x i32> zeroinitializer
506 %mask0 = icmp sle <8 x i64> %x, %y
507 %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
508 %max = select <8 x i1> %mask, <8 x i64> %x, <8 x i64> %x1
512 define <8 x i32>@test28(<8 x i64> %x, <8 x i64> %y, <8 x i64> %x1, <8 x i64> %y1) {
513 ; AVX512-LABEL: test28:
515 ; AVX512-NEXT: vpcmpgtq %zmm1, %zmm0, %k0 ## encoding: [0x62,0xf2,0xfd,0x48,0x37,0xc1]
516 ; AVX512-NEXT: vpcmpgtq %zmm3, %zmm2, %k1 ## encoding: [0x62,0xf2,0xed,0x48,0x37,0xcb]
517 ; AVX512-NEXT: kxnorw %k1, %k0, %k1 ## encoding: [0xc5,0xfc,0x46,0xc9]
518 ; AVX512-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf3,0x7d,0xc9,0x25,0xc0,0xff]
519 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
520 ; AVX512-NEXT: retq ## encoding: [0xc3]
524 ; SKX-NEXT: vpcmpgtq %zmm1, %zmm0, %k0 ## encoding: [0x62,0xf2,0xfd,0x48,0x37,0xc1]
525 ; SKX-NEXT: vpcmpgtq %zmm3, %zmm2, %k1 ## encoding: [0x62,0xf2,0xed,0x48,0x37,0xcb]
526 ; SKX-NEXT: kxnorb %k1, %k0, %k0 ## encoding: [0xc5,0xfd,0x46,0xc1]
527 ; SKX-NEXT: vpmovm2d %k0, %ymm0 ## encoding: [0x62,0xf2,0x7e,0x28,0x38,0xc0]
528 ; SKX-NEXT: retq ## encoding: [0xc3]
529 %x_gt_y = icmp sgt <8 x i64> %x, %y
530 %x1_gt_y1 = icmp sgt <8 x i64> %x1, %y1
531 %res = icmp eq <8 x i1>%x_gt_y, %x1_gt_y1
532 %resse = sext <8 x i1>%res to <8 x i32>
536 define <16 x i8>@test29(<16 x i32> %x, <16 x i32> %y, <16 x i32> %x1, <16 x i32> %y1) {
539 ; KNL-NEXT: vpcmpgtd %zmm1, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x66,0xc1]
540 ; KNL-NEXT: vpcmpgtd %zmm3, %zmm2, %k1 ## encoding: [0x62,0xf1,0x6d,0x48,0x66,0xcb]
541 ; KNL-NEXT: kxorw %k1, %k0, %k1 ## encoding: [0xc5,0xfc,0x47,0xc9]
542 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf3,0x7d,0xc9,0x25,0xc0,0xff]
543 ; KNL-NEXT: vpmovdb %zmm0, %xmm0 ## encoding: [0x62,0xf2,0x7e,0x48,0x31,0xc0]
544 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
545 ; KNL-NEXT: retq ## encoding: [0xc3]
547 ; AVX512BW-LABEL: test29:
548 ; AVX512BW: ## %bb.0:
549 ; AVX512BW-NEXT: vpcmpgtd %zmm1, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x66,0xc1]
550 ; AVX512BW-NEXT: vpcmpgtd %zmm3, %zmm2, %k1 ## encoding: [0x62,0xf1,0x6d,0x48,0x66,0xcb]
551 ; AVX512BW-NEXT: kxorw %k1, %k0, %k0 ## encoding: [0xc5,0xfc,0x47,0xc1]
552 ; AVX512BW-NEXT: vpmovm2b %k0, %zmm0 ## encoding: [0x62,0xf2,0x7e,0x48,0x28,0xc0]
553 ; AVX512BW-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
554 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
555 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
559 ; SKX-NEXT: vpcmpgtd %zmm1, %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x66,0xc1]
560 ; SKX-NEXT: vpcmpgtd %zmm3, %zmm2, %k1 ## encoding: [0x62,0xf1,0x6d,0x48,0x66,0xcb]
561 ; SKX-NEXT: kxorw %k1, %k0, %k0 ## encoding: [0xc5,0xfc,0x47,0xc1]
562 ; SKX-NEXT: vpmovm2b %k0, %xmm0 ## encoding: [0x62,0xf2,0x7e,0x08,0x28,0xc0]
563 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
564 ; SKX-NEXT: retq ## encoding: [0xc3]
565 %x_gt_y = icmp sgt <16 x i32> %x, %y
566 %x1_gt_y1 = icmp sgt <16 x i32> %x1, %y1
567 %res = icmp ne <16 x i1>%x_gt_y, %x1_gt_y1
568 %resse = sext <16 x i1>%res to <16 x i8>
572 define <4 x double> @test30(<4 x double> %x, <4 x double> %y) nounwind {
573 ; AVX512-LABEL: test30:
575 ; AVX512-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
576 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
577 ; AVX512-NEXT: vcmpeqpd %zmm1, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0xc9,0x00]
578 ; AVX512-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
579 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
580 ; AVX512-NEXT: retq ## encoding: [0xc3]
584 ; SKX-NEXT: vcmpeqpd %ymm1, %ymm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x28,0xc2,0xc9,0x00]
585 ; SKX-NEXT: vblendmpd %ymm0, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x29,0x65,0xc0]
586 ; SKX-NEXT: retq ## encoding: [0xc3]
588 %mask = fcmp oeq <4 x double> %x, %y
589 %max = select <4 x i1> %mask, <4 x double> %x, <4 x double> %y
590 ret <4 x double> %max
593 define <2 x double> @test31(<2 x double> %x, <2 x double> %x1, <2 x double>* %yp) nounwind {
594 ; AVX512-LABEL: test31:
596 ; AVX512-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
597 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
598 ; AVX512-NEXT: vmovupd (%rdi), %xmm2 ## encoding: [0xc5,0xf9,0x10,0x17]
599 ; AVX512-NEXT: vcmpltpd %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0xca,0x01]
600 ; AVX512-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
601 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
602 ; AVX512-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
603 ; AVX512-NEXT: retq ## encoding: [0xc3]
607 ; SKX-NEXT: vcmpltpd (%rdi), %xmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x08,0xc2,0x0f,0x01]
608 ; SKX-NEXT: vblendmpd %xmm0, %xmm1, %xmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x09,0x65,0xc0]
609 ; SKX-NEXT: retq ## encoding: [0xc3]
611 %y = load <2 x double>, <2 x double>* %yp, align 4
612 %mask = fcmp olt <2 x double> %x, %y
613 %max = select <2 x i1> %mask, <2 x double> %x, <2 x double> %x1
614 ret <2 x double> %max
617 define <4 x double> @test32(<4 x double> %x, <4 x double> %x1, <4 x double>* %yp) nounwind {
618 ; AVX512-LABEL: test32:
620 ; AVX512-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
621 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
622 ; AVX512-NEXT: vmovupd (%rdi), %ymm2 ## encoding: [0xc5,0xfd,0x10,0x17]
623 ; AVX512-NEXT: vcmpltpd %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0xca,0x01]
624 ; AVX512-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
625 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
626 ; AVX512-NEXT: retq ## encoding: [0xc3]
630 ; SKX-NEXT: vcmpltpd (%rdi), %ymm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x28,0xc2,0x0f,0x01]
631 ; SKX-NEXT: vblendmpd %ymm0, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x29,0x65,0xc0]
632 ; SKX-NEXT: retq ## encoding: [0xc3]
634 %y = load <4 x double>, <4 x double>* %yp, align 4
635 %mask = fcmp ogt <4 x double> %y, %x
636 %max = select <4 x i1> %mask, <4 x double> %x, <4 x double> %x1
637 ret <4 x double> %max
640 define <8 x double> @test33(<8 x double> %x, <8 x double> %x1, <8 x double>* %yp) nounwind {
641 ; CHECK-LABEL: test33:
643 ; CHECK-NEXT: vcmpltpd (%rdi), %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0x0f,0x01]
644 ; CHECK-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
645 ; CHECK-NEXT: retq ## encoding: [0xc3]
646 %y = load <8 x double>, <8 x double>* %yp, align 4
647 %mask = fcmp olt <8 x double> %x, %y
648 %max = select <8 x i1> %mask, <8 x double> %x, <8 x double> %x1
649 ret <8 x double> %max
652 define <4 x float> @test34(<4 x float> %x, <4 x float> %x1, <4 x float>* %yp) nounwind {
653 ; AVX512-LABEL: test34:
655 ; AVX512-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
656 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
657 ; AVX512-NEXT: vmovups (%rdi), %xmm2 ## encoding: [0xc5,0xf8,0x10,0x17]
658 ; AVX512-NEXT: vcmpltps %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xca,0x01]
659 ; AVX512-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
660 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
661 ; AVX512-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
662 ; AVX512-NEXT: retq ## encoding: [0xc3]
666 ; SKX-NEXT: vcmpltps (%rdi), %xmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x08,0xc2,0x0f,0x01]
667 ; SKX-NEXT: vblendmps %xmm0, %xmm1, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x09,0x65,0xc0]
668 ; SKX-NEXT: retq ## encoding: [0xc3]
669 %y = load <4 x float>, <4 x float>* %yp, align 4
670 %mask = fcmp olt <4 x float> %x, %y
671 %max = select <4 x i1> %mask, <4 x float> %x, <4 x float> %x1
675 define <8 x float> @test35(<8 x float> %x, <8 x float> %x1, <8 x float>* %yp) nounwind {
676 ; AVX512-LABEL: test35:
678 ; AVX512-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
679 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
680 ; AVX512-NEXT: vmovups (%rdi), %ymm2 ## encoding: [0xc5,0xfc,0x10,0x17]
681 ; AVX512-NEXT: vcmpltps %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xca,0x01]
682 ; AVX512-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
683 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
684 ; AVX512-NEXT: retq ## encoding: [0xc3]
688 ; SKX-NEXT: vcmpltps (%rdi), %ymm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x28,0xc2,0x0f,0x01]
689 ; SKX-NEXT: vblendmps %ymm0, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x29,0x65,0xc0]
690 ; SKX-NEXT: retq ## encoding: [0xc3]
692 %y = load <8 x float>, <8 x float>* %yp, align 4
693 %mask = fcmp ogt <8 x float> %y, %x
694 %max = select <8 x i1> %mask, <8 x float> %x, <8 x float> %x1
698 define <16 x float> @test36(<16 x float> %x, <16 x float> %x1, <16 x float>* %yp) nounwind {
699 ; CHECK-LABEL: test36:
701 ; CHECK-NEXT: vcmpltps (%rdi), %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0x0f,0x01]
702 ; CHECK-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
703 ; CHECK-NEXT: retq ## encoding: [0xc3]
704 %y = load <16 x float>, <16 x float>* %yp, align 4
705 %mask = fcmp olt <16 x float> %x, %y
706 %max = select <16 x i1> %mask, <16 x float> %x, <16 x float> %x1
707 ret <16 x float> %max
710 define <8 x double> @test37(<8 x double> %x, <8 x double> %x1, double* %ptr) nounwind {
711 ; CHECK-LABEL: test37:
713 ; CHECK-NEXT: vcmpltpd (%rdi){1to8}, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x58,0xc2,0x0f,0x01]
714 ; CHECK-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
715 ; CHECK-NEXT: retq ## encoding: [0xc3]
717 %a = load double, double* %ptr
718 %v = insertelement <8 x double> undef, double %a, i32 0
719 %shuffle = shufflevector <8 x double> %v, <8 x double> undef, <8 x i32> zeroinitializer
721 %mask = fcmp ogt <8 x double> %shuffle, %x
722 %max = select <8 x i1> %mask, <8 x double> %x, <8 x double> %x1
723 ret <8 x double> %max
726 define <4 x double> @test38(<4 x double> %x, <4 x double> %x1, double* %ptr) nounwind {
727 ; AVX512-LABEL: test38:
729 ; AVX512-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
730 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
731 ; AVX512-NEXT: vbroadcastsd (%rdi), %ymm2 ## encoding: [0xc4,0xe2,0x7d,0x19,0x17]
732 ; AVX512-NEXT: vcmpltpd %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0xca,0x01]
733 ; AVX512-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
734 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
735 ; AVX512-NEXT: retq ## encoding: [0xc3]
739 ; SKX-NEXT: vcmpltpd (%rdi){1to4}, %ymm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x38,0xc2,0x0f,0x01]
740 ; SKX-NEXT: vblendmpd %ymm0, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x29,0x65,0xc0]
741 ; SKX-NEXT: retq ## encoding: [0xc3]
743 %a = load double, double* %ptr
744 %v = insertelement <4 x double> undef, double %a, i32 0
745 %shuffle = shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> zeroinitializer
747 %mask = fcmp ogt <4 x double> %shuffle, %x
748 %max = select <4 x i1> %mask, <4 x double> %x, <4 x double> %x1
749 ret <4 x double> %max
752 define <2 x double> @test39(<2 x double> %x, <2 x double> %x1, double* %ptr) nounwind {
753 ; AVX512-LABEL: test39:
755 ; AVX512-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
756 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
757 ; AVX512-NEXT: vmovddup (%rdi), %xmm2 ## encoding: [0xc5,0xfb,0x12,0x17]
758 ; AVX512-NEXT: ## xmm2 = mem[0,0]
759 ; AVX512-NEXT: vcmpltpd %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x48,0xc2,0xca,0x01]
760 ; AVX512-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
761 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
762 ; AVX512-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
763 ; AVX512-NEXT: retq ## encoding: [0xc3]
767 ; SKX-NEXT: vcmpltpd (%rdi){1to2}, %xmm0, %k1 ## encoding: [0x62,0xf1,0xfd,0x18,0xc2,0x0f,0x01]
768 ; SKX-NEXT: vblendmpd %xmm0, %xmm1, %xmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x09,0x65,0xc0]
769 ; SKX-NEXT: retq ## encoding: [0xc3]
771 %a = load double, double* %ptr
772 %v = insertelement <2 x double> undef, double %a, i32 0
773 %shuffle = shufflevector <2 x double> %v, <2 x double> undef, <2 x i32> <i32 0, i32 0>
775 %mask = fcmp ogt <2 x double> %shuffle, %x
776 %max = select <2 x i1> %mask, <2 x double> %x, <2 x double> %x1
777 ret <2 x double> %max
781 define <16 x float> @test40(<16 x float> %x, <16 x float> %x1, float* %ptr) nounwind {
782 ; CHECK-LABEL: test40:
784 ; CHECK-NEXT: vcmpltps (%rdi){1to16}, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x58,0xc2,0x0f,0x01]
785 ; CHECK-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
786 ; CHECK-NEXT: retq ## encoding: [0xc3]
788 %a = load float, float* %ptr
789 %v = insertelement <16 x float> undef, float %a, i32 0
790 %shuffle = shufflevector <16 x float> %v, <16 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
792 %mask = fcmp ogt <16 x float> %shuffle, %x
793 %max = select <16 x i1> %mask, <16 x float> %x, <16 x float> %x1
794 ret <16 x float> %max
797 define <8 x float> @test41(<8 x float> %x, <8 x float> %x1, float* %ptr) nounwind {
798 ; AVX512-LABEL: test41:
800 ; AVX512-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
801 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 def $zmm0
802 ; AVX512-NEXT: vbroadcastss (%rdi), %ymm2 ## encoding: [0xc4,0xe2,0x7d,0x18,0x17]
803 ; AVX512-NEXT: vcmpltps %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xca,0x01]
804 ; AVX512-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
805 ; AVX512-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
806 ; AVX512-NEXT: retq ## encoding: [0xc3]
810 ; SKX-NEXT: vcmpltps (%rdi){1to8}, %ymm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x38,0xc2,0x0f,0x01]
811 ; SKX-NEXT: vblendmps %ymm0, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x29,0x65,0xc0]
812 ; SKX-NEXT: retq ## encoding: [0xc3]
814 %a = load float, float* %ptr
815 %v = insertelement <8 x float> undef, float %a, i32 0
816 %shuffle = shufflevector <8 x float> %v, <8 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
818 %mask = fcmp ogt <8 x float> %shuffle, %x
819 %max = select <8 x i1> %mask, <8 x float> %x, <8 x float> %x1
823 define <4 x float> @test42(<4 x float> %x, <4 x float> %x1, float* %ptr) nounwind {
824 ; AVX512-LABEL: test42:
826 ; AVX512-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
827 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 def $zmm0
828 ; AVX512-NEXT: vbroadcastss (%rdi), %xmm2 ## encoding: [0xc4,0xe2,0x79,0x18,0x17]
829 ; AVX512-NEXT: vcmpltps %zmm2, %zmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x48,0xc2,0xca,0x01]
830 ; AVX512-NEXT: vblendmps %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x49,0x65,0xc0]
831 ; AVX512-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
832 ; AVX512-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
833 ; AVX512-NEXT: retq ## encoding: [0xc3]
837 ; SKX-NEXT: vcmpltps (%rdi){1to4}, %xmm0, %k1 ## encoding: [0x62,0xf1,0x7c,0x18,0xc2,0x0f,0x01]
838 ; SKX-NEXT: vblendmps %xmm0, %xmm1, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x75,0x09,0x65,0xc0]
839 ; SKX-NEXT: retq ## encoding: [0xc3]
841 %a = load float, float* %ptr
842 %v = insertelement <4 x float> undef, float %a, i32 0
843 %shuffle = shufflevector <4 x float> %v, <4 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
845 %mask = fcmp ogt <4 x float> %shuffle, %x
846 %max = select <4 x i1> %mask, <4 x float> %x, <4 x float> %x1
850 define <8 x double> @test43(<8 x double> %x, <8 x double> %x1, double* %ptr,<8 x i1> %mask_in) nounwind {
853 ; KNL-NEXT: vpmovzxwq %xmm2, %zmm2 ## encoding: [0x62,0xf2,0x7d,0x48,0x34,0xd2]
854 ; KNL-NEXT: ## zmm2 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero,xmm2[4],zero,zero,zero,xmm2[5],zero,zero,zero,xmm2[6],zero,zero,zero,xmm2[7],zero,zero,zero
855 ; KNL-NEXT: vpsllq $63, %zmm2, %zmm2 ## encoding: [0x62,0xf1,0xed,0x48,0x73,0xf2,0x3f]
856 ; KNL-NEXT: vptestmq %zmm2, %zmm2, %k1 ## encoding: [0x62,0xf2,0xed,0x48,0x27,0xca]
857 ; KNL-NEXT: vcmpltpd (%rdi){1to8}, %zmm0, %k1 {%k1} ## encoding: [0x62,0xf1,0xfd,0x59,0xc2,0x0f,0x01]
858 ; KNL-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
859 ; KNL-NEXT: retq ## encoding: [0xc3]
861 ; AVX512BW-LABEL: test43:
862 ; AVX512BW: ## %bb.0:
863 ; AVX512BW-NEXT: vpsllw $15, %xmm2, %xmm2 ## encoding: [0xc5,0xe9,0x71,0xf2,0x0f]
864 ; AVX512BW-NEXT: vpmovw2m %zmm2, %k1 ## encoding: [0x62,0xf2,0xfe,0x48,0x29,0xca]
865 ; AVX512BW-NEXT: vcmpltpd (%rdi){1to8}, %zmm0, %k1 {%k1} ## encoding: [0x62,0xf1,0xfd,0x59,0xc2,0x0f,0x01]
866 ; AVX512BW-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
867 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
871 ; SKX-NEXT: vpsllw $15, %xmm2, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xe9,0x71,0xf2,0x0f]
872 ; SKX-NEXT: vpmovw2m %xmm2, %k1 ## encoding: [0x62,0xf2,0xfe,0x08,0x29,0xca]
873 ; SKX-NEXT: vcmpltpd (%rdi){1to8}, %zmm0, %k1 {%k1} ## encoding: [0x62,0xf1,0xfd,0x59,0xc2,0x0f,0x01]
874 ; SKX-NEXT: vblendmpd %zmm0, %zmm1, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xf5,0x49,0x65,0xc0]
875 ; SKX-NEXT: retq ## encoding: [0xc3]
877 %a = load double, double* %ptr
878 %v = insertelement <8 x double> undef, double %a, i32 0
879 %shuffle = shufflevector <8 x double> %v, <8 x double> undef, <8 x i32> zeroinitializer
881 %mask_cmp = fcmp ogt <8 x double> %shuffle, %x
882 %mask = and <8 x i1> %mask_cmp, %mask_in
883 %max = select <8 x i1> %mask, <8 x double> %x, <8 x double> %x1
884 ret <8 x double> %max
887 define <4 x i32> @test44(<4 x i16> %x, <4 x i16> %y) #0 {
888 ; AVX512-LABEL: test44:
890 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2 ## encoding: [0xc5,0xe9,0xef,0xd2]
891 ; AVX512-NEXT: vpblendw $170, %xmm2, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x71,0x0e,0xca,0xaa]
892 ; AVX512-NEXT: ## xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
893 ; AVX512-NEXT: vpblendw $170, %xmm2, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0e,0xc2,0xaa]
894 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm2[1],xmm0[2],xmm2[3],xmm0[4],xmm2[5],xmm0[6],xmm2[7]
895 ; AVX512-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf9,0x76,0xc1]
896 ; AVX512-NEXT: retq ## encoding: [0xc3]
900 ; SKX-NEXT: vpxor %xmm2, %xmm2, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xe9,0xef,0xd2]
901 ; SKX-NEXT: vpblendw $170, %xmm2, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x71,0x0e,0xca,0xaa]
902 ; SKX-NEXT: ## xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
903 ; SKX-NEXT: vpblendw $170, %xmm2, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0e,0xc2,0xaa]
904 ; SKX-NEXT: ## xmm0 = xmm0[0],xmm2[1],xmm0[2],xmm2[3],xmm0[4],xmm2[5],xmm0[6],xmm2[7]
905 ; SKX-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf9,0x76,0xc1]
906 ; SKX-NEXT: retq ## encoding: [0xc3]
907 %mask = icmp eq <4 x i16> %x, %y
908 %1 = sext <4 x i1> %mask to <4 x i32>
912 define <2 x i64> @test45(<2 x i16> %x, <2 x i16> %y) #0 {
913 ; AVX512-LABEL: test45:
915 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2 ## encoding: [0xc5,0xe9,0xef,0xd2]
916 ; AVX512-NEXT: vpblendw $17, %xmm1, %xmm2, %xmm1 ## encoding: [0xc4,0xe3,0x69,0x0e,0xc9,0x11]
917 ; AVX512-NEXT: ## xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
918 ; AVX512-NEXT: vpblendw $17, %xmm0, %xmm2, %xmm0 ## encoding: [0xc4,0xe3,0x69,0x0e,0xc0,0x11]
919 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm2[1,2,3],xmm0[4],xmm2[5,6,7]
920 ; AVX512-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x29,0xc1]
921 ; AVX512-NEXT: vpsrlq $63, %xmm0, %xmm0 ## encoding: [0xc5,0xf9,0x73,0xd0,0x3f]
922 ; AVX512-NEXT: retq ## encoding: [0xc3]
926 ; SKX-NEXT: vpxor %xmm2, %xmm2, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xe9,0xef,0xd2]
927 ; SKX-NEXT: vpblendw $17, %xmm1, %xmm2, %xmm1 ## encoding: [0xc4,0xe3,0x69,0x0e,0xc9,0x11]
928 ; SKX-NEXT: ## xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
929 ; SKX-NEXT: vpblendw $17, %xmm0, %xmm2, %xmm0 ## encoding: [0xc4,0xe3,0x69,0x0e,0xc0,0x11]
930 ; SKX-NEXT: ## xmm0 = xmm0[0],xmm2[1,2,3],xmm0[4],xmm2[5,6,7]
931 ; SKX-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x29,0xc1]
932 ; SKX-NEXT: vpsrlq $63, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf9,0x73,0xd0,0x3f]
933 ; SKX-NEXT: retq ## encoding: [0xc3]
934 %mask = icmp eq <2 x i16> %x, %y
935 %1 = zext <2 x i1> %mask to <2 x i64>
939 define <2 x i64> @test46(<2 x float> %x, <2 x float> %y) #0 {
940 ; AVX512-LABEL: test46:
942 ; AVX512-NEXT: vcmpeqps %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf8,0xc2,0xc1,0x00]
943 ; AVX512-NEXT: vpmovzxdq %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x35,0xc0]
944 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero,xmm0[1],zero
945 ; AVX512-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0 ## encoding: [0xc5,0xf9,0xdb,0x05,A,A,A,A]
946 ; AVX512-NEXT: ## fixup A - offset: 4, value: LCPI47_0-4, kind: reloc_riprel_4byte
947 ; AVX512-NEXT: retq ## encoding: [0xc3]
951 ; SKX-NEXT: vcmpeqps %xmm1, %xmm0, %k0 ## encoding: [0x62,0xf1,0x7c,0x08,0xc2,0xc1,0x00]
952 ; SKX-NEXT: vpmovm2q %k0, %xmm0 ## encoding: [0x62,0xf2,0xfe,0x08,0x38,0xc0]
953 ; SKX-NEXT: vpsrlq $63, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf9,0x73,0xd0,0x3f]
954 ; SKX-NEXT: retq ## encoding: [0xc3]
955 %mask = fcmp oeq <2 x float> %x, %y
956 %1 = zext <2 x i1> %mask to <2 x i64>
960 define <16 x i8> @test47(<16 x i32> %a, <16 x i8> %b, <16 x i8> %c) {
963 ; KNL-NEXT: vptestnmd %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0x7e,0x48,0x27,0xc8]
964 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf3,0x7d,0xc9,0x25,0xc0,0xff]
965 ; KNL-NEXT: vpmovdb %zmm0, %xmm0 ## encoding: [0x62,0xf2,0x7e,0x48,0x31,0xc0]
966 ; KNL-NEXT: vpblendvb %xmm0, %xmm1, %xmm2, %xmm0 ## encoding: [0xc4,0xe3,0x69,0x4c,0xc1,0x00]
967 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
968 ; KNL-NEXT: retq ## encoding: [0xc3]
970 ; AVX512BW-LABEL: test47:
971 ; AVX512BW: ## %bb.0:
972 ; AVX512BW-NEXT: ## kill: def $xmm2 killed $xmm2 def $zmm2
973 ; AVX512BW-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
974 ; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0x7e,0x48,0x27,0xc8]
975 ; AVX512BW-NEXT: vpblendmb %zmm1, %zmm2, %zmm0 {%k1} ## encoding: [0x62,0xf2,0x6d,0x49,0x66,0xc1]
976 ; AVX512BW-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
977 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
978 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
982 ; SKX-NEXT: vptestnmd %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0x7e,0x48,0x27,0xc8]
983 ; SKX-NEXT: vpblendmb %xmm1, %xmm2, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x6d,0x09,0x66,0xc1]
984 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
985 ; SKX-NEXT: retq ## encoding: [0xc3]
986 %cmp = icmp eq <16 x i32> %a, zeroinitializer
987 %res = select <16 x i1> %cmp, <16 x i8> %b, <16 x i8> %c
991 define <16 x i16> @test48(<16 x i32> %a, <16 x i16> %b, <16 x i16> %c) {
994 ; KNL-NEXT: vptestnmd %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0x7e,0x48,0x27,0xc8]
995 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf3,0x7d,0xc9,0x25,0xc0,0xff]
996 ; KNL-NEXT: vpmovdw %zmm0, %ymm0 ## encoding: [0x62,0xf2,0x7e,0x48,0x33,0xc0]
997 ; KNL-NEXT: vpblendvb %ymm0, %ymm1, %ymm2, %ymm0 ## encoding: [0xc4,0xe3,0x6d,0x4c,0xc1,0x00]
998 ; KNL-NEXT: retq ## encoding: [0xc3]
1000 ; AVX512BW-LABEL: test48:
1001 ; AVX512BW: ## %bb.0:
1002 ; AVX512BW-NEXT: ## kill: def $ymm2 killed $ymm2 def $zmm2
1003 ; AVX512BW-NEXT: ## kill: def $ymm1 killed $ymm1 def $zmm1
1004 ; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0x7e,0x48,0x27,0xc8]
1005 ; AVX512BW-NEXT: vpblendmw %zmm1, %zmm2, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xed,0x49,0x66,0xc1]
1006 ; AVX512BW-NEXT: ## kill: def $ymm0 killed $ymm0 killed $zmm0
1007 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
1009 ; SKX-LABEL: test48:
1011 ; SKX-NEXT: vptestnmd %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0x7e,0x48,0x27,0xc8]
1012 ; SKX-NEXT: vpblendmw %ymm1, %ymm2, %ymm0 {%k1} ## encoding: [0x62,0xf2,0xed,0x29,0x66,0xc1]
1013 ; SKX-NEXT: retq ## encoding: [0xc3]
1014 %cmp = icmp eq <16 x i32> %a, zeroinitializer
1015 %res = select <16 x i1> %cmp, <16 x i16> %b, <16 x i16> %c
1019 define <8 x i16> @test49(<8 x i64> %a, <8 x i16> %b, <8 x i16> %c) {
1020 ; KNL-LABEL: test49:
1022 ; KNL-NEXT: vptestnmq %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0xfe,0x48,0x27,0xc8]
1023 ; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf3,0x7d,0xc9,0x25,0xc0,0xff]
1024 ; KNL-NEXT: vpmovdw %zmm0, %ymm0 ## encoding: [0x62,0xf2,0x7e,0x48,0x33,0xc0]
1025 ; KNL-NEXT: vpblendvb %xmm0, %xmm1, %xmm2, %xmm0 ## encoding: [0xc4,0xe3,0x69,0x4c,0xc1,0x00]
1026 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1027 ; KNL-NEXT: retq ## encoding: [0xc3]
1029 ; AVX512BW-LABEL: test49:
1030 ; AVX512BW: ## %bb.0:
1031 ; AVX512BW-NEXT: ## kill: def $xmm2 killed $xmm2 def $zmm2
1032 ; AVX512BW-NEXT: ## kill: def $xmm1 killed $xmm1 def $zmm1
1033 ; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0xfe,0x48,0x27,0xc8]
1034 ; AVX512BW-NEXT: vpblendmw %zmm1, %zmm2, %zmm0 {%k1} ## encoding: [0x62,0xf2,0xed,0x49,0x66,0xc1]
1035 ; AVX512BW-NEXT: ## kill: def $xmm0 killed $xmm0 killed $zmm0
1036 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1037 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
1039 ; SKX-LABEL: test49:
1041 ; SKX-NEXT: vptestnmq %zmm0, %zmm0, %k1 ## encoding: [0x62,0xf2,0xfe,0x48,0x27,0xc8]
1042 ; SKX-NEXT: vpblendmw %xmm1, %xmm2, %xmm0 {%k1} ## encoding: [0x62,0xf2,0xed,0x09,0x66,0xc1]
1043 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1044 ; SKX-NEXT: retq ## encoding: [0xc3]
1045 %cmp = icmp eq <8 x i64> %a, zeroinitializer
1046 %res = select <8 x i1> %cmp, <8 x i16> %b, <8 x i16> %c
1050 define i16 @pcmpeq_mem_1(<16 x i32> %a, <16 x i32>* %b) {
1051 ; KNL-LABEL: pcmpeq_mem_1:
1053 ; KNL-NEXT: vpcmpeqd (%rdi), %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0x07]
1054 ; KNL-NEXT: kmovw %k0, %eax ## encoding: [0xc5,0xf8,0x93,0xc0]
1055 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
1056 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1057 ; KNL-NEXT: retq ## encoding: [0xc3]
1059 ; AVX512BW-LABEL: pcmpeq_mem_1:
1060 ; AVX512BW: ## %bb.0:
1061 ; AVX512BW-NEXT: vpcmpeqd (%rdi), %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0x07]
1062 ; AVX512BW-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
1063 ; AVX512BW-NEXT: ## kill: def $ax killed $ax killed $eax
1064 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1065 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
1067 ; SKX-LABEL: pcmpeq_mem_1:
1069 ; SKX-NEXT: vpcmpeqd (%rdi), %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0x07]
1070 ; SKX-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
1071 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
1072 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1073 ; SKX-NEXT: retq ## encoding: [0xc3]
1074 %load = load <16 x i32>, <16 x i32>* %b
1075 %cmp = icmp eq <16 x i32> %a, %load
1076 %cast = bitcast <16 x i1> %cmp to i16
1080 ; Make sure we use the short pcmpeq encoding like the test above when the memoryo
1081 ; operand is in the first argument instead of the second.
1082 define i16 @pcmpeq_mem_2(<16 x i32> %a, <16 x i32>* %b) {
1083 ; KNL-LABEL: pcmpeq_mem_2:
1085 ; KNL-NEXT: vpcmpeqd (%rdi), %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0x07]
1086 ; KNL-NEXT: kmovw %k0, %eax ## encoding: [0xc5,0xf8,0x93,0xc0]
1087 ; KNL-NEXT: ## kill: def $ax killed $ax killed $eax
1088 ; KNL-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1089 ; KNL-NEXT: retq ## encoding: [0xc3]
1091 ; AVX512BW-LABEL: pcmpeq_mem_2:
1092 ; AVX512BW: ## %bb.0:
1093 ; AVX512BW-NEXT: vpcmpeqd (%rdi), %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0x07]
1094 ; AVX512BW-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
1095 ; AVX512BW-NEXT: ## kill: def $ax killed $ax killed $eax
1096 ; AVX512BW-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1097 ; AVX512BW-NEXT: retq ## encoding: [0xc3]
1099 ; SKX-LABEL: pcmpeq_mem_2:
1101 ; SKX-NEXT: vpcmpeqd (%rdi), %zmm0, %k0 ## encoding: [0x62,0xf1,0x7d,0x48,0x76,0x07]
1102 ; SKX-NEXT: kmovd %k0, %eax ## encoding: [0xc5,0xfb,0x93,0xc0]
1103 ; SKX-NEXT: ## kill: def $ax killed $ax killed $eax
1104 ; SKX-NEXT: vzeroupper ## encoding: [0xc5,0xf8,0x77]
1105 ; SKX-NEXT: retq ## encoding: [0xc3]
1106 %load = load <16 x i32>, <16 x i32>* %b
1107 %cmp = icmp eq <16 x i32> %load, %a
1108 %cast = bitcast <16 x i1> %cmp to i16