1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512f | FileCheck %s --check-prefixes=AVX512,AVX512F
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512vl | FileCheck %s --check-prefixes=AVX512,AVX512VL
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512bw | FileCheck %s --check-prefixes=AVX512,AVX512BW,AVX512BWNOVL
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512vl,avx512bw | FileCheck %s --check-prefixes=AVX512,AVX512VL,AVX512BWVL
7 define void @truncstore_v8i64_v8i32(<8 x i64> %x, <8 x i32>* %p, <8 x i32> %mask) {
8 ; AVX512F-LABEL: truncstore_v8i64_v8i32:
10 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
11 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k1
12 ; AVX512F-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
13 ; AVX512F-NEXT: vpmovqd %zmm0, (%rdi) {%k1}
14 ; AVX512F-NEXT: vzeroupper
17 ; AVX512VL-LABEL: truncstore_v8i64_v8i32:
19 ; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1
20 ; AVX512VL-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
21 ; AVX512VL-NEXT: vpmovqd %zmm0, (%rdi) {%k1}
22 ; AVX512VL-NEXT: vzeroupper
25 ; AVX512BW-LABEL: truncstore_v8i64_v8i32:
27 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
28 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k1
29 ; AVX512BW-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
30 ; AVX512BW-NEXT: vpmovqd %zmm0, (%rdi) {%k1}
31 ; AVX512BW-NEXT: vzeroupper
33 %a = icmp ne <8 x i32> %mask, zeroinitializer
34 %b = icmp ult <8 x i64> %x, <i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295>
35 %c = select <8 x i1> %b, <8 x i64> %x, <8 x i64> <i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295>
36 %d = trunc <8 x i64> %c to <8 x i32>
37 call void @llvm.masked.store.v8i32.p0v8i32(<8 x i32> %d, <8 x i32>* %p, i32 1, <8 x i1> %a)
41 define void @truncstore_v8i64_v8i16(<8 x i64> %x, <8 x i16>* %p, <8 x i32> %mask) {
42 ; AVX512F-LABEL: truncstore_v8i64_v8i16:
44 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
45 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
46 ; AVX512F-NEXT: vpmovusqw %zmm0, %xmm0
47 ; AVX512F-NEXT: kmovw %k0, %eax
48 ; AVX512F-NEXT: testb $1, %al
49 ; AVX512F-NEXT: je .LBB1_2
50 ; AVX512F-NEXT: # %bb.1: # %cond.store
51 ; AVX512F-NEXT: vpextrw $0, %xmm0, (%rdi)
52 ; AVX512F-NEXT: .LBB1_2: # %else
53 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
54 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
55 ; AVX512F-NEXT: kmovw %k0, %eax
56 ; AVX512F-NEXT: testb $1, %al
57 ; AVX512F-NEXT: je .LBB1_4
58 ; AVX512F-NEXT: # %bb.3: # %cond.store1
59 ; AVX512F-NEXT: vpextrw $1, %xmm0, 2(%rdi)
60 ; AVX512F-NEXT: .LBB1_4: # %else2
61 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
62 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
63 ; AVX512F-NEXT: kmovw %k0, %eax
64 ; AVX512F-NEXT: testb $1, %al
65 ; AVX512F-NEXT: je .LBB1_6
66 ; AVX512F-NEXT: # %bb.5: # %cond.store3
67 ; AVX512F-NEXT: vpextrw $2, %xmm0, 4(%rdi)
68 ; AVX512F-NEXT: .LBB1_6: # %else4
69 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
70 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
71 ; AVX512F-NEXT: kmovw %k0, %eax
72 ; AVX512F-NEXT: testb $1, %al
73 ; AVX512F-NEXT: je .LBB1_8
74 ; AVX512F-NEXT: # %bb.7: # %cond.store5
75 ; AVX512F-NEXT: vpextrw $3, %xmm0, 6(%rdi)
76 ; AVX512F-NEXT: .LBB1_8: # %else6
77 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
78 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
79 ; AVX512F-NEXT: kmovw %k0, %eax
80 ; AVX512F-NEXT: testb $1, %al
81 ; AVX512F-NEXT: je .LBB1_10
82 ; AVX512F-NEXT: # %bb.9: # %cond.store7
83 ; AVX512F-NEXT: vpextrw $4, %xmm0, 8(%rdi)
84 ; AVX512F-NEXT: .LBB1_10: # %else8
85 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
86 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
87 ; AVX512F-NEXT: kmovw %k0, %eax
88 ; AVX512F-NEXT: testb $1, %al
89 ; AVX512F-NEXT: je .LBB1_12
90 ; AVX512F-NEXT: # %bb.11: # %cond.store9
91 ; AVX512F-NEXT: vpextrw $5, %xmm0, 10(%rdi)
92 ; AVX512F-NEXT: .LBB1_12: # %else10
93 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
94 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
95 ; AVX512F-NEXT: kmovw %k0, %eax
96 ; AVX512F-NEXT: testb $1, %al
97 ; AVX512F-NEXT: je .LBB1_14
98 ; AVX512F-NEXT: # %bb.13: # %cond.store11
99 ; AVX512F-NEXT: vpextrw $6, %xmm0, 12(%rdi)
100 ; AVX512F-NEXT: .LBB1_14: # %else12
101 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
102 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
103 ; AVX512F-NEXT: kmovw %k0, %eax
104 ; AVX512F-NEXT: testb $1, %al
105 ; AVX512F-NEXT: je .LBB1_16
106 ; AVX512F-NEXT: # %bb.15: # %cond.store13
107 ; AVX512F-NEXT: vpextrw $7, %xmm0, 14(%rdi)
108 ; AVX512F-NEXT: .LBB1_16: # %else14
109 ; AVX512F-NEXT: vzeroupper
112 ; AVX512BW-LABEL: truncstore_v8i64_v8i16:
114 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
115 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k1
116 ; AVX512BW-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
117 ; AVX512BW-NEXT: vpmovqw %zmm0, (%rdi) {%k1}
118 ; AVX512BW-NEXT: vzeroupper
119 ; AVX512BW-NEXT: retq
121 ; AVX512BWVL-LABEL: truncstore_v8i64_v8i16:
122 ; AVX512BWVL: # %bb.0:
123 ; AVX512BWVL-NEXT: vptestmd %ymm1, %ymm1, %k1
124 ; AVX512BWVL-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
125 ; AVX512BWVL-NEXT: vpmovqw %zmm0, (%rdi) {%k1}
126 ; AVX512BWVL-NEXT: vzeroupper
127 ; AVX512BWVL-NEXT: retq
128 %a = icmp ne <8 x i32> %mask, zeroinitializer
129 %b = icmp ult <8 x i64> %x, <i64 65535, i64 65535, i64 65535, i64 65535, i64 65535, i64 65535, i64 65535, i64 65535>
130 %c = select <8 x i1> %b, <8 x i64> %x, <8 x i64> <i64 65535, i64 65535, i64 65535, i64 65535, i64 65535, i64 65535, i64 65535, i64 65535>
131 %d = trunc <8 x i64> %c to <8 x i16>
132 call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %d, <8 x i16>* %p, i32 1, <8 x i1> %a)
136 define void @truncstore_v8i64_v8i8(<8 x i64> %x, <8 x i8>* %p, <8 x i32> %mask) {
137 ; AVX512F-LABEL: truncstore_v8i64_v8i8:
139 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
140 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
141 ; AVX512F-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
142 ; AVX512F-NEXT: vpmovqw %zmm0, %xmm0
143 ; AVX512F-NEXT: kmovw %k0, %eax
144 ; AVX512F-NEXT: testb $1, %al
145 ; AVX512F-NEXT: je .LBB2_2
146 ; AVX512F-NEXT: # %bb.1: # %cond.store
147 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
148 ; AVX512F-NEXT: .LBB2_2: # %else
149 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
150 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
151 ; AVX512F-NEXT: kmovw %k0, %eax
152 ; AVX512F-NEXT: testb $1, %al
153 ; AVX512F-NEXT: je .LBB2_4
154 ; AVX512F-NEXT: # %bb.3: # %cond.store1
155 ; AVX512F-NEXT: vpextrb $2, %xmm0, 1(%rdi)
156 ; AVX512F-NEXT: .LBB2_4: # %else2
157 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
158 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
159 ; AVX512F-NEXT: kmovw %k0, %eax
160 ; AVX512F-NEXT: testb $1, %al
161 ; AVX512F-NEXT: je .LBB2_6
162 ; AVX512F-NEXT: # %bb.5: # %cond.store3
163 ; AVX512F-NEXT: vpextrb $4, %xmm0, 2(%rdi)
164 ; AVX512F-NEXT: .LBB2_6: # %else4
165 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
166 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
167 ; AVX512F-NEXT: kmovw %k0, %eax
168 ; AVX512F-NEXT: testb $1, %al
169 ; AVX512F-NEXT: je .LBB2_8
170 ; AVX512F-NEXT: # %bb.7: # %cond.store5
171 ; AVX512F-NEXT: vpextrb $6, %xmm0, 3(%rdi)
172 ; AVX512F-NEXT: .LBB2_8: # %else6
173 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
174 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
175 ; AVX512F-NEXT: kmovw %k0, %eax
176 ; AVX512F-NEXT: testb $1, %al
177 ; AVX512F-NEXT: je .LBB2_10
178 ; AVX512F-NEXT: # %bb.9: # %cond.store7
179 ; AVX512F-NEXT: vpextrb $8, %xmm0, 4(%rdi)
180 ; AVX512F-NEXT: .LBB2_10: # %else8
181 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
182 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
183 ; AVX512F-NEXT: kmovw %k0, %eax
184 ; AVX512F-NEXT: testb $1, %al
185 ; AVX512F-NEXT: je .LBB2_12
186 ; AVX512F-NEXT: # %bb.11: # %cond.store9
187 ; AVX512F-NEXT: vpextrb $10, %xmm0, 5(%rdi)
188 ; AVX512F-NEXT: .LBB2_12: # %else10
189 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
190 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
191 ; AVX512F-NEXT: kmovw %k0, %eax
192 ; AVX512F-NEXT: testb $1, %al
193 ; AVX512F-NEXT: je .LBB2_14
194 ; AVX512F-NEXT: # %bb.13: # %cond.store11
195 ; AVX512F-NEXT: vpextrb $12, %xmm0, 6(%rdi)
196 ; AVX512F-NEXT: .LBB2_14: # %else12
197 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
198 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
199 ; AVX512F-NEXT: kmovw %k0, %eax
200 ; AVX512F-NEXT: testb $1, %al
201 ; AVX512F-NEXT: je .LBB2_16
202 ; AVX512F-NEXT: # %bb.15: # %cond.store13
203 ; AVX512F-NEXT: vpextrb $14, %xmm0, 7(%rdi)
204 ; AVX512F-NEXT: .LBB2_16: # %else14
205 ; AVX512F-NEXT: vzeroupper
208 ; AVX512BW-LABEL: truncstore_v8i64_v8i8:
210 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
211 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k1
212 ; AVX512BW-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
213 ; AVX512BW-NEXT: vpmovqb %zmm0, (%rdi) {%k1}
214 ; AVX512BW-NEXT: vzeroupper
215 ; AVX512BW-NEXT: retq
217 ; AVX512BWVL-LABEL: truncstore_v8i64_v8i8:
218 ; AVX512BWVL: # %bb.0:
219 ; AVX512BWVL-NEXT: vptestmd %ymm1, %ymm1, %k1
220 ; AVX512BWVL-NEXT: vpminuq {{.*}}(%rip){1to8}, %zmm0, %zmm0
221 ; AVX512BWVL-NEXT: vpmovqb %zmm0, (%rdi) {%k1}
222 ; AVX512BWVL-NEXT: vzeroupper
223 ; AVX512BWVL-NEXT: retq
224 %a = icmp ne <8 x i32> %mask, zeroinitializer
225 %b = icmp ult <8 x i64> %x, <i64 255, i64 255, i64 255, i64 255, i64 255, i64 255, i64 255, i64 255>
226 %c = select <8 x i1> %b, <8 x i64> %x, <8 x i64> <i64 255, i64 255, i64 255, i64 255, i64 255, i64 255, i64 255, i64 255>
227 %d = trunc <8 x i64> %c to <8 x i8>
228 call void @llvm.masked.store.v8i8.p0v8i8(<8 x i8> %d, <8 x i8>* %p, i32 1, <8 x i1> %a)
232 define void @truncstore_v4i64_v4i32(<4 x i64> %x, <4 x i32>* %p, <4 x i32> %mask) {
233 ; AVX512F-LABEL: truncstore_v4i64_v4i32:
235 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
236 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
237 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
238 ; AVX512F-NEXT: kshiftlw $12, %k0, %k0
239 ; AVX512F-NEXT: kshiftrw $12, %k0, %k1
240 ; AVX512F-NEXT: vpbroadcastq {{.*#+}} ymm1 = [4294967295,4294967295,4294967295,4294967295]
241 ; AVX512F-NEXT: vpminuq %zmm1, %zmm0, %zmm0
242 ; AVX512F-NEXT: vpmovqd %zmm0, %ymm0
243 ; AVX512F-NEXT: vmovdqu32 %zmm0, (%rdi) {%k1}
244 ; AVX512F-NEXT: vzeroupper
247 ; AVX512VL-LABEL: truncstore_v4i64_v4i32:
249 ; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k1
250 ; AVX512VL-NEXT: vpminuq {{.*}}(%rip){1to4}, %ymm0, %ymm0
251 ; AVX512VL-NEXT: vpmovqd %ymm0, (%rdi) {%k1}
252 ; AVX512VL-NEXT: vzeroupper
253 ; AVX512VL-NEXT: retq
255 ; AVX512BW-LABEL: truncstore_v4i64_v4i32:
257 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
258 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
259 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k0
260 ; AVX512BW-NEXT: kshiftlw $12, %k0, %k0
261 ; AVX512BW-NEXT: kshiftrw $12, %k0, %k1
262 ; AVX512BW-NEXT: vpbroadcastq {{.*#+}} ymm1 = [4294967295,4294967295,4294967295,4294967295]
263 ; AVX512BW-NEXT: vpminuq %zmm1, %zmm0, %zmm0
264 ; AVX512BW-NEXT: vpmovqd %zmm0, %ymm0
265 ; AVX512BW-NEXT: vmovdqu32 %zmm0, (%rdi) {%k1}
266 ; AVX512BW-NEXT: vzeroupper
267 ; AVX512BW-NEXT: retq
268 %a = icmp ne <4 x i32> %mask, zeroinitializer
269 %b = icmp ult <4 x i64> %x, <i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295>
270 %c = select <4 x i1> %b, <4 x i64> %x, <4 x i64> <i64 4294967295, i64 4294967295, i64 4294967295, i64 4294967295>
271 %d = trunc <4 x i64> %c to <4 x i32>
272 call void @llvm.masked.store.v4i32.p0v4i32(<4 x i32> %d, <4 x i32>* %p, i32 1, <4 x i1> %a)
276 define void @truncstore_v4i64_v4i16(<4 x i64> %x, <4 x i16>* %p, <4 x i32> %mask) {
277 ; AVX512F-LABEL: truncstore_v4i64_v4i16:
279 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
280 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
281 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
282 ; AVX512F-NEXT: vpbroadcastq {{.*#+}} ymm2 = [65535,65535,65535,65535]
283 ; AVX512F-NEXT: vpminuq %zmm2, %zmm0, %zmm0
284 ; AVX512F-NEXT: vpmovqd %zmm0, %ymm0
285 ; AVX512F-NEXT: kmovw %k0, %eax
286 ; AVX512F-NEXT: testb $1, %al
287 ; AVX512F-NEXT: je .LBB4_2
288 ; AVX512F-NEXT: # %bb.1: # %cond.store
289 ; AVX512F-NEXT: vpextrw $0, %xmm0, (%rdi)
290 ; AVX512F-NEXT: .LBB4_2: # %else
291 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
292 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
293 ; AVX512F-NEXT: kmovw %k0, %eax
294 ; AVX512F-NEXT: testb $1, %al
295 ; AVX512F-NEXT: je .LBB4_4
296 ; AVX512F-NEXT: # %bb.3: # %cond.store1
297 ; AVX512F-NEXT: vpextrw $2, %xmm0, 2(%rdi)
298 ; AVX512F-NEXT: .LBB4_4: # %else2
299 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
300 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
301 ; AVX512F-NEXT: kmovw %k0, %eax
302 ; AVX512F-NEXT: testb $1, %al
303 ; AVX512F-NEXT: je .LBB4_6
304 ; AVX512F-NEXT: # %bb.5: # %cond.store3
305 ; AVX512F-NEXT: vpextrw $4, %xmm0, 4(%rdi)
306 ; AVX512F-NEXT: .LBB4_6: # %else4
307 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
308 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
309 ; AVX512F-NEXT: kmovw %k0, %eax
310 ; AVX512F-NEXT: testb $1, %al
311 ; AVX512F-NEXT: je .LBB4_8
312 ; AVX512F-NEXT: # %bb.7: # %cond.store5
313 ; AVX512F-NEXT: vpextrw $6, %xmm0, 6(%rdi)
314 ; AVX512F-NEXT: .LBB4_8: # %else6
315 ; AVX512F-NEXT: vzeroupper
318 ; AVX512BW-LABEL: truncstore_v4i64_v4i16:
320 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
321 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
322 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k0
323 ; AVX512BW-NEXT: vpbroadcastq {{.*#+}} ymm1 = [65535,65535,65535,65535]
324 ; AVX512BW-NEXT: vpminuq %zmm1, %zmm0, %zmm0
325 ; AVX512BW-NEXT: vpmovqd %zmm0, %ymm0
326 ; AVX512BW-NEXT: vpackusdw %xmm0, %xmm0, %xmm0
327 ; AVX512BW-NEXT: kshiftld $28, %k0, %k0
328 ; AVX512BW-NEXT: kshiftrd $28, %k0, %k1
329 ; AVX512BW-NEXT: vmovdqu16 %zmm0, (%rdi) {%k1}
330 ; AVX512BW-NEXT: vzeroupper
331 ; AVX512BW-NEXT: retq
333 ; AVX512BWVL-LABEL: truncstore_v4i64_v4i16:
334 ; AVX512BWVL: # %bb.0:
335 ; AVX512BWVL-NEXT: vptestmd %xmm1, %xmm1, %k1
336 ; AVX512BWVL-NEXT: vpminuq {{.*}}(%rip){1to4}, %ymm0, %ymm0
337 ; AVX512BWVL-NEXT: vpmovqw %ymm0, (%rdi) {%k1}
338 ; AVX512BWVL-NEXT: vzeroupper
339 ; AVX512BWVL-NEXT: retq
340 %a = icmp ne <4 x i32> %mask, zeroinitializer
341 %b = icmp ult <4 x i64> %x, <i64 65535, i64 65535, i64 65535, i64 65535>
342 %c = select <4 x i1> %b, <4 x i64> %x, <4 x i64> <i64 65535, i64 65535, i64 65535, i64 65535>
343 %d = trunc <4 x i64> %c to <4 x i16>
344 call void @llvm.masked.store.v4i16.p0v4i16(<4 x i16> %d, <4 x i16>* %p, i32 1, <4 x i1> %a)
348 define void @truncstore_v4i64_v4i8(<4 x i64> %x, <4 x i8>* %p, <4 x i32> %mask) {
349 ; AVX512F-LABEL: truncstore_v4i64_v4i8:
351 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
352 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
353 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
354 ; AVX512F-NEXT: vpbroadcastq {{.*#+}} ymm2 = [255,255,255,255]
355 ; AVX512F-NEXT: vpminuq %zmm2, %zmm0, %zmm0
356 ; AVX512F-NEXT: vpmovqd %zmm0, %ymm0
357 ; AVX512F-NEXT: kmovw %k0, %eax
358 ; AVX512F-NEXT: testb $1, %al
359 ; AVX512F-NEXT: je .LBB5_2
360 ; AVX512F-NEXT: # %bb.1: # %cond.store
361 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
362 ; AVX512F-NEXT: .LBB5_2: # %else
363 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
364 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
365 ; AVX512F-NEXT: kmovw %k0, %eax
366 ; AVX512F-NEXT: testb $1, %al
367 ; AVX512F-NEXT: je .LBB5_4
368 ; AVX512F-NEXT: # %bb.3: # %cond.store1
369 ; AVX512F-NEXT: vpextrb $4, %xmm0, 1(%rdi)
370 ; AVX512F-NEXT: .LBB5_4: # %else2
371 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
372 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
373 ; AVX512F-NEXT: kmovw %k0, %eax
374 ; AVX512F-NEXT: testb $1, %al
375 ; AVX512F-NEXT: je .LBB5_6
376 ; AVX512F-NEXT: # %bb.5: # %cond.store3
377 ; AVX512F-NEXT: vpextrb $8, %xmm0, 2(%rdi)
378 ; AVX512F-NEXT: .LBB5_6: # %else4
379 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
380 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
381 ; AVX512F-NEXT: kmovw %k0, %eax
382 ; AVX512F-NEXT: testb $1, %al
383 ; AVX512F-NEXT: je .LBB5_8
384 ; AVX512F-NEXT: # %bb.7: # %cond.store5
385 ; AVX512F-NEXT: vpextrb $12, %xmm0, 3(%rdi)
386 ; AVX512F-NEXT: .LBB5_8: # %else6
387 ; AVX512F-NEXT: vzeroupper
390 ; AVX512BW-LABEL: truncstore_v4i64_v4i8:
392 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
393 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
394 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k0
395 ; AVX512BW-NEXT: vpbroadcastq {{.*#+}} ymm1 = [255,255,255,255]
396 ; AVX512BW-NEXT: vpminuq %zmm1, %zmm0, %zmm0
397 ; AVX512BW-NEXT: vpmovqd %zmm0, %ymm0
398 ; AVX512BW-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]
399 ; AVX512BW-NEXT: kshiftlq $60, %k0, %k0
400 ; AVX512BW-NEXT: kshiftrq $60, %k0, %k1
401 ; AVX512BW-NEXT: vmovdqu8 %zmm0, (%rdi) {%k1}
402 ; AVX512BW-NEXT: vzeroupper
403 ; AVX512BW-NEXT: retq
405 ; AVX512BWVL-LABEL: truncstore_v4i64_v4i8:
406 ; AVX512BWVL: # %bb.0:
407 ; AVX512BWVL-NEXT: vptestmd %xmm1, %xmm1, %k1
408 ; AVX512BWVL-NEXT: vpminuq {{.*}}(%rip){1to4}, %ymm0, %ymm0
409 ; AVX512BWVL-NEXT: vpmovqb %ymm0, (%rdi) {%k1}
410 ; AVX512BWVL-NEXT: vzeroupper
411 ; AVX512BWVL-NEXT: retq
412 %a = icmp ne <4 x i32> %mask, zeroinitializer
413 %b = icmp ult <4 x i64> %x, <i64 255, i64 255, i64 255, i64 255>
414 %c = select <4 x i1> %b, <4 x i64> %x, <4 x i64> <i64 255, i64 255, i64 255, i64 255>
415 %d = trunc <4 x i64> %c to <4 x i8>
416 call void @llvm.masked.store.v4i8.p0v4i8(<4 x i8> %d, <4 x i8>* %p, i32 1, <4 x i1> %a)
420 define void @truncstore_v2i64_v2i32(<2 x i64> %x, <2 x i32>* %p, <2 x i64> %mask) {
421 ; AVX512F-LABEL: truncstore_v2i64_v2i32:
423 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
424 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
425 ; AVX512F-NEXT: vptestmq %zmm1, %zmm1, %k0
426 ; AVX512F-NEXT: vmovdqa {{.*#+}} xmm1 = [4294967295,4294967295]
427 ; AVX512F-NEXT: vpminuq %zmm1, %zmm0, %zmm0
428 ; AVX512F-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
429 ; AVX512F-NEXT: kshiftlw $14, %k0, %k0
430 ; AVX512F-NEXT: kshiftrw $14, %k0, %k1
431 ; AVX512F-NEXT: vmovdqu32 %zmm0, (%rdi) {%k1}
432 ; AVX512F-NEXT: vzeroupper
435 ; AVX512VL-LABEL: truncstore_v2i64_v2i32:
437 ; AVX512VL-NEXT: vptestmq %xmm1, %xmm1, %k1
438 ; AVX512VL-NEXT: vpminuq {{.*}}(%rip), %xmm0, %xmm0
439 ; AVX512VL-NEXT: vpmovqd %xmm0, (%rdi) {%k1}
440 ; AVX512VL-NEXT: retq
442 ; AVX512BW-LABEL: truncstore_v2i64_v2i32:
444 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
445 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
446 ; AVX512BW-NEXT: vptestmq %zmm1, %zmm1, %k0
447 ; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = [4294967295,4294967295]
448 ; AVX512BW-NEXT: vpminuq %zmm1, %zmm0, %zmm0
449 ; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
450 ; AVX512BW-NEXT: kshiftlw $14, %k0, %k0
451 ; AVX512BW-NEXT: kshiftrw $14, %k0, %k1
452 ; AVX512BW-NEXT: vmovdqu32 %zmm0, (%rdi) {%k1}
453 ; AVX512BW-NEXT: vzeroupper
454 ; AVX512BW-NEXT: retq
455 %a = icmp ne <2 x i64> %mask, zeroinitializer
456 %b = icmp ult <2 x i64> %x, <i64 4294967295, i64 4294967295>
457 %c = select <2 x i1> %b, <2 x i64> %x, <2 x i64> <i64 4294967295, i64 4294967295>
458 %d = trunc <2 x i64> %c to <2 x i32>
459 call void @llvm.masked.store.v2i32.p0v2i32(<2 x i32> %d, <2 x i32>* %p, i32 1, <2 x i1> %a)
463 define void @truncstore_v2i64_v2i16(<2 x i64> %x, <2 x i16>* %p, <2 x i64> %mask) {
464 ; AVX512F-LABEL: truncstore_v2i64_v2i16:
466 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
467 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
468 ; AVX512F-NEXT: vptestmq %zmm1, %zmm1, %k0
469 ; AVX512F-NEXT: vmovdqa {{.*#+}} xmm2 = [65535,65535]
470 ; AVX512F-NEXT: vpminuq %zmm2, %zmm0, %zmm0
471 ; AVX512F-NEXT: kmovw %k0, %eax
472 ; AVX512F-NEXT: testb $1, %al
473 ; AVX512F-NEXT: je .LBB7_2
474 ; AVX512F-NEXT: # %bb.1: # %cond.store
475 ; AVX512F-NEXT: vpextrw $0, %xmm0, (%rdi)
476 ; AVX512F-NEXT: .LBB7_2: # %else
477 ; AVX512F-NEXT: vptestmq %zmm1, %zmm1, %k0
478 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
479 ; AVX512F-NEXT: kmovw %k0, %eax
480 ; AVX512F-NEXT: testb $1, %al
481 ; AVX512F-NEXT: je .LBB7_4
482 ; AVX512F-NEXT: # %bb.3: # %cond.store1
483 ; AVX512F-NEXT: vpextrw $4, %xmm0, 2(%rdi)
484 ; AVX512F-NEXT: .LBB7_4: # %else2
485 ; AVX512F-NEXT: vzeroupper
488 ; AVX512BW-LABEL: truncstore_v2i64_v2i16:
490 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
491 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
492 ; AVX512BW-NEXT: vptestmq %zmm1, %zmm1, %k0
493 ; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = [65535,65535]
494 ; AVX512BW-NEXT: vpminuq %zmm1, %zmm0, %zmm0
495 ; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
496 ; AVX512BW-NEXT: vpshuflw {{.*#+}} xmm0 = xmm0[0,2,2,3,4,5,6,7]
497 ; AVX512BW-NEXT: kshiftld $30, %k0, %k0
498 ; AVX512BW-NEXT: kshiftrd $30, %k0, %k1
499 ; AVX512BW-NEXT: vmovdqu16 %zmm0, (%rdi) {%k1}
500 ; AVX512BW-NEXT: vzeroupper
501 ; AVX512BW-NEXT: retq
503 ; AVX512BWVL-LABEL: truncstore_v2i64_v2i16:
504 ; AVX512BWVL: # %bb.0:
505 ; AVX512BWVL-NEXT: vptestmq %xmm1, %xmm1, %k1
506 ; AVX512BWVL-NEXT: vpminuq {{.*}}(%rip), %xmm0, %xmm0
507 ; AVX512BWVL-NEXT: vpmovqw %xmm0, (%rdi) {%k1}
508 ; AVX512BWVL-NEXT: retq
509 %a = icmp ne <2 x i64> %mask, zeroinitializer
510 %b = icmp ult <2 x i64> %x, <i64 65535, i64 65535>
511 %c = select <2 x i1> %b, <2 x i64> %x, <2 x i64> <i64 65535, i64 65535>
512 %d = trunc <2 x i64> %c to <2 x i16>
513 call void @llvm.masked.store.v2i16.p0v2i16(<2 x i16> %d, <2 x i16>* %p, i32 1, <2 x i1> %a)
517 define void @truncstore_v2i64_v2i8(<2 x i64> %x, <2 x i8>* %p, <2 x i64> %mask) {
518 ; AVX512F-LABEL: truncstore_v2i64_v2i8:
520 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
521 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
522 ; AVX512F-NEXT: vptestmq %zmm1, %zmm1, %k0
523 ; AVX512F-NEXT: vmovdqa {{.*#+}} xmm2 = [255,255]
524 ; AVX512F-NEXT: vpminuq %zmm2, %zmm0, %zmm0
525 ; AVX512F-NEXT: kmovw %k0, %eax
526 ; AVX512F-NEXT: testb $1, %al
527 ; AVX512F-NEXT: je .LBB8_2
528 ; AVX512F-NEXT: # %bb.1: # %cond.store
529 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
530 ; AVX512F-NEXT: .LBB8_2: # %else
531 ; AVX512F-NEXT: vptestmq %zmm1, %zmm1, %k0
532 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
533 ; AVX512F-NEXT: kmovw %k0, %eax
534 ; AVX512F-NEXT: testb $1, %al
535 ; AVX512F-NEXT: je .LBB8_4
536 ; AVX512F-NEXT: # %bb.3: # %cond.store1
537 ; AVX512F-NEXT: vpextrb $8, %xmm0, 1(%rdi)
538 ; AVX512F-NEXT: .LBB8_4: # %else2
539 ; AVX512F-NEXT: vzeroupper
542 ; AVX512BW-LABEL: truncstore_v2i64_v2i8:
544 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
545 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
546 ; AVX512BW-NEXT: vptestmq %zmm1, %zmm1, %k0
547 ; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = [255,255]
548 ; AVX512BW-NEXT: vpminuq %zmm1, %zmm0, %zmm0
549 ; AVX512BW-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,8,u,u,u,u,u,u,u,u,u,u,u,u,u,u]
550 ; AVX512BW-NEXT: kshiftlq $62, %k0, %k0
551 ; AVX512BW-NEXT: kshiftrq $62, %k0, %k1
552 ; AVX512BW-NEXT: vmovdqu8 %zmm0, (%rdi) {%k1}
553 ; AVX512BW-NEXT: vzeroupper
554 ; AVX512BW-NEXT: retq
556 ; AVX512BWVL-LABEL: truncstore_v2i64_v2i8:
557 ; AVX512BWVL: # %bb.0:
558 ; AVX512BWVL-NEXT: vptestmq %xmm1, %xmm1, %k1
559 ; AVX512BWVL-NEXT: vpminuq {{.*}}(%rip), %xmm0, %xmm0
560 ; AVX512BWVL-NEXT: vpmovqb %xmm0, (%rdi) {%k1}
561 ; AVX512BWVL-NEXT: retq
562 %a = icmp ne <2 x i64> %mask, zeroinitializer
563 %b = icmp ult <2 x i64> %x, <i64 255, i64 255>
564 %c = select <2 x i1> %b, <2 x i64> %x, <2 x i64> <i64 255, i64 255>
565 %d = trunc <2 x i64> %c to <2 x i8>
566 call void @llvm.masked.store.v2i8.p0v2i8(<2 x i8> %d, <2 x i8>* %p, i32 1, <2 x i1> %a)
570 define void @truncstore_v16i32_v16i16(<16 x i32> %x, <16 x i16>* %p, <16 x i32> %mask) {
571 ; AVX512F-LABEL: truncstore_v16i32_v16i16:
573 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
574 ; AVX512F-NEXT: vpmovusdw %zmm0, %ymm0
575 ; AVX512F-NEXT: kmovw %k0, %eax
576 ; AVX512F-NEXT: testb $1, %al
577 ; AVX512F-NEXT: je .LBB9_2
578 ; AVX512F-NEXT: # %bb.1: # %cond.store
579 ; AVX512F-NEXT: vpextrw $0, %xmm0, (%rdi)
580 ; AVX512F-NEXT: .LBB9_2: # %else
581 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
582 ; AVX512F-NEXT: kmovw %k1, %eax
583 ; AVX512F-NEXT: testb $1, %al
584 ; AVX512F-NEXT: je .LBB9_4
585 ; AVX512F-NEXT: # %bb.3: # %cond.store1
586 ; AVX512F-NEXT: vpextrw $1, %xmm0, 2(%rdi)
587 ; AVX512F-NEXT: .LBB9_4: # %else2
588 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
589 ; AVX512F-NEXT: kmovw %k1, %eax
590 ; AVX512F-NEXT: testb $1, %al
591 ; AVX512F-NEXT: je .LBB9_6
592 ; AVX512F-NEXT: # %bb.5: # %cond.store3
593 ; AVX512F-NEXT: vpextrw $2, %xmm0, 4(%rdi)
594 ; AVX512F-NEXT: .LBB9_6: # %else4
595 ; AVX512F-NEXT: kshiftrw $3, %k0, %k1
596 ; AVX512F-NEXT: kmovw %k1, %eax
597 ; AVX512F-NEXT: testb $1, %al
598 ; AVX512F-NEXT: je .LBB9_8
599 ; AVX512F-NEXT: # %bb.7: # %cond.store5
600 ; AVX512F-NEXT: vpextrw $3, %xmm0, 6(%rdi)
601 ; AVX512F-NEXT: .LBB9_8: # %else6
602 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
603 ; AVX512F-NEXT: kmovw %k1, %eax
604 ; AVX512F-NEXT: testb $1, %al
605 ; AVX512F-NEXT: je .LBB9_10
606 ; AVX512F-NEXT: # %bb.9: # %cond.store7
607 ; AVX512F-NEXT: vpextrw $4, %xmm0, 8(%rdi)
608 ; AVX512F-NEXT: .LBB9_10: # %else8
609 ; AVX512F-NEXT: kshiftrw $5, %k0, %k1
610 ; AVX512F-NEXT: kmovw %k1, %eax
611 ; AVX512F-NEXT: testb $1, %al
612 ; AVX512F-NEXT: je .LBB9_12
613 ; AVX512F-NEXT: # %bb.11: # %cond.store9
614 ; AVX512F-NEXT: vpextrw $5, %xmm0, 10(%rdi)
615 ; AVX512F-NEXT: .LBB9_12: # %else10
616 ; AVX512F-NEXT: kshiftrw $6, %k0, %k1
617 ; AVX512F-NEXT: kmovw %k1, %eax
618 ; AVX512F-NEXT: testb $1, %al
619 ; AVX512F-NEXT: je .LBB9_14
620 ; AVX512F-NEXT: # %bb.13: # %cond.store11
621 ; AVX512F-NEXT: vpextrw $6, %xmm0, 12(%rdi)
622 ; AVX512F-NEXT: .LBB9_14: # %else12
623 ; AVX512F-NEXT: kshiftrw $7, %k0, %k1
624 ; AVX512F-NEXT: kmovw %k1, %eax
625 ; AVX512F-NEXT: testb $1, %al
626 ; AVX512F-NEXT: je .LBB9_16
627 ; AVX512F-NEXT: # %bb.15: # %cond.store13
628 ; AVX512F-NEXT: vpextrw $7, %xmm0, 14(%rdi)
629 ; AVX512F-NEXT: .LBB9_16: # %else14
630 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
631 ; AVX512F-NEXT: kmovw %k1, %eax
632 ; AVX512F-NEXT: testb $1, %al
633 ; AVX512F-NEXT: je .LBB9_18
634 ; AVX512F-NEXT: # %bb.17: # %cond.store15
635 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
636 ; AVX512F-NEXT: vpextrw $0, %xmm1, 16(%rdi)
637 ; AVX512F-NEXT: .LBB9_18: # %else16
638 ; AVX512F-NEXT: kshiftrw $9, %k0, %k1
639 ; AVX512F-NEXT: kmovw %k1, %eax
640 ; AVX512F-NEXT: testb $1, %al
641 ; AVX512F-NEXT: je .LBB9_20
642 ; AVX512F-NEXT: # %bb.19: # %cond.store17
643 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
644 ; AVX512F-NEXT: vpextrw $1, %xmm1, 18(%rdi)
645 ; AVX512F-NEXT: .LBB9_20: # %else18
646 ; AVX512F-NEXT: kshiftrw $10, %k0, %k1
647 ; AVX512F-NEXT: kmovw %k1, %eax
648 ; AVX512F-NEXT: testb $1, %al
649 ; AVX512F-NEXT: je .LBB9_22
650 ; AVX512F-NEXT: # %bb.21: # %cond.store19
651 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
652 ; AVX512F-NEXT: vpextrw $2, %xmm1, 20(%rdi)
653 ; AVX512F-NEXT: .LBB9_22: # %else20
654 ; AVX512F-NEXT: kshiftrw $11, %k0, %k1
655 ; AVX512F-NEXT: kmovw %k1, %eax
656 ; AVX512F-NEXT: testb $1, %al
657 ; AVX512F-NEXT: je .LBB9_24
658 ; AVX512F-NEXT: # %bb.23: # %cond.store21
659 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
660 ; AVX512F-NEXT: vpextrw $3, %xmm1, 22(%rdi)
661 ; AVX512F-NEXT: .LBB9_24: # %else22
662 ; AVX512F-NEXT: kshiftrw $12, %k0, %k1
663 ; AVX512F-NEXT: kmovw %k1, %eax
664 ; AVX512F-NEXT: testb $1, %al
665 ; AVX512F-NEXT: je .LBB9_26
666 ; AVX512F-NEXT: # %bb.25: # %cond.store23
667 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
668 ; AVX512F-NEXT: vpextrw $4, %xmm1, 24(%rdi)
669 ; AVX512F-NEXT: .LBB9_26: # %else24
670 ; AVX512F-NEXT: kshiftrw $13, %k0, %k1
671 ; AVX512F-NEXT: kmovw %k1, %eax
672 ; AVX512F-NEXT: testb $1, %al
673 ; AVX512F-NEXT: je .LBB9_28
674 ; AVX512F-NEXT: # %bb.27: # %cond.store25
675 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
676 ; AVX512F-NEXT: vpextrw $5, %xmm1, 26(%rdi)
677 ; AVX512F-NEXT: .LBB9_28: # %else26
678 ; AVX512F-NEXT: kshiftrw $14, %k0, %k1
679 ; AVX512F-NEXT: kmovw %k1, %eax
680 ; AVX512F-NEXT: testb $1, %al
681 ; AVX512F-NEXT: je .LBB9_30
682 ; AVX512F-NEXT: # %bb.29: # %cond.store27
683 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
684 ; AVX512F-NEXT: vpextrw $6, %xmm1, 28(%rdi)
685 ; AVX512F-NEXT: .LBB9_30: # %else28
686 ; AVX512F-NEXT: kshiftrw $15, %k0, %k0
687 ; AVX512F-NEXT: kmovw %k0, %eax
688 ; AVX512F-NEXT: testb $1, %al
689 ; AVX512F-NEXT: je .LBB9_32
690 ; AVX512F-NEXT: # %bb.31: # %cond.store29
691 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm0
692 ; AVX512F-NEXT: vpextrw $7, %xmm0, 30(%rdi)
693 ; AVX512F-NEXT: .LBB9_32: # %else30
694 ; AVX512F-NEXT: vzeroupper
697 ; AVX512BW-LABEL: truncstore_v16i32_v16i16:
699 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k1
700 ; AVX512BW-NEXT: vpminud {{.*}}(%rip){1to16}, %zmm0, %zmm0
701 ; AVX512BW-NEXT: vpmovdw %zmm0, (%rdi) {%k1}
702 ; AVX512BW-NEXT: vzeroupper
703 ; AVX512BW-NEXT: retq
705 ; AVX512BWVL-LABEL: truncstore_v16i32_v16i16:
706 ; AVX512BWVL: # %bb.0:
707 ; AVX512BWVL-NEXT: vptestmd %zmm1, %zmm1, %k1
708 ; AVX512BWVL-NEXT: vpminud {{.*}}(%rip){1to16}, %zmm0, %zmm0
709 ; AVX512BWVL-NEXT: vpmovdw %zmm0, (%rdi) {%k1}
710 ; AVX512BWVL-NEXT: vzeroupper
711 ; AVX512BWVL-NEXT: retq
712 %a = icmp ne <16 x i32> %mask, zeroinitializer
713 %b = icmp ult <16 x i32> %x, <i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535>
714 %c = select <16 x i1> %b, <16 x i32> %x, <16 x i32> <i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535>
715 %d = trunc <16 x i32> %c to <16 x i16>
716 call void @llvm.masked.store.v16i16.p0v16i16(<16 x i16> %d, <16 x i16>* %p, i32 1, <16 x i1> %a)
720 define void @truncstore_v16i32_v16i8(<16 x i32> %x, <16 x i8>* %p, <16 x i32> %mask) {
721 ; AVX512F-LABEL: truncstore_v16i32_v16i8:
723 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
724 ; AVX512F-NEXT: vpmovusdb %zmm0, %xmm0
725 ; AVX512F-NEXT: kmovw %k0, %eax
726 ; AVX512F-NEXT: testb $1, %al
727 ; AVX512F-NEXT: je .LBB10_2
728 ; AVX512F-NEXT: # %bb.1: # %cond.store
729 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
730 ; AVX512F-NEXT: .LBB10_2: # %else
731 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
732 ; AVX512F-NEXT: kmovw %k1, %eax
733 ; AVX512F-NEXT: testb $1, %al
734 ; AVX512F-NEXT: je .LBB10_4
735 ; AVX512F-NEXT: # %bb.3: # %cond.store1
736 ; AVX512F-NEXT: vpextrb $1, %xmm0, 1(%rdi)
737 ; AVX512F-NEXT: .LBB10_4: # %else2
738 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
739 ; AVX512F-NEXT: kmovw %k1, %eax
740 ; AVX512F-NEXT: testb $1, %al
741 ; AVX512F-NEXT: je .LBB10_6
742 ; AVX512F-NEXT: # %bb.5: # %cond.store3
743 ; AVX512F-NEXT: vpextrb $2, %xmm0, 2(%rdi)
744 ; AVX512F-NEXT: .LBB10_6: # %else4
745 ; AVX512F-NEXT: kshiftrw $3, %k0, %k1
746 ; AVX512F-NEXT: kmovw %k1, %eax
747 ; AVX512F-NEXT: testb $1, %al
748 ; AVX512F-NEXT: je .LBB10_8
749 ; AVX512F-NEXT: # %bb.7: # %cond.store5
750 ; AVX512F-NEXT: vpextrb $3, %xmm0, 3(%rdi)
751 ; AVX512F-NEXT: .LBB10_8: # %else6
752 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
753 ; AVX512F-NEXT: kmovw %k1, %eax
754 ; AVX512F-NEXT: testb $1, %al
755 ; AVX512F-NEXT: je .LBB10_10
756 ; AVX512F-NEXT: # %bb.9: # %cond.store7
757 ; AVX512F-NEXT: vpextrb $4, %xmm0, 4(%rdi)
758 ; AVX512F-NEXT: .LBB10_10: # %else8
759 ; AVX512F-NEXT: kshiftrw $5, %k0, %k1
760 ; AVX512F-NEXT: kmovw %k1, %eax
761 ; AVX512F-NEXT: testb $1, %al
762 ; AVX512F-NEXT: je .LBB10_12
763 ; AVX512F-NEXT: # %bb.11: # %cond.store9
764 ; AVX512F-NEXT: vpextrb $5, %xmm0, 5(%rdi)
765 ; AVX512F-NEXT: .LBB10_12: # %else10
766 ; AVX512F-NEXT: kshiftrw $6, %k0, %k1
767 ; AVX512F-NEXT: kmovw %k1, %eax
768 ; AVX512F-NEXT: testb $1, %al
769 ; AVX512F-NEXT: je .LBB10_14
770 ; AVX512F-NEXT: # %bb.13: # %cond.store11
771 ; AVX512F-NEXT: vpextrb $6, %xmm0, 6(%rdi)
772 ; AVX512F-NEXT: .LBB10_14: # %else12
773 ; AVX512F-NEXT: kshiftrw $7, %k0, %k1
774 ; AVX512F-NEXT: kmovw %k1, %eax
775 ; AVX512F-NEXT: testb $1, %al
776 ; AVX512F-NEXT: je .LBB10_16
777 ; AVX512F-NEXT: # %bb.15: # %cond.store13
778 ; AVX512F-NEXT: vpextrb $7, %xmm0, 7(%rdi)
779 ; AVX512F-NEXT: .LBB10_16: # %else14
780 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
781 ; AVX512F-NEXT: kmovw %k1, %eax
782 ; AVX512F-NEXT: testb $1, %al
783 ; AVX512F-NEXT: je .LBB10_18
784 ; AVX512F-NEXT: # %bb.17: # %cond.store15
785 ; AVX512F-NEXT: vpextrb $8, %xmm0, 8(%rdi)
786 ; AVX512F-NEXT: .LBB10_18: # %else16
787 ; AVX512F-NEXT: kshiftrw $9, %k0, %k1
788 ; AVX512F-NEXT: kmovw %k1, %eax
789 ; AVX512F-NEXT: testb $1, %al
790 ; AVX512F-NEXT: je .LBB10_20
791 ; AVX512F-NEXT: # %bb.19: # %cond.store17
792 ; AVX512F-NEXT: vpextrb $9, %xmm0, 9(%rdi)
793 ; AVX512F-NEXT: .LBB10_20: # %else18
794 ; AVX512F-NEXT: kshiftrw $10, %k0, %k1
795 ; AVX512F-NEXT: kmovw %k1, %eax
796 ; AVX512F-NEXT: testb $1, %al
797 ; AVX512F-NEXT: je .LBB10_22
798 ; AVX512F-NEXT: # %bb.21: # %cond.store19
799 ; AVX512F-NEXT: vpextrb $10, %xmm0, 10(%rdi)
800 ; AVX512F-NEXT: .LBB10_22: # %else20
801 ; AVX512F-NEXT: kshiftrw $11, %k0, %k1
802 ; AVX512F-NEXT: kmovw %k1, %eax
803 ; AVX512F-NEXT: testb $1, %al
804 ; AVX512F-NEXT: je .LBB10_24
805 ; AVX512F-NEXT: # %bb.23: # %cond.store21
806 ; AVX512F-NEXT: vpextrb $11, %xmm0, 11(%rdi)
807 ; AVX512F-NEXT: .LBB10_24: # %else22
808 ; AVX512F-NEXT: kshiftrw $12, %k0, %k1
809 ; AVX512F-NEXT: kmovw %k1, %eax
810 ; AVX512F-NEXT: testb $1, %al
811 ; AVX512F-NEXT: je .LBB10_26
812 ; AVX512F-NEXT: # %bb.25: # %cond.store23
813 ; AVX512F-NEXT: vpextrb $12, %xmm0, 12(%rdi)
814 ; AVX512F-NEXT: .LBB10_26: # %else24
815 ; AVX512F-NEXT: kshiftrw $13, %k0, %k1
816 ; AVX512F-NEXT: kmovw %k1, %eax
817 ; AVX512F-NEXT: testb $1, %al
818 ; AVX512F-NEXT: je .LBB10_28
819 ; AVX512F-NEXT: # %bb.27: # %cond.store25
820 ; AVX512F-NEXT: vpextrb $13, %xmm0, 13(%rdi)
821 ; AVX512F-NEXT: .LBB10_28: # %else26
822 ; AVX512F-NEXT: kshiftrw $14, %k0, %k1
823 ; AVX512F-NEXT: kmovw %k1, %eax
824 ; AVX512F-NEXT: testb $1, %al
825 ; AVX512F-NEXT: je .LBB10_30
826 ; AVX512F-NEXT: # %bb.29: # %cond.store27
827 ; AVX512F-NEXT: vpextrb $14, %xmm0, 14(%rdi)
828 ; AVX512F-NEXT: .LBB10_30: # %else28
829 ; AVX512F-NEXT: kshiftrw $15, %k0, %k0
830 ; AVX512F-NEXT: kmovw %k0, %eax
831 ; AVX512F-NEXT: testb $1, %al
832 ; AVX512F-NEXT: je .LBB10_32
833 ; AVX512F-NEXT: # %bb.31: # %cond.store29
834 ; AVX512F-NEXT: vpextrb $15, %xmm0, 15(%rdi)
835 ; AVX512F-NEXT: .LBB10_32: # %else30
836 ; AVX512F-NEXT: vzeroupper
839 ; AVX512BW-LABEL: truncstore_v16i32_v16i8:
841 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k1
842 ; AVX512BW-NEXT: vpminud {{.*}}(%rip){1to16}, %zmm0, %zmm0
843 ; AVX512BW-NEXT: vpmovdb %zmm0, (%rdi) {%k1}
844 ; AVX512BW-NEXT: vzeroupper
845 ; AVX512BW-NEXT: retq
847 ; AVX512BWVL-LABEL: truncstore_v16i32_v16i8:
848 ; AVX512BWVL: # %bb.0:
849 ; AVX512BWVL-NEXT: vptestmd %zmm1, %zmm1, %k1
850 ; AVX512BWVL-NEXT: vpminud {{.*}}(%rip){1to16}, %zmm0, %zmm0
851 ; AVX512BWVL-NEXT: vpmovdb %zmm0, (%rdi) {%k1}
852 ; AVX512BWVL-NEXT: vzeroupper
853 ; AVX512BWVL-NEXT: retq
854 %a = icmp ne <16 x i32> %mask, zeroinitializer
855 %b = icmp ult <16 x i32> %x, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
856 %c = select <16 x i1> %b, <16 x i32> %x, <16 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
857 %d = trunc <16 x i32> %c to <16 x i8>
858 call void @llvm.masked.store.v16i8.p0v16i8(<16 x i8> %d, <16 x i8>* %p, i32 1, <16 x i1> %a)
862 define void @truncstore_v8i32_v8i16(<8 x i32> %x, <8 x i16>* %p, <8 x i32> %mask) {
863 ; AVX512F-LABEL: truncstore_v8i32_v8i16:
865 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
866 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
867 ; AVX512F-NEXT: vpbroadcastd {{.*#+}} ymm2 = [65535,65535,65535,65535,65535,65535,65535,65535]
868 ; AVX512F-NEXT: vpminud %ymm2, %ymm0, %ymm0
869 ; AVX512F-NEXT: vpmovdw %zmm0, %ymm0
870 ; AVX512F-NEXT: kmovw %k0, %eax
871 ; AVX512F-NEXT: testb $1, %al
872 ; AVX512F-NEXT: je .LBB11_2
873 ; AVX512F-NEXT: # %bb.1: # %cond.store
874 ; AVX512F-NEXT: vpextrw $0, %xmm0, (%rdi)
875 ; AVX512F-NEXT: .LBB11_2: # %else
876 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
877 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
878 ; AVX512F-NEXT: kmovw %k0, %eax
879 ; AVX512F-NEXT: testb $1, %al
880 ; AVX512F-NEXT: je .LBB11_4
881 ; AVX512F-NEXT: # %bb.3: # %cond.store1
882 ; AVX512F-NEXT: vpextrw $1, %xmm0, 2(%rdi)
883 ; AVX512F-NEXT: .LBB11_4: # %else2
884 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
885 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
886 ; AVX512F-NEXT: kmovw %k0, %eax
887 ; AVX512F-NEXT: testb $1, %al
888 ; AVX512F-NEXT: je .LBB11_6
889 ; AVX512F-NEXT: # %bb.5: # %cond.store3
890 ; AVX512F-NEXT: vpextrw $2, %xmm0, 4(%rdi)
891 ; AVX512F-NEXT: .LBB11_6: # %else4
892 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
893 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
894 ; AVX512F-NEXT: kmovw %k0, %eax
895 ; AVX512F-NEXT: testb $1, %al
896 ; AVX512F-NEXT: je .LBB11_8
897 ; AVX512F-NEXT: # %bb.7: # %cond.store5
898 ; AVX512F-NEXT: vpextrw $3, %xmm0, 6(%rdi)
899 ; AVX512F-NEXT: .LBB11_8: # %else6
900 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
901 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
902 ; AVX512F-NEXT: kmovw %k0, %eax
903 ; AVX512F-NEXT: testb $1, %al
904 ; AVX512F-NEXT: je .LBB11_10
905 ; AVX512F-NEXT: # %bb.9: # %cond.store7
906 ; AVX512F-NEXT: vpextrw $4, %xmm0, 8(%rdi)
907 ; AVX512F-NEXT: .LBB11_10: # %else8
908 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
909 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
910 ; AVX512F-NEXT: kmovw %k0, %eax
911 ; AVX512F-NEXT: testb $1, %al
912 ; AVX512F-NEXT: je .LBB11_12
913 ; AVX512F-NEXT: # %bb.11: # %cond.store9
914 ; AVX512F-NEXT: vpextrw $5, %xmm0, 10(%rdi)
915 ; AVX512F-NEXT: .LBB11_12: # %else10
916 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
917 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
918 ; AVX512F-NEXT: kmovw %k0, %eax
919 ; AVX512F-NEXT: testb $1, %al
920 ; AVX512F-NEXT: je .LBB11_14
921 ; AVX512F-NEXT: # %bb.13: # %cond.store11
922 ; AVX512F-NEXT: vpextrw $6, %xmm0, 12(%rdi)
923 ; AVX512F-NEXT: .LBB11_14: # %else12
924 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
925 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
926 ; AVX512F-NEXT: kmovw %k0, %eax
927 ; AVX512F-NEXT: testb $1, %al
928 ; AVX512F-NEXT: je .LBB11_16
929 ; AVX512F-NEXT: # %bb.15: # %cond.store13
930 ; AVX512F-NEXT: vpextrw $7, %xmm0, 14(%rdi)
931 ; AVX512F-NEXT: .LBB11_16: # %else14
932 ; AVX512F-NEXT: vzeroupper
935 ; AVX512BW-LABEL: truncstore_v8i32_v8i16:
937 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
938 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k0
939 ; AVX512BW-NEXT: kshiftld $24, %k0, %k0
940 ; AVX512BW-NEXT: kshiftrd $24, %k0, %k1
941 ; AVX512BW-NEXT: vpbroadcastd {{.*#+}} ymm1 = [65535,65535,65535,65535,65535,65535,65535,65535]
942 ; AVX512BW-NEXT: vpminud %ymm1, %ymm0, %ymm0
943 ; AVX512BW-NEXT: vpmovdw %zmm0, %ymm0
944 ; AVX512BW-NEXT: vmovdqu16 %zmm0, (%rdi) {%k1}
945 ; AVX512BW-NEXT: vzeroupper
946 ; AVX512BW-NEXT: retq
948 ; AVX512BWVL-LABEL: truncstore_v8i32_v8i16:
949 ; AVX512BWVL: # %bb.0:
950 ; AVX512BWVL-NEXT: vptestmd %ymm1, %ymm1, %k1
951 ; AVX512BWVL-NEXT: vpminud {{.*}}(%rip){1to8}, %ymm0, %ymm0
952 ; AVX512BWVL-NEXT: vpmovdw %ymm0, (%rdi) {%k1}
953 ; AVX512BWVL-NEXT: vzeroupper
954 ; AVX512BWVL-NEXT: retq
955 %a = icmp ne <8 x i32> %mask, zeroinitializer
956 %b = icmp ult <8 x i32> %x, <i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535>
957 %c = select <8 x i1> %b, <8 x i32> %x, <8 x i32> <i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535, i32 65535>
958 %d = trunc <8 x i32> %c to <8 x i16>
959 call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %d, <8 x i16>* %p, i32 1, <8 x i1> %a)
963 define void @truncstore_v8i32_v8i8(<8 x i32> %x, <8 x i8>* %p, <8 x i32> %mask) {
964 ; AVX512F-LABEL: truncstore_v8i32_v8i8:
966 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
967 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
968 ; AVX512F-NEXT: vpbroadcastd {{.*#+}} ymm2 = [255,255,255,255,255,255,255,255]
969 ; AVX512F-NEXT: vpminud %ymm2, %ymm0, %ymm0
970 ; AVX512F-NEXT: vpmovdw %zmm0, %ymm0
971 ; AVX512F-NEXT: kmovw %k0, %eax
972 ; AVX512F-NEXT: testb $1, %al
973 ; AVX512F-NEXT: je .LBB12_2
974 ; AVX512F-NEXT: # %bb.1: # %cond.store
975 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
976 ; AVX512F-NEXT: .LBB12_2: # %else
977 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
978 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
979 ; AVX512F-NEXT: kmovw %k0, %eax
980 ; AVX512F-NEXT: testb $1, %al
981 ; AVX512F-NEXT: je .LBB12_4
982 ; AVX512F-NEXT: # %bb.3: # %cond.store1
983 ; AVX512F-NEXT: vpextrb $2, %xmm0, 1(%rdi)
984 ; AVX512F-NEXT: .LBB12_4: # %else2
985 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
986 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
987 ; AVX512F-NEXT: kmovw %k0, %eax
988 ; AVX512F-NEXT: testb $1, %al
989 ; AVX512F-NEXT: je .LBB12_6
990 ; AVX512F-NEXT: # %bb.5: # %cond.store3
991 ; AVX512F-NEXT: vpextrb $4, %xmm0, 2(%rdi)
992 ; AVX512F-NEXT: .LBB12_6: # %else4
993 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
994 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
995 ; AVX512F-NEXT: kmovw %k0, %eax
996 ; AVX512F-NEXT: testb $1, %al
997 ; AVX512F-NEXT: je .LBB12_8
998 ; AVX512F-NEXT: # %bb.7: # %cond.store5
999 ; AVX512F-NEXT: vpextrb $6, %xmm0, 3(%rdi)
1000 ; AVX512F-NEXT: .LBB12_8: # %else6
1001 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1002 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
1003 ; AVX512F-NEXT: kmovw %k0, %eax
1004 ; AVX512F-NEXT: testb $1, %al
1005 ; AVX512F-NEXT: je .LBB12_10
1006 ; AVX512F-NEXT: # %bb.9: # %cond.store7
1007 ; AVX512F-NEXT: vpextrb $8, %xmm0, 4(%rdi)
1008 ; AVX512F-NEXT: .LBB12_10: # %else8
1009 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1010 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
1011 ; AVX512F-NEXT: kmovw %k0, %eax
1012 ; AVX512F-NEXT: testb $1, %al
1013 ; AVX512F-NEXT: je .LBB12_12
1014 ; AVX512F-NEXT: # %bb.11: # %cond.store9
1015 ; AVX512F-NEXT: vpextrb $10, %xmm0, 5(%rdi)
1016 ; AVX512F-NEXT: .LBB12_12: # %else10
1017 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1018 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
1019 ; AVX512F-NEXT: kmovw %k0, %eax
1020 ; AVX512F-NEXT: testb $1, %al
1021 ; AVX512F-NEXT: je .LBB12_14
1022 ; AVX512F-NEXT: # %bb.13: # %cond.store11
1023 ; AVX512F-NEXT: vpextrb $12, %xmm0, 6(%rdi)
1024 ; AVX512F-NEXT: .LBB12_14: # %else12
1025 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1026 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
1027 ; AVX512F-NEXT: kmovw %k0, %eax
1028 ; AVX512F-NEXT: testb $1, %al
1029 ; AVX512F-NEXT: je .LBB12_16
1030 ; AVX512F-NEXT: # %bb.15: # %cond.store13
1031 ; AVX512F-NEXT: vpextrb $14, %xmm0, 7(%rdi)
1032 ; AVX512F-NEXT: .LBB12_16: # %else14
1033 ; AVX512F-NEXT: vzeroupper
1034 ; AVX512F-NEXT: retq
1036 ; AVX512BW-LABEL: truncstore_v8i32_v8i8:
1037 ; AVX512BW: # %bb.0:
1038 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1039 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k0
1040 ; AVX512BW-NEXT: vpbroadcastd {{.*#+}} ymm1 = [255,255,255,255,255,255,255,255]
1041 ; AVX512BW-NEXT: vpminud %ymm1, %ymm0, %ymm0
1042 ; AVX512BW-NEXT: vpmovdw %zmm0, %ymm0
1043 ; AVX512BW-NEXT: vpackuswb %xmm0, %xmm0, %xmm0
1044 ; AVX512BW-NEXT: kshiftlq $56, %k0, %k0
1045 ; AVX512BW-NEXT: kshiftrq $56, %k0, %k1
1046 ; AVX512BW-NEXT: vmovdqu8 %zmm0, (%rdi) {%k1}
1047 ; AVX512BW-NEXT: vzeroupper
1048 ; AVX512BW-NEXT: retq
1050 ; AVX512BWVL-LABEL: truncstore_v8i32_v8i8:
1051 ; AVX512BWVL: # %bb.0:
1052 ; AVX512BWVL-NEXT: vptestmd %ymm1, %ymm1, %k1
1053 ; AVX512BWVL-NEXT: vpminud {{.*}}(%rip){1to8}, %ymm0, %ymm0
1054 ; AVX512BWVL-NEXT: vpmovdb %ymm0, (%rdi) {%k1}
1055 ; AVX512BWVL-NEXT: vzeroupper
1056 ; AVX512BWVL-NEXT: retq
1057 %a = icmp ne <8 x i32> %mask, zeroinitializer
1058 %b = icmp ult <8 x i32> %x, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
1059 %c = select <8 x i1> %b, <8 x i32> %x, <8 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
1060 %d = trunc <8 x i32> %c to <8 x i8>
1061 call void @llvm.masked.store.v8i8.p0v8i8(<8 x i8> %d, <8 x i8>* %p, i32 1, <8 x i1> %a)
1065 define void @truncstore_v4i32_v4i16(<4 x i32> %x, <4 x i16>* %p, <4 x i32> %mask) {
1066 ; AVX512F-LABEL: truncstore_v4i32_v4i16:
1068 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1069 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1070 ; AVX512F-NEXT: vpbroadcastd {{.*#+}} xmm2 = [65535,65535,65535,65535]
1071 ; AVX512F-NEXT: vpminud %xmm2, %xmm0, %xmm0
1072 ; AVX512F-NEXT: kmovw %k0, %eax
1073 ; AVX512F-NEXT: testb $1, %al
1074 ; AVX512F-NEXT: je .LBB13_2
1075 ; AVX512F-NEXT: # %bb.1: # %cond.store
1076 ; AVX512F-NEXT: vpextrw $0, %xmm0, (%rdi)
1077 ; AVX512F-NEXT: .LBB13_2: # %else
1078 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1079 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
1080 ; AVX512F-NEXT: kmovw %k0, %eax
1081 ; AVX512F-NEXT: testb $1, %al
1082 ; AVX512F-NEXT: je .LBB13_4
1083 ; AVX512F-NEXT: # %bb.3: # %cond.store1
1084 ; AVX512F-NEXT: vpextrw $2, %xmm0, 2(%rdi)
1085 ; AVX512F-NEXT: .LBB13_4: # %else2
1086 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1087 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
1088 ; AVX512F-NEXT: kmovw %k0, %eax
1089 ; AVX512F-NEXT: testb $1, %al
1090 ; AVX512F-NEXT: je .LBB13_6
1091 ; AVX512F-NEXT: # %bb.5: # %cond.store3
1092 ; AVX512F-NEXT: vpextrw $4, %xmm0, 4(%rdi)
1093 ; AVX512F-NEXT: .LBB13_6: # %else4
1094 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1095 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
1096 ; AVX512F-NEXT: kmovw %k0, %eax
1097 ; AVX512F-NEXT: testb $1, %al
1098 ; AVX512F-NEXT: je .LBB13_8
1099 ; AVX512F-NEXT: # %bb.7: # %cond.store5
1100 ; AVX512F-NEXT: vpextrw $6, %xmm0, 6(%rdi)
1101 ; AVX512F-NEXT: .LBB13_8: # %else6
1102 ; AVX512F-NEXT: vzeroupper
1103 ; AVX512F-NEXT: retq
1105 ; AVX512BW-LABEL: truncstore_v4i32_v4i16:
1106 ; AVX512BW: # %bb.0:
1107 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1108 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k0
1109 ; AVX512BW-NEXT: vpbroadcastd {{.*#+}} xmm1 = [65535,65535,65535,65535]
1110 ; AVX512BW-NEXT: vpminud %xmm1, %xmm0, %xmm0
1111 ; AVX512BW-NEXT: vpackusdw %xmm0, %xmm0, %xmm0
1112 ; AVX512BW-NEXT: kshiftld $28, %k0, %k0
1113 ; AVX512BW-NEXT: kshiftrd $28, %k0, %k1
1114 ; AVX512BW-NEXT: vmovdqu16 %zmm0, (%rdi) {%k1}
1115 ; AVX512BW-NEXT: vzeroupper
1116 ; AVX512BW-NEXT: retq
1118 ; AVX512BWVL-LABEL: truncstore_v4i32_v4i16:
1119 ; AVX512BWVL: # %bb.0:
1120 ; AVX512BWVL-NEXT: vptestmd %xmm1, %xmm1, %k1
1121 ; AVX512BWVL-NEXT: vpminud {{.*}}(%rip){1to4}, %xmm0, %xmm0
1122 ; AVX512BWVL-NEXT: vpmovdw %xmm0, (%rdi) {%k1}
1123 ; AVX512BWVL-NEXT: retq
1124 %a = icmp ne <4 x i32> %mask, zeroinitializer
1125 %b = icmp ult <4 x i32> %x, <i32 65535, i32 65535, i32 65535, i32 65535>
1126 %c = select <4 x i1> %b, <4 x i32> %x, <4 x i32> <i32 65535, i32 65535, i32 65535, i32 65535>
1127 %d = trunc <4 x i32> %c to <4 x i16>
1128 call void @llvm.masked.store.v4i16.p0v4i16(<4 x i16> %d, <4 x i16>* %p, i32 1, <4 x i1> %a)
1132 define void @truncstore_v4i32_v4i8(<4 x i32> %x, <4 x i8>* %p, <4 x i32> %mask) {
1133 ; AVX512F-LABEL: truncstore_v4i32_v4i8:
1135 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1136 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1137 ; AVX512F-NEXT: vpbroadcastd {{.*#+}} xmm2 = [255,255,255,255]
1138 ; AVX512F-NEXT: vpminud %xmm2, %xmm0, %xmm0
1139 ; AVX512F-NEXT: kmovw %k0, %eax
1140 ; AVX512F-NEXT: testb $1, %al
1141 ; AVX512F-NEXT: je .LBB14_2
1142 ; AVX512F-NEXT: # %bb.1: # %cond.store
1143 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
1144 ; AVX512F-NEXT: .LBB14_2: # %else
1145 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1146 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
1147 ; AVX512F-NEXT: kmovw %k0, %eax
1148 ; AVX512F-NEXT: testb $1, %al
1149 ; AVX512F-NEXT: je .LBB14_4
1150 ; AVX512F-NEXT: # %bb.3: # %cond.store1
1151 ; AVX512F-NEXT: vpextrb $4, %xmm0, 1(%rdi)
1152 ; AVX512F-NEXT: .LBB14_4: # %else2
1153 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1154 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
1155 ; AVX512F-NEXT: kmovw %k0, %eax
1156 ; AVX512F-NEXT: testb $1, %al
1157 ; AVX512F-NEXT: je .LBB14_6
1158 ; AVX512F-NEXT: # %bb.5: # %cond.store3
1159 ; AVX512F-NEXT: vpextrb $8, %xmm0, 2(%rdi)
1160 ; AVX512F-NEXT: .LBB14_6: # %else4
1161 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1162 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
1163 ; AVX512F-NEXT: kmovw %k0, %eax
1164 ; AVX512F-NEXT: testb $1, %al
1165 ; AVX512F-NEXT: je .LBB14_8
1166 ; AVX512F-NEXT: # %bb.7: # %cond.store5
1167 ; AVX512F-NEXT: vpextrb $12, %xmm0, 3(%rdi)
1168 ; AVX512F-NEXT: .LBB14_8: # %else6
1169 ; AVX512F-NEXT: vzeroupper
1170 ; AVX512F-NEXT: retq
1172 ; AVX512BW-LABEL: truncstore_v4i32_v4i8:
1173 ; AVX512BW: # %bb.0:
1174 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1175 ; AVX512BW-NEXT: vptestmd %zmm1, %zmm1, %k0
1176 ; AVX512BW-NEXT: vpbroadcastd {{.*#+}} xmm1 = [255,255,255,255]
1177 ; AVX512BW-NEXT: vpminud %xmm1, %xmm0, %xmm0
1178 ; AVX512BW-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]
1179 ; AVX512BW-NEXT: kshiftlq $60, %k0, %k0
1180 ; AVX512BW-NEXT: kshiftrq $60, %k0, %k1
1181 ; AVX512BW-NEXT: vmovdqu8 %zmm0, (%rdi) {%k1}
1182 ; AVX512BW-NEXT: vzeroupper
1183 ; AVX512BW-NEXT: retq
1185 ; AVX512BWVL-LABEL: truncstore_v4i32_v4i8:
1186 ; AVX512BWVL: # %bb.0:
1187 ; AVX512BWVL-NEXT: vptestmd %xmm1, %xmm1, %k1
1188 ; AVX512BWVL-NEXT: vpminud {{.*}}(%rip){1to4}, %xmm0, %xmm0
1189 ; AVX512BWVL-NEXT: vpmovdb %xmm0, (%rdi) {%k1}
1190 ; AVX512BWVL-NEXT: retq
1191 %a = icmp ne <4 x i32> %mask, zeroinitializer
1192 %b = icmp ult <4 x i32> %x, <i32 255, i32 255, i32 255, i32 255>
1193 %c = select <4 x i1> %b, <4 x i32> %x, <4 x i32> <i32 255, i32 255, i32 255, i32 255>
1194 %d = trunc <4 x i32> %c to <4 x i8>
1195 call void @llvm.masked.store.v4i8.p0v4i8(<4 x i8> %d, <4 x i8>* %p, i32 1, <4 x i1> %a)
1199 define void @truncstore_v32i16_v32i8(<32 x i16> %x, <32 x i8>* %p, <32 x i8> %mask) {
1200 ; AVX512F-LABEL: truncstore_v32i16_v32i8:
1202 ; AVX512F-NEXT: vpxor %xmm3, %xmm3, %xmm3
1203 ; AVX512F-NEXT: vpcmpeqb %ymm3, %ymm2, %ymm3
1204 ; AVX512F-NEXT: vmovdqa64 %zmm3, %zmm4
1205 ; AVX512F-NEXT: vpternlogq $15, %zmm3, %zmm3, %zmm4
1206 ; AVX512F-NEXT: vpmovsxbd %xmm4, %zmm4
1207 ; AVX512F-NEXT: vptestmd %zmm4, %zmm4, %k0
1208 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm4 = [255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
1209 ; AVX512F-NEXT: vpminuw %ymm4, %ymm1, %ymm1
1210 ; AVX512F-NEXT: vpminuw %ymm4, %ymm0, %ymm0
1211 ; AVX512F-NEXT: vpmovzxwd {{.*#+}} zmm0 = ymm0[0],zero,ymm0[1],zero,ymm0[2],zero,ymm0[3],zero,ymm0[4],zero,ymm0[5],zero,ymm0[6],zero,ymm0[7],zero,ymm0[8],zero,ymm0[9],zero,ymm0[10],zero,ymm0[11],zero,ymm0[12],zero,ymm0[13],zero,ymm0[14],zero,ymm0[15],zero
1212 ; AVX512F-NEXT: vpmovdb %zmm0, %xmm0
1213 ; AVX512F-NEXT: vpmovzxwd {{.*#+}} zmm1 = ymm1[0],zero,ymm1[1],zero,ymm1[2],zero,ymm1[3],zero,ymm1[4],zero,ymm1[5],zero,ymm1[6],zero,ymm1[7],zero,ymm1[8],zero,ymm1[9],zero,ymm1[10],zero,ymm1[11],zero,ymm1[12],zero,ymm1[13],zero,ymm1[14],zero,ymm1[15],zero
1214 ; AVX512F-NEXT: vpmovdb %zmm1, %xmm1
1215 ; AVX512F-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
1216 ; AVX512F-NEXT: kmovw %k0, %eax
1217 ; AVX512F-NEXT: testb $1, %al
1218 ; AVX512F-NEXT: je .LBB15_2
1219 ; AVX512F-NEXT: # %bb.1: # %cond.store
1220 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
1221 ; AVX512F-NEXT: .LBB15_2: # %else
1222 ; AVX512F-NEXT: vpternlogq $15, %zmm3, %zmm3, %zmm3
1223 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm1
1224 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1225 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
1226 ; AVX512F-NEXT: kmovw %k0, %eax
1227 ; AVX512F-NEXT: testb $1, %al
1228 ; AVX512F-NEXT: je .LBB15_4
1229 ; AVX512F-NEXT: # %bb.3: # %cond.store1
1230 ; AVX512F-NEXT: vpextrb $1, %xmm0, 1(%rdi)
1231 ; AVX512F-NEXT: .LBB15_4: # %else2
1232 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1233 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1234 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1235 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1236 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1237 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1238 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
1239 ; AVX512F-NEXT: kmovw %k0, %eax
1240 ; AVX512F-NEXT: testb $1, %al
1241 ; AVX512F-NEXT: je .LBB15_6
1242 ; AVX512F-NEXT: # %bb.5: # %cond.store3
1243 ; AVX512F-NEXT: vpextrb $2, %xmm0, 2(%rdi)
1244 ; AVX512F-NEXT: .LBB15_6: # %else4
1245 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1246 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1247 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1248 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
1249 ; AVX512F-NEXT: kmovw %k0, %eax
1250 ; AVX512F-NEXT: testb $1, %al
1251 ; AVX512F-NEXT: je .LBB15_8
1252 ; AVX512F-NEXT: # %bb.7: # %cond.store5
1253 ; AVX512F-NEXT: vpextrb $3, %xmm0, 3(%rdi)
1254 ; AVX512F-NEXT: .LBB15_8: # %else6
1255 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1256 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1257 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1258 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1259 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1260 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1261 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
1262 ; AVX512F-NEXT: kmovw %k0, %eax
1263 ; AVX512F-NEXT: testb $1, %al
1264 ; AVX512F-NEXT: je .LBB15_10
1265 ; AVX512F-NEXT: # %bb.9: # %cond.store7
1266 ; AVX512F-NEXT: vpextrb $4, %xmm0, 4(%rdi)
1267 ; AVX512F-NEXT: .LBB15_10: # %else8
1268 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1269 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1270 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1271 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
1272 ; AVX512F-NEXT: kmovw %k0, %eax
1273 ; AVX512F-NEXT: testb $1, %al
1274 ; AVX512F-NEXT: je .LBB15_12
1275 ; AVX512F-NEXT: # %bb.11: # %cond.store9
1276 ; AVX512F-NEXT: vpextrb $5, %xmm0, 5(%rdi)
1277 ; AVX512F-NEXT: .LBB15_12: # %else10
1278 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1279 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1280 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1281 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1282 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1283 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1284 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
1285 ; AVX512F-NEXT: kmovw %k0, %eax
1286 ; AVX512F-NEXT: testb $1, %al
1287 ; AVX512F-NEXT: je .LBB15_14
1288 ; AVX512F-NEXT: # %bb.13: # %cond.store11
1289 ; AVX512F-NEXT: vpextrb $6, %xmm0, 6(%rdi)
1290 ; AVX512F-NEXT: .LBB15_14: # %else12
1291 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1292 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1293 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1294 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
1295 ; AVX512F-NEXT: kmovw %k0, %eax
1296 ; AVX512F-NEXT: testb $1, %al
1297 ; AVX512F-NEXT: je .LBB15_16
1298 ; AVX512F-NEXT: # %bb.15: # %cond.store13
1299 ; AVX512F-NEXT: vpextrb $7, %xmm0, 7(%rdi)
1300 ; AVX512F-NEXT: .LBB15_16: # %else14
1301 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1302 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1303 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1304 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1305 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1306 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1307 ; AVX512F-NEXT: kshiftrw $8, %k0, %k0
1308 ; AVX512F-NEXT: kmovw %k0, %eax
1309 ; AVX512F-NEXT: testb $1, %al
1310 ; AVX512F-NEXT: je .LBB15_18
1311 ; AVX512F-NEXT: # %bb.17: # %cond.store15
1312 ; AVX512F-NEXT: vpextrb $8, %xmm0, 8(%rdi)
1313 ; AVX512F-NEXT: .LBB15_18: # %else16
1314 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1315 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1316 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1317 ; AVX512F-NEXT: kshiftrw $9, %k0, %k0
1318 ; AVX512F-NEXT: kmovw %k0, %eax
1319 ; AVX512F-NEXT: testb $1, %al
1320 ; AVX512F-NEXT: je .LBB15_20
1321 ; AVX512F-NEXT: # %bb.19: # %cond.store17
1322 ; AVX512F-NEXT: vpextrb $9, %xmm0, 9(%rdi)
1323 ; AVX512F-NEXT: .LBB15_20: # %else18
1324 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1325 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1326 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1327 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1328 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1329 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1330 ; AVX512F-NEXT: kshiftrw $10, %k0, %k0
1331 ; AVX512F-NEXT: kmovw %k0, %eax
1332 ; AVX512F-NEXT: testb $1, %al
1333 ; AVX512F-NEXT: je .LBB15_22
1334 ; AVX512F-NEXT: # %bb.21: # %cond.store19
1335 ; AVX512F-NEXT: vpextrb $10, %xmm0, 10(%rdi)
1336 ; AVX512F-NEXT: .LBB15_22: # %else20
1337 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1338 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1339 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1340 ; AVX512F-NEXT: kshiftrw $11, %k0, %k0
1341 ; AVX512F-NEXT: kmovw %k0, %eax
1342 ; AVX512F-NEXT: testb $1, %al
1343 ; AVX512F-NEXT: je .LBB15_24
1344 ; AVX512F-NEXT: # %bb.23: # %cond.store21
1345 ; AVX512F-NEXT: vpextrb $11, %xmm0, 11(%rdi)
1346 ; AVX512F-NEXT: .LBB15_24: # %else22
1347 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1348 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1349 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1350 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1351 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1352 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1353 ; AVX512F-NEXT: kshiftrw $12, %k0, %k0
1354 ; AVX512F-NEXT: kmovw %k0, %eax
1355 ; AVX512F-NEXT: testb $1, %al
1356 ; AVX512F-NEXT: je .LBB15_26
1357 ; AVX512F-NEXT: # %bb.25: # %cond.store23
1358 ; AVX512F-NEXT: vpextrb $12, %xmm0, 12(%rdi)
1359 ; AVX512F-NEXT: .LBB15_26: # %else24
1360 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1361 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1362 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1363 ; AVX512F-NEXT: kshiftrw $13, %k0, %k0
1364 ; AVX512F-NEXT: kmovw %k0, %eax
1365 ; AVX512F-NEXT: testb $1, %al
1366 ; AVX512F-NEXT: je .LBB15_28
1367 ; AVX512F-NEXT: # %bb.27: # %cond.store25
1368 ; AVX512F-NEXT: vpextrb $13, %xmm0, 13(%rdi)
1369 ; AVX512F-NEXT: .LBB15_28: # %else26
1370 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1371 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1372 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1373 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1374 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1375 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1376 ; AVX512F-NEXT: kshiftrw $14, %k0, %k0
1377 ; AVX512F-NEXT: kmovw %k0, %eax
1378 ; AVX512F-NEXT: testb $1, %al
1379 ; AVX512F-NEXT: je .LBB15_30
1380 ; AVX512F-NEXT: # %bb.29: # %cond.store27
1381 ; AVX512F-NEXT: vpextrb $14, %xmm0, 14(%rdi)
1382 ; AVX512F-NEXT: .LBB15_30: # %else28
1383 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1384 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1385 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1386 ; AVX512F-NEXT: kshiftrw $15, %k0, %k0
1387 ; AVX512F-NEXT: kmovw %k0, %eax
1388 ; AVX512F-NEXT: testb $1, %al
1389 ; AVX512F-NEXT: je .LBB15_32
1390 ; AVX512F-NEXT: # %bb.31: # %cond.store29
1391 ; AVX512F-NEXT: vpextrb $15, %xmm0, 15(%rdi)
1392 ; AVX512F-NEXT: .LBB15_32: # %else30
1393 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1394 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1395 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1396 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1397 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1398 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1399 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1400 ; AVX512F-NEXT: kmovw %k0, %eax
1401 ; AVX512F-NEXT: testb $1, %al
1402 ; AVX512F-NEXT: je .LBB15_34
1403 ; AVX512F-NEXT: # %bb.33: # %cond.store31
1404 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1405 ; AVX512F-NEXT: vpextrb $0, %xmm3, 16(%rdi)
1406 ; AVX512F-NEXT: .LBB15_34: # %else32
1407 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1408 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1409 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1410 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
1411 ; AVX512F-NEXT: kmovw %k0, %eax
1412 ; AVX512F-NEXT: testb $1, %al
1413 ; AVX512F-NEXT: je .LBB15_36
1414 ; AVX512F-NEXT: # %bb.35: # %cond.store33
1415 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1416 ; AVX512F-NEXT: vpextrb $1, %xmm1, 17(%rdi)
1417 ; AVX512F-NEXT: .LBB15_36: # %else34
1418 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1419 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1420 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1421 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1422 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1423 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1424 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1425 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
1426 ; AVX512F-NEXT: kmovw %k0, %eax
1427 ; AVX512F-NEXT: testb $1, %al
1428 ; AVX512F-NEXT: je .LBB15_38
1429 ; AVX512F-NEXT: # %bb.37: # %cond.store35
1430 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1431 ; AVX512F-NEXT: vpextrb $2, %xmm3, 18(%rdi)
1432 ; AVX512F-NEXT: .LBB15_38: # %else36
1433 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1434 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1435 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1436 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
1437 ; AVX512F-NEXT: kmovw %k0, %eax
1438 ; AVX512F-NEXT: testb $1, %al
1439 ; AVX512F-NEXT: je .LBB15_40
1440 ; AVX512F-NEXT: # %bb.39: # %cond.store37
1441 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1442 ; AVX512F-NEXT: vpextrb $3, %xmm1, 19(%rdi)
1443 ; AVX512F-NEXT: .LBB15_40: # %else38
1444 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1445 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1446 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1447 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1448 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1449 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1450 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1451 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
1452 ; AVX512F-NEXT: kmovw %k0, %eax
1453 ; AVX512F-NEXT: testb $1, %al
1454 ; AVX512F-NEXT: je .LBB15_42
1455 ; AVX512F-NEXT: # %bb.41: # %cond.store39
1456 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1457 ; AVX512F-NEXT: vpextrb $4, %xmm3, 20(%rdi)
1458 ; AVX512F-NEXT: .LBB15_42: # %else40
1459 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1460 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1461 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1462 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
1463 ; AVX512F-NEXT: kmovw %k0, %eax
1464 ; AVX512F-NEXT: testb $1, %al
1465 ; AVX512F-NEXT: je .LBB15_44
1466 ; AVX512F-NEXT: # %bb.43: # %cond.store41
1467 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1468 ; AVX512F-NEXT: vpextrb $5, %xmm1, 21(%rdi)
1469 ; AVX512F-NEXT: .LBB15_44: # %else42
1470 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1471 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1472 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1473 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1474 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1475 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1476 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1477 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
1478 ; AVX512F-NEXT: kmovw %k0, %eax
1479 ; AVX512F-NEXT: testb $1, %al
1480 ; AVX512F-NEXT: je .LBB15_46
1481 ; AVX512F-NEXT: # %bb.45: # %cond.store43
1482 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1483 ; AVX512F-NEXT: vpextrb $6, %xmm3, 22(%rdi)
1484 ; AVX512F-NEXT: .LBB15_46: # %else44
1485 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1486 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1487 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1488 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
1489 ; AVX512F-NEXT: kmovw %k0, %eax
1490 ; AVX512F-NEXT: testb $1, %al
1491 ; AVX512F-NEXT: je .LBB15_48
1492 ; AVX512F-NEXT: # %bb.47: # %cond.store45
1493 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1494 ; AVX512F-NEXT: vpextrb $7, %xmm1, 23(%rdi)
1495 ; AVX512F-NEXT: .LBB15_48: # %else46
1496 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1497 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1498 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1499 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1500 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1501 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1502 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1503 ; AVX512F-NEXT: kshiftrw $8, %k0, %k0
1504 ; AVX512F-NEXT: kmovw %k0, %eax
1505 ; AVX512F-NEXT: testb $1, %al
1506 ; AVX512F-NEXT: je .LBB15_50
1507 ; AVX512F-NEXT: # %bb.49: # %cond.store47
1508 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1509 ; AVX512F-NEXT: vpextrb $8, %xmm3, 24(%rdi)
1510 ; AVX512F-NEXT: .LBB15_50: # %else48
1511 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1512 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1513 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1514 ; AVX512F-NEXT: kshiftrw $9, %k0, %k0
1515 ; AVX512F-NEXT: kmovw %k0, %eax
1516 ; AVX512F-NEXT: testb $1, %al
1517 ; AVX512F-NEXT: je .LBB15_52
1518 ; AVX512F-NEXT: # %bb.51: # %cond.store49
1519 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1520 ; AVX512F-NEXT: vpextrb $9, %xmm1, 25(%rdi)
1521 ; AVX512F-NEXT: .LBB15_52: # %else50
1522 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1523 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1524 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1525 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1526 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1527 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1528 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1529 ; AVX512F-NEXT: kshiftrw $10, %k0, %k0
1530 ; AVX512F-NEXT: kmovw %k0, %eax
1531 ; AVX512F-NEXT: testb $1, %al
1532 ; AVX512F-NEXT: je .LBB15_54
1533 ; AVX512F-NEXT: # %bb.53: # %cond.store51
1534 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1535 ; AVX512F-NEXT: vpextrb $10, %xmm3, 26(%rdi)
1536 ; AVX512F-NEXT: .LBB15_54: # %else52
1537 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1538 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1539 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1540 ; AVX512F-NEXT: kshiftrw $11, %k0, %k0
1541 ; AVX512F-NEXT: kmovw %k0, %eax
1542 ; AVX512F-NEXT: testb $1, %al
1543 ; AVX512F-NEXT: je .LBB15_56
1544 ; AVX512F-NEXT: # %bb.55: # %cond.store53
1545 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1546 ; AVX512F-NEXT: vpextrb $11, %xmm1, 27(%rdi)
1547 ; AVX512F-NEXT: .LBB15_56: # %else54
1548 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1549 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1550 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1551 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm3
1552 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm3
1553 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1554 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1555 ; AVX512F-NEXT: kshiftrw $12, %k0, %k0
1556 ; AVX512F-NEXT: kmovw %k0, %eax
1557 ; AVX512F-NEXT: testb $1, %al
1558 ; AVX512F-NEXT: je .LBB15_58
1559 ; AVX512F-NEXT: # %bb.57: # %cond.store55
1560 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1561 ; AVX512F-NEXT: vpextrb $12, %xmm3, 28(%rdi)
1562 ; AVX512F-NEXT: .LBB15_58: # %else56
1563 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1564 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1565 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1566 ; AVX512F-NEXT: kshiftrw $13, %k0, %k0
1567 ; AVX512F-NEXT: kmovw %k0, %eax
1568 ; AVX512F-NEXT: testb $1, %al
1569 ; AVX512F-NEXT: je .LBB15_60
1570 ; AVX512F-NEXT: # %bb.59: # %cond.store57
1571 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1572 ; AVX512F-NEXT: vpextrb $13, %xmm1, 29(%rdi)
1573 ; AVX512F-NEXT: .LBB15_60: # %else58
1574 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1575 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm2, %ymm1
1576 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm1
1577 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm2
1578 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm2
1579 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1580 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1581 ; AVX512F-NEXT: kshiftrw $14, %k0, %k0
1582 ; AVX512F-NEXT: kmovw %k0, %eax
1583 ; AVX512F-NEXT: testb $1, %al
1584 ; AVX512F-NEXT: je .LBB15_62
1585 ; AVX512F-NEXT: # %bb.61: # %cond.store59
1586 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm2
1587 ; AVX512F-NEXT: vpextrb $14, %xmm2, 30(%rdi)
1588 ; AVX512F-NEXT: .LBB15_62: # %else60
1589 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1590 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1591 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1592 ; AVX512F-NEXT: kshiftrw $15, %k0, %k0
1593 ; AVX512F-NEXT: kmovw %k0, %eax
1594 ; AVX512F-NEXT: testb $1, %al
1595 ; AVX512F-NEXT: je .LBB15_64
1596 ; AVX512F-NEXT: # %bb.63: # %cond.store61
1597 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm0
1598 ; AVX512F-NEXT: vpextrb $15, %xmm0, 31(%rdi)
1599 ; AVX512F-NEXT: .LBB15_64: # %else62
1600 ; AVX512F-NEXT: vzeroupper
1601 ; AVX512F-NEXT: retq
1603 ; AVX512BW-LABEL: truncstore_v32i16_v32i8:
1604 ; AVX512BW: # %bb.0:
1605 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1606 ; AVX512BW-NEXT: vptestmb %zmm1, %zmm1, %k1
1607 ; AVX512BW-NEXT: vpminuw {{.*}}(%rip), %zmm0, %zmm0
1608 ; AVX512BW-NEXT: vpmovwb %zmm0, (%rdi) {%k1}
1609 ; AVX512BW-NEXT: vzeroupper
1610 ; AVX512BW-NEXT: retq
1612 ; AVX512BWVL-LABEL: truncstore_v32i16_v32i8:
1613 ; AVX512BWVL: # %bb.0:
1614 ; AVX512BWVL-NEXT: vptestmb %ymm1, %ymm1, %k1
1615 ; AVX512BWVL-NEXT: vpminuw {{.*}}(%rip), %zmm0, %zmm0
1616 ; AVX512BWVL-NEXT: vpmovwb %zmm0, (%rdi) {%k1}
1617 ; AVX512BWVL-NEXT: vzeroupper
1618 ; AVX512BWVL-NEXT: retq
1619 %a = icmp ne <32 x i8> %mask, zeroinitializer
1620 %b = icmp ult <32 x i16> %x, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
1621 %c = select <32 x i1> %b, <32 x i16> %x, <32 x i16> <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
1622 %d = trunc <32 x i16> %c to <32 x i8>
1623 call void @llvm.masked.store.v32i8.p0v32i8(<32 x i8> %d, <32 x i8>* %p, i32 1, <32 x i1> %a)
1627 define void @truncstore_v16i16_v16i8(<16 x i16> %x, <16 x i8>* %p, <16 x i8> %mask) {
1628 ; AVX512F-LABEL: truncstore_v16i16_v16i8:
1630 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1631 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm2
1632 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1633 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1634 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1635 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1636 ; AVX512F-NEXT: vpminuw {{.*}}(%rip), %ymm0, %ymm0
1637 ; AVX512F-NEXT: vpmovzxwd {{.*#+}} zmm0 = ymm0[0],zero,ymm0[1],zero,ymm0[2],zero,ymm0[3],zero,ymm0[4],zero,ymm0[5],zero,ymm0[6],zero,ymm0[7],zero,ymm0[8],zero,ymm0[9],zero,ymm0[10],zero,ymm0[11],zero,ymm0[12],zero,ymm0[13],zero,ymm0[14],zero,ymm0[15],zero
1638 ; AVX512F-NEXT: vpmovdb %zmm0, %xmm0
1639 ; AVX512F-NEXT: kmovw %k0, %eax
1640 ; AVX512F-NEXT: testb $1, %al
1641 ; AVX512F-NEXT: je .LBB16_2
1642 ; AVX512F-NEXT: # %bb.1: # %cond.store
1643 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
1644 ; AVX512F-NEXT: .LBB16_2: # %else
1645 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1646 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1647 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1648 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
1649 ; AVX512F-NEXT: kmovw %k0, %eax
1650 ; AVX512F-NEXT: testb $1, %al
1651 ; AVX512F-NEXT: je .LBB16_4
1652 ; AVX512F-NEXT: # %bb.3: # %cond.store1
1653 ; AVX512F-NEXT: vpextrb $1, %xmm0, 1(%rdi)
1654 ; AVX512F-NEXT: .LBB16_4: # %else2
1655 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1656 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm2
1657 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1658 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1659 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1660 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1661 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
1662 ; AVX512F-NEXT: kmovw %k0, %eax
1663 ; AVX512F-NEXT: testb $1, %al
1664 ; AVX512F-NEXT: je .LBB16_6
1665 ; AVX512F-NEXT: # %bb.5: # %cond.store3
1666 ; AVX512F-NEXT: vpextrb $2, %xmm0, 2(%rdi)
1667 ; AVX512F-NEXT: .LBB16_6: # %else4
1668 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1669 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1670 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1671 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
1672 ; AVX512F-NEXT: kmovw %k0, %eax
1673 ; AVX512F-NEXT: testb $1, %al
1674 ; AVX512F-NEXT: je .LBB16_8
1675 ; AVX512F-NEXT: # %bb.7: # %cond.store5
1676 ; AVX512F-NEXT: vpextrb $3, %xmm0, 3(%rdi)
1677 ; AVX512F-NEXT: .LBB16_8: # %else6
1678 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1679 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm2
1680 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1681 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1682 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1683 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1684 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
1685 ; AVX512F-NEXT: kmovw %k0, %eax
1686 ; AVX512F-NEXT: testb $1, %al
1687 ; AVX512F-NEXT: je .LBB16_10
1688 ; AVX512F-NEXT: # %bb.9: # %cond.store7
1689 ; AVX512F-NEXT: vpextrb $4, %xmm0, 4(%rdi)
1690 ; AVX512F-NEXT: .LBB16_10: # %else8
1691 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1692 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1693 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1694 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
1695 ; AVX512F-NEXT: kmovw %k0, %eax
1696 ; AVX512F-NEXT: testb $1, %al
1697 ; AVX512F-NEXT: je .LBB16_12
1698 ; AVX512F-NEXT: # %bb.11: # %cond.store9
1699 ; AVX512F-NEXT: vpextrb $5, %xmm0, 5(%rdi)
1700 ; AVX512F-NEXT: .LBB16_12: # %else10
1701 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1702 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm2
1703 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1704 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1705 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1706 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1707 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
1708 ; AVX512F-NEXT: kmovw %k0, %eax
1709 ; AVX512F-NEXT: testb $1, %al
1710 ; AVX512F-NEXT: je .LBB16_14
1711 ; AVX512F-NEXT: # %bb.13: # %cond.store11
1712 ; AVX512F-NEXT: vpextrb $6, %xmm0, 6(%rdi)
1713 ; AVX512F-NEXT: .LBB16_14: # %else12
1714 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1715 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1716 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1717 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
1718 ; AVX512F-NEXT: kmovw %k0, %eax
1719 ; AVX512F-NEXT: testb $1, %al
1720 ; AVX512F-NEXT: je .LBB16_16
1721 ; AVX512F-NEXT: # %bb.15: # %cond.store13
1722 ; AVX512F-NEXT: vpextrb $7, %xmm0, 7(%rdi)
1723 ; AVX512F-NEXT: .LBB16_16: # %else14
1724 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1725 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm2
1726 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1727 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1728 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1729 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1730 ; AVX512F-NEXT: kshiftrw $8, %k0, %k0
1731 ; AVX512F-NEXT: kmovw %k0, %eax
1732 ; AVX512F-NEXT: testb $1, %al
1733 ; AVX512F-NEXT: je .LBB16_18
1734 ; AVX512F-NEXT: # %bb.17: # %cond.store15
1735 ; AVX512F-NEXT: vpextrb $8, %xmm0, 8(%rdi)
1736 ; AVX512F-NEXT: .LBB16_18: # %else16
1737 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1738 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1739 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1740 ; AVX512F-NEXT: kshiftrw $9, %k0, %k0
1741 ; AVX512F-NEXT: kmovw %k0, %eax
1742 ; AVX512F-NEXT: testb $1, %al
1743 ; AVX512F-NEXT: je .LBB16_20
1744 ; AVX512F-NEXT: # %bb.19: # %cond.store17
1745 ; AVX512F-NEXT: vpextrb $9, %xmm0, 9(%rdi)
1746 ; AVX512F-NEXT: .LBB16_20: # %else18
1747 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1748 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm2
1749 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1750 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1751 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1752 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1753 ; AVX512F-NEXT: kshiftrw $10, %k0, %k0
1754 ; AVX512F-NEXT: kmovw %k0, %eax
1755 ; AVX512F-NEXT: testb $1, %al
1756 ; AVX512F-NEXT: je .LBB16_22
1757 ; AVX512F-NEXT: # %bb.21: # %cond.store19
1758 ; AVX512F-NEXT: vpextrb $10, %xmm0, 10(%rdi)
1759 ; AVX512F-NEXT: .LBB16_22: # %else20
1760 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1761 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1762 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1763 ; AVX512F-NEXT: kshiftrw $11, %k0, %k0
1764 ; AVX512F-NEXT: kmovw %k0, %eax
1765 ; AVX512F-NEXT: testb $1, %al
1766 ; AVX512F-NEXT: je .LBB16_24
1767 ; AVX512F-NEXT: # %bb.23: # %cond.store21
1768 ; AVX512F-NEXT: vpextrb $11, %xmm0, 11(%rdi)
1769 ; AVX512F-NEXT: .LBB16_24: # %else22
1770 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1771 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm2
1772 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1773 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1774 ; AVX512F-NEXT: vpmovsxbd %xmm3, %zmm3
1775 ; AVX512F-NEXT: vptestmd %zmm3, %zmm3, %k0
1776 ; AVX512F-NEXT: kshiftrw $12, %k0, %k0
1777 ; AVX512F-NEXT: kmovw %k0, %eax
1778 ; AVX512F-NEXT: testb $1, %al
1779 ; AVX512F-NEXT: je .LBB16_26
1780 ; AVX512F-NEXT: # %bb.25: # %cond.store23
1781 ; AVX512F-NEXT: vpextrb $12, %xmm0, 12(%rdi)
1782 ; AVX512F-NEXT: .LBB16_26: # %else24
1783 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1784 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1785 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1786 ; AVX512F-NEXT: kshiftrw $13, %k0, %k0
1787 ; AVX512F-NEXT: kmovw %k0, %eax
1788 ; AVX512F-NEXT: testb $1, %al
1789 ; AVX512F-NEXT: je .LBB16_28
1790 ; AVX512F-NEXT: # %bb.27: # %cond.store25
1791 ; AVX512F-NEXT: vpextrb $13, %xmm0, 13(%rdi)
1792 ; AVX512F-NEXT: .LBB16_28: # %else26
1793 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1794 ; AVX512F-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm1
1795 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm2
1796 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm2
1797 ; AVX512F-NEXT: vpmovsxbd %xmm2, %zmm2
1798 ; AVX512F-NEXT: vptestmd %zmm2, %zmm2, %k0
1799 ; AVX512F-NEXT: kshiftrw $14, %k0, %k0
1800 ; AVX512F-NEXT: kmovw %k0, %eax
1801 ; AVX512F-NEXT: testb $1, %al
1802 ; AVX512F-NEXT: je .LBB16_30
1803 ; AVX512F-NEXT: # %bb.29: # %cond.store27
1804 ; AVX512F-NEXT: vpextrb $14, %xmm0, 14(%rdi)
1805 ; AVX512F-NEXT: .LBB16_30: # %else28
1806 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1807 ; AVX512F-NEXT: vpmovsxbd %xmm1, %zmm1
1808 ; AVX512F-NEXT: vptestmd %zmm1, %zmm1, %k0
1809 ; AVX512F-NEXT: kshiftrw $15, %k0, %k0
1810 ; AVX512F-NEXT: kmovw %k0, %eax
1811 ; AVX512F-NEXT: testb $1, %al
1812 ; AVX512F-NEXT: je .LBB16_32
1813 ; AVX512F-NEXT: # %bb.31: # %cond.store29
1814 ; AVX512F-NEXT: vpextrb $15, %xmm0, 15(%rdi)
1815 ; AVX512F-NEXT: .LBB16_32: # %else30
1816 ; AVX512F-NEXT: vzeroupper
1817 ; AVX512F-NEXT: retq
1819 ; AVX512BW-LABEL: truncstore_v16i16_v16i8:
1820 ; AVX512BW: # %bb.0:
1821 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1822 ; AVX512BW-NEXT: vptestmb %zmm1, %zmm1, %k0
1823 ; AVX512BW-NEXT: kmovw %k0, %k1
1824 ; AVX512BW-NEXT: vpminuw {{.*}}(%rip), %ymm0, %ymm0
1825 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
1826 ; AVX512BW-NEXT: vmovdqu8 %zmm0, (%rdi) {%k1}
1827 ; AVX512BW-NEXT: vzeroupper
1828 ; AVX512BW-NEXT: retq
1830 ; AVX512BWVL-LABEL: truncstore_v16i16_v16i8:
1831 ; AVX512BWVL: # %bb.0:
1832 ; AVX512BWVL-NEXT: vptestmb %xmm1, %xmm1, %k1
1833 ; AVX512BWVL-NEXT: vpminuw {{.*}}(%rip), %ymm0, %ymm0
1834 ; AVX512BWVL-NEXT: vpmovwb %ymm0, (%rdi) {%k1}
1835 ; AVX512BWVL-NEXT: vzeroupper
1836 ; AVX512BWVL-NEXT: retq
1837 %a = icmp ne <16 x i8> %mask, zeroinitializer
1838 %b = icmp ult <16 x i16> %x, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
1839 %c = select <16 x i1> %b, <16 x i16> %x, <16 x i16> <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
1840 %d = trunc <16 x i16> %c to <16 x i8>
1841 call void @llvm.masked.store.v16i8.p0v16i8(<16 x i8> %d, <16 x i8>* %p, i32 1, <16 x i1> %a)
1845 define void @truncstore_v8i16_v8i8(<8 x i16> %x, <8 x i8>* %p, <8 x i16> %mask) {
1846 ; AVX512F-LABEL: truncstore_v8i16_v8i8:
1848 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1849 ; AVX512F-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm2
1850 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1851 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1852 ; AVX512F-NEXT: vpmovsxwq %xmm3, %zmm3
1853 ; AVX512F-NEXT: vptestmq %zmm3, %zmm3, %k0
1854 ; AVX512F-NEXT: vpminuw {{.*}}(%rip), %xmm0, %xmm0
1855 ; AVX512F-NEXT: kmovw %k0, %eax
1856 ; AVX512F-NEXT: testb $1, %al
1857 ; AVX512F-NEXT: je .LBB17_2
1858 ; AVX512F-NEXT: # %bb.1: # %cond.store
1859 ; AVX512F-NEXT: vpextrb $0, %xmm0, (%rdi)
1860 ; AVX512F-NEXT: .LBB17_2: # %else
1861 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1862 ; AVX512F-NEXT: vpmovsxwq %xmm2, %zmm2
1863 ; AVX512F-NEXT: vptestmq %zmm2, %zmm2, %k0
1864 ; AVX512F-NEXT: kshiftrw $1, %k0, %k0
1865 ; AVX512F-NEXT: kmovw %k0, %eax
1866 ; AVX512F-NEXT: testb $1, %al
1867 ; AVX512F-NEXT: je .LBB17_4
1868 ; AVX512F-NEXT: # %bb.3: # %cond.store1
1869 ; AVX512F-NEXT: vpextrb $2, %xmm0, 1(%rdi)
1870 ; AVX512F-NEXT: .LBB17_4: # %else2
1871 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1872 ; AVX512F-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm2
1873 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1874 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1875 ; AVX512F-NEXT: vpmovsxwq %xmm3, %zmm3
1876 ; AVX512F-NEXT: vptestmq %zmm3, %zmm3, %k0
1877 ; AVX512F-NEXT: kshiftrw $2, %k0, %k0
1878 ; AVX512F-NEXT: kmovw %k0, %eax
1879 ; AVX512F-NEXT: testb $1, %al
1880 ; AVX512F-NEXT: je .LBB17_6
1881 ; AVX512F-NEXT: # %bb.5: # %cond.store3
1882 ; AVX512F-NEXT: vpextrb $4, %xmm0, 2(%rdi)
1883 ; AVX512F-NEXT: .LBB17_6: # %else4
1884 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1885 ; AVX512F-NEXT: vpmovsxwq %xmm2, %zmm2
1886 ; AVX512F-NEXT: vptestmq %zmm2, %zmm2, %k0
1887 ; AVX512F-NEXT: kshiftrw $3, %k0, %k0
1888 ; AVX512F-NEXT: kmovw %k0, %eax
1889 ; AVX512F-NEXT: testb $1, %al
1890 ; AVX512F-NEXT: je .LBB17_8
1891 ; AVX512F-NEXT: # %bb.7: # %cond.store5
1892 ; AVX512F-NEXT: vpextrb $6, %xmm0, 3(%rdi)
1893 ; AVX512F-NEXT: .LBB17_8: # %else6
1894 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1895 ; AVX512F-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm2
1896 ; AVX512F-NEXT: vmovdqa64 %zmm2, %zmm3
1897 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm3
1898 ; AVX512F-NEXT: vpmovsxwq %xmm3, %zmm3
1899 ; AVX512F-NEXT: vptestmq %zmm3, %zmm3, %k0
1900 ; AVX512F-NEXT: kshiftrw $4, %k0, %k0
1901 ; AVX512F-NEXT: kmovw %k0, %eax
1902 ; AVX512F-NEXT: testb $1, %al
1903 ; AVX512F-NEXT: je .LBB17_10
1904 ; AVX512F-NEXT: # %bb.9: # %cond.store7
1905 ; AVX512F-NEXT: vpextrb $8, %xmm0, 4(%rdi)
1906 ; AVX512F-NEXT: .LBB17_10: # %else8
1907 ; AVX512F-NEXT: vpternlogq $15, %zmm2, %zmm2, %zmm2
1908 ; AVX512F-NEXT: vpmovsxwq %xmm2, %zmm2
1909 ; AVX512F-NEXT: vptestmq %zmm2, %zmm2, %k0
1910 ; AVX512F-NEXT: kshiftrw $5, %k0, %k0
1911 ; AVX512F-NEXT: kmovw %k0, %eax
1912 ; AVX512F-NEXT: testb $1, %al
1913 ; AVX512F-NEXT: je .LBB17_12
1914 ; AVX512F-NEXT: # %bb.11: # %cond.store9
1915 ; AVX512F-NEXT: vpextrb $10, %xmm0, 5(%rdi)
1916 ; AVX512F-NEXT: .LBB17_12: # %else10
1917 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1918 ; AVX512F-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm1
1919 ; AVX512F-NEXT: vmovdqa64 %zmm1, %zmm2
1920 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm2
1921 ; AVX512F-NEXT: vpmovsxwq %xmm2, %zmm2
1922 ; AVX512F-NEXT: vptestmq %zmm2, %zmm2, %k0
1923 ; AVX512F-NEXT: kshiftrw $6, %k0, %k0
1924 ; AVX512F-NEXT: kmovw %k0, %eax
1925 ; AVX512F-NEXT: testb $1, %al
1926 ; AVX512F-NEXT: je .LBB17_14
1927 ; AVX512F-NEXT: # %bb.13: # %cond.store11
1928 ; AVX512F-NEXT: vpextrb $12, %xmm0, 6(%rdi)
1929 ; AVX512F-NEXT: .LBB17_14: # %else12
1930 ; AVX512F-NEXT: vpternlogq $15, %zmm1, %zmm1, %zmm1
1931 ; AVX512F-NEXT: vpmovsxwq %xmm1, %zmm1
1932 ; AVX512F-NEXT: vptestmq %zmm1, %zmm1, %k0
1933 ; AVX512F-NEXT: kshiftrw $7, %k0, %k0
1934 ; AVX512F-NEXT: kmovw %k0, %eax
1935 ; AVX512F-NEXT: testb $1, %al
1936 ; AVX512F-NEXT: je .LBB17_16
1937 ; AVX512F-NEXT: # %bb.15: # %cond.store13
1938 ; AVX512F-NEXT: vpextrb $14, %xmm0, 7(%rdi)
1939 ; AVX512F-NEXT: .LBB17_16: # %else14
1940 ; AVX512F-NEXT: vzeroupper
1941 ; AVX512F-NEXT: retq
1943 ; AVX512BW-LABEL: truncstore_v8i16_v8i8:
1944 ; AVX512BW: # %bb.0:
1945 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1946 ; AVX512BW-NEXT: vptestmw %zmm1, %zmm1, %k0
1947 ; AVX512BW-NEXT: vpminuw {{.*}}(%rip), %xmm0, %xmm0
1948 ; AVX512BW-NEXT: vpackuswb %xmm0, %xmm0, %xmm0
1949 ; AVX512BW-NEXT: kshiftlq $56, %k0, %k0
1950 ; AVX512BW-NEXT: kshiftrq $56, %k0, %k1
1951 ; AVX512BW-NEXT: vmovdqu8 %zmm0, (%rdi) {%k1}
1952 ; AVX512BW-NEXT: vzeroupper
1953 ; AVX512BW-NEXT: retq
1955 ; AVX512BWVL-LABEL: truncstore_v8i16_v8i8:
1956 ; AVX512BWVL: # %bb.0:
1957 ; AVX512BWVL-NEXT: vptestmw %xmm1, %xmm1, %k1
1958 ; AVX512BWVL-NEXT: vpminuw {{.*}}(%rip), %xmm0, %xmm0
1959 ; AVX512BWVL-NEXT: vpmovwb %xmm0, (%rdi) {%k1}
1960 ; AVX512BWVL-NEXT: retq
1961 %a = icmp ne <8 x i16> %mask, zeroinitializer
1962 %b = icmp ult <8 x i16> %x, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
1963 %c = select <8 x i1> %b, <8 x i16> %x, <8 x i16> <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
1964 %d = trunc <8 x i16> %c to <8 x i8>
1965 call void @llvm.masked.store.v8i8.p0v8i8(<8 x i8> %d, <8 x i8>* %p, i32 1, <8 x i1> %a)
1969 declare void @llvm.masked.store.v8i32.p0v8i32(<8 x i32>, <8 x i32>*, i32, <8 x i1>)
1970 declare void @llvm.masked.store.v8i16.p0v8i16(<8 x i16>, <8 x i16>*, i32, <8 x i1>)
1971 declare void @llvm.masked.store.v8i8.p0v8i8(<8 x i8>, <8 x i8>*, i32, <8 x i1>)
1972 declare void @llvm.masked.store.v4i32.p0v4i32(<4 x i32>, <4 x i32>*, i32, <4 x i1>)
1973 declare void @llvm.masked.store.v4i16.p0v4i16(<4 x i16>, <4 x i16>*, i32, <4 x i1>)
1974 declare void @llvm.masked.store.v4i8.p0v4i8(<4 x i8>, <4 x i8>*, i32, <4 x i1>)
1975 declare void @llvm.masked.store.v2i32.p0v2i32(<2 x i32>, <2 x i32>*, i32, <2 x i1>)
1976 declare void @llvm.masked.store.v2i16.p0v2i16(<2 x i16>, <2 x i16>*, i32, <2 x i1>)
1977 declare void @llvm.masked.store.v2i8.p0v2i8(<2 x i8>, <2 x i8>*, i32, <2 x i1>)
1978 declare void @llvm.masked.store.v16i16.p0v16i16(<16 x i16>, <16 x i16>*, i32, <16 x i1>)
1979 declare void @llvm.masked.store.v16i8.p0v16i8(<16 x i8>, <16 x i8>*, i32, <16 x i1>)
1980 declare void @llvm.masked.store.v32i8.p0v32i8(<32 x i8>, <32 x i8>*, i32, <32 x i1>)