1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx | FileCheck %s --check-prefix=X64
5 ; These tests just check that the plumbing is in place for @llvm.bitreverse. The
6 ; actual output is massive at the moment as llvm.bitreverse is not yet legal.
8 declare i32 @llvm.bitreverse.i32(i32) readnone
9 declare i64 @llvm.bitreverse.i64(i64) readnone
10 declare <4 x i32> @llvm.bitreverse.v4i32(<4 x i32>) readnone
11 declare i32 @llvm.bswap.i32(i32) readnone
13 ; fold (bitreverse undef) -> undef
14 define i32 @test_undef() nounwind {
15 ; X86-LABEL: test_undef:
19 ; X64-LABEL: test_undef:
22 %b = call i32 @llvm.bitreverse.i32(i32 undef)
26 ; fold (bitreverse (bitreverse x)) -> x
27 define i32 @test_bitreverse_bitreverse(i32 %a0) nounwind {
28 ; X86-LABEL: test_bitreverse_bitreverse:
30 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
33 ; X64-LABEL: test_bitreverse_bitreverse:
35 ; X64-NEXT: movl %edi, %eax
37 %b = call i32 @llvm.bitreverse.i32(i32 %a0)
38 %c = call i32 @llvm.bitreverse.i32(i32 %b)
42 ; TODO: fold (bitreverse(srl (bitreverse c), x)) -> (shl c, x)
43 define i32 @test_bitreverse_srli_bitreverse(i32 %a0) nounwind {
44 ; X86-LABEL: test_bitreverse_srli_bitreverse:
46 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
47 ; X86-NEXT: bswapl %eax
48 ; X86-NEXT: movl %eax, %ecx
49 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
50 ; X86-NEXT: shll $4, %ecx
51 ; X86-NEXT: shrl $4, %eax
52 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
53 ; X86-NEXT: orl %ecx, %eax
54 ; X86-NEXT: movl %eax, %ecx
55 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
56 ; X86-NEXT: shrl $2, %eax
57 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
58 ; X86-NEXT: leal (%eax,%ecx,4), %eax
59 ; X86-NEXT: movl %eax, %ecx
60 ; X86-NEXT: andl $1431655744, %ecx # imm = 0x55555540
62 ; X86-NEXT: andl $1431655680, %eax # imm = 0x55555500
63 ; X86-NEXT: leal (%eax,%ecx,2), %eax
64 ; X86-NEXT: shrl $7, %eax
65 ; X86-NEXT: bswapl %eax
66 ; X86-NEXT: movl %eax, %ecx
67 ; X86-NEXT: andl $252645121, %ecx # imm = 0xF0F0F01
68 ; X86-NEXT: shll $4, %ecx
69 ; X86-NEXT: shrl $4, %eax
70 ; X86-NEXT: andl $252645120, %eax # imm = 0xF0F0F00
71 ; X86-NEXT: orl %ecx, %eax
72 ; X86-NEXT: movl %eax, %ecx
73 ; X86-NEXT: andl $858993424, %ecx # imm = 0x33333310
74 ; X86-NEXT: shrl $2, %eax
75 ; X86-NEXT: andl $858993408, %eax # imm = 0x33333300
76 ; X86-NEXT: leal (%eax,%ecx,4), %eax
77 ; X86-NEXT: movl %eax, %ecx
78 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
80 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
81 ; X86-NEXT: leal (%eax,%ecx,2), %eax
84 ; X64-LABEL: test_bitreverse_srli_bitreverse:
86 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
87 ; X64-NEXT: bswapl %edi
88 ; X64-NEXT: movl %edi, %eax
89 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
90 ; X64-NEXT: shll $4, %eax
91 ; X64-NEXT: shrl $4, %edi
92 ; X64-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
93 ; X64-NEXT: orl %eax, %edi
94 ; X64-NEXT: movl %edi, %eax
95 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
96 ; X64-NEXT: shrl $2, %edi
97 ; X64-NEXT: andl $858993459, %edi # imm = 0x33333333
98 ; X64-NEXT: leal (%rdi,%rax,4), %eax
99 ; X64-NEXT: movl %eax, %ecx
100 ; X64-NEXT: andl $1431655744, %ecx # imm = 0x55555540
101 ; X64-NEXT: shrl %eax
102 ; X64-NEXT: andl $1431655680, %eax # imm = 0x55555500
103 ; X64-NEXT: leal (%rax,%rcx,2), %eax
104 ; X64-NEXT: shrl $7, %eax
105 ; X64-NEXT: bswapl %eax
106 ; X64-NEXT: movl %eax, %ecx
107 ; X64-NEXT: andl $252645121, %ecx # imm = 0xF0F0F01
108 ; X64-NEXT: shll $4, %ecx
109 ; X64-NEXT: shrl $4, %eax
110 ; X64-NEXT: andl $252645120, %eax # imm = 0xF0F0F00
111 ; X64-NEXT: orl %ecx, %eax
112 ; X64-NEXT: movl %eax, %ecx
113 ; X64-NEXT: andl $858993424, %ecx # imm = 0x33333310
114 ; X64-NEXT: shrl $2, %eax
115 ; X64-NEXT: andl $858993408, %eax # imm = 0x33333300
116 ; X64-NEXT: leal (%rax,%rcx,4), %eax
117 ; X64-NEXT: movl %eax, %ecx
118 ; X64-NEXT: andl $1431655765, %ecx # imm = 0x55555555
119 ; X64-NEXT: shrl %eax
120 ; X64-NEXT: andl $1431655765, %eax # imm = 0x55555555
121 ; X64-NEXT: leal (%rax,%rcx,2), %eax
123 %b = call i32 @llvm.bitreverse.i32(i32 %a0)
125 %d = call i32 @llvm.bitreverse.i32(i32 %c)
129 define i64 @test_bitreverse_srli_bitreverse_i64(i64 %a) nounwind {
130 ; X86-LABEL: test_bitreverse_srli_bitreverse_i64:
132 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
133 ; X86-NEXT: bswapl %eax
134 ; X86-NEXT: movl %eax, %ecx
135 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
136 ; X86-NEXT: shll $4, %ecx
137 ; X86-NEXT: shrl $4, %eax
138 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
139 ; X86-NEXT: orl %ecx, %eax
140 ; X86-NEXT: movl %eax, %ecx
141 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
142 ; X86-NEXT: shrl $2, %eax
143 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
144 ; X86-NEXT: leal (%eax,%ecx,4), %eax
145 ; X86-NEXT: movl %eax, %ecx
146 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
147 ; X86-NEXT: shrl %eax
148 ; X86-NEXT: andl $1431655764, %eax # imm = 0x55555554
149 ; X86-NEXT: leal (%eax,%ecx,2), %eax
150 ; X86-NEXT: shrl %eax
151 ; X86-NEXT: bswapl %eax
152 ; X86-NEXT: movl %eax, %ecx
153 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
154 ; X86-NEXT: shll $4, %ecx
155 ; X86-NEXT: shrl $4, %eax
156 ; X86-NEXT: andl $252645127, %eax # imm = 0xF0F0F07
157 ; X86-NEXT: orl %ecx, %eax
158 ; X86-NEXT: movl %eax, %ecx
159 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
160 ; X86-NEXT: shrl $2, %eax
161 ; X86-NEXT: andl $858993457, %eax # imm = 0x33333331
162 ; X86-NEXT: leal (%eax,%ecx,4), %eax
163 ; X86-NEXT: movl %eax, %ecx
164 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
165 ; X86-NEXT: shrl %eax
166 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
167 ; X86-NEXT: leal (%eax,%ecx,2), %edx
168 ; X86-NEXT: xorl %eax, %eax
171 ; X64-LABEL: test_bitreverse_srli_bitreverse_i64:
173 ; X64-NEXT: bswapq %rdi
174 ; X64-NEXT: movq %rdi, %rax
175 ; X64-NEXT: shrq $4, %rax
176 ; X64-NEXT: movabsq $1085102592571150095, %rcx # imm = 0xF0F0F0F0F0F0F0F
177 ; X64-NEXT: andq %rcx, %rax
178 ; X64-NEXT: andq %rcx, %rdi
179 ; X64-NEXT: shlq $4, %rdi
180 ; X64-NEXT: orq %rax, %rdi
181 ; X64-NEXT: movabsq $3689348814741910323, %rax # imm = 0x3333333333333333
182 ; X64-NEXT: movq %rdi, %rcx
183 ; X64-NEXT: andq %rax, %rcx
184 ; X64-NEXT: shrq $2, %rdi
185 ; X64-NEXT: andq %rax, %rdi
186 ; X64-NEXT: leaq (%rdi,%rcx,4), %rax
187 ; X64-NEXT: movabsq $6148914689804861440, %rcx # imm = 0x5555555500000000
188 ; X64-NEXT: andq %rax, %rcx
189 ; X64-NEXT: shrq %rax
190 ; X64-NEXT: movabsq $6148914685509894144, %rdx # imm = 0x5555555400000000
191 ; X64-NEXT: andq %rax, %rdx
192 ; X64-NEXT: leaq (%rdx,%rcx,2), %rax
193 ; X64-NEXT: shrq $33, %rax
194 ; X64-NEXT: bswapq %rax
195 ; X64-NEXT: movabsq $1085102592318504960, %rcx # imm = 0xF0F0F0F00000000
196 ; X64-NEXT: andq %rax, %rcx
197 ; X64-NEXT: shrq $4, %rax
198 ; X64-NEXT: movabsq $1085102557958766592, %rdx # imm = 0xF0F0F0700000000
199 ; X64-NEXT: andq %rax, %rdx
200 ; X64-NEXT: shlq $4, %rcx
201 ; X64-NEXT: orq %rdx, %rcx
202 ; X64-NEXT: movabsq $3689348813882916864, %rax # imm = 0x3333333300000000
203 ; X64-NEXT: andq %rcx, %rax
204 ; X64-NEXT: shrq $2, %rcx
205 ; X64-NEXT: movabsq $3689348805292982272, %rdx # imm = 0x3333333100000000
206 ; X64-NEXT: andq %rcx, %rdx
207 ; X64-NEXT: leaq (%rdx,%rax,4), %rax
208 ; X64-NEXT: movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555
209 ; X64-NEXT: movq %rax, %rdx
210 ; X64-NEXT: andq %rcx, %rdx
211 ; X64-NEXT: shrq %rax
212 ; X64-NEXT: andq %rcx, %rax
213 ; X64-NEXT: leaq (%rax,%rdx,2), %rax
215 %1 = call i64 @llvm.bitreverse.i64(i64 %a)
217 %3 = call i64 @llvm.bitreverse.i64(i64 %2)
221 ; TODO: fold (bitreverse(shl (bitreverse c), x)) -> (srl c, x)
222 define i32 @test_bitreverse_shli_bitreverse(i32 %a0) nounwind {
223 ; X86-LABEL: test_bitreverse_shli_bitreverse:
225 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
226 ; X86-NEXT: bswapl %eax
227 ; X86-NEXT: movl %eax, %ecx
228 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
229 ; X86-NEXT: shll $4, %ecx
230 ; X86-NEXT: shrl $4, %eax
231 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
232 ; X86-NEXT: orl %ecx, %eax
233 ; X86-NEXT: movl %eax, %ecx
234 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
235 ; X86-NEXT: shrl $2, %eax
236 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
237 ; X86-NEXT: leal (%eax,%ecx,4), %ecx
238 ; X86-NEXT: movl %ecx, %eax
239 ; X86-NEXT: andl $5592405, %eax # imm = 0x555555
240 ; X86-NEXT: shll $6, %ecx
241 ; X86-NEXT: andl $-1431655808, %ecx # imm = 0xAAAAAA80
242 ; X86-NEXT: shll $8, %eax
243 ; X86-NEXT: orl %ecx, %eax
244 ; X86-NEXT: bswapl %eax
245 ; X86-NEXT: movl %eax, %ecx
246 ; X86-NEXT: andl $986895, %ecx # imm = 0xF0F0F
247 ; X86-NEXT: shll $4, %ecx
248 ; X86-NEXT: shrl $4, %eax
249 ; X86-NEXT: andl $135204623, %eax # imm = 0x80F0F0F
250 ; X86-NEXT: orl %ecx, %eax
251 ; X86-NEXT: movl %eax, %ecx
252 ; X86-NEXT: andl $3355443, %ecx # imm = 0x333333
253 ; X86-NEXT: shrl $2, %eax
254 ; X86-NEXT: andl $36909875, %eax # imm = 0x2333333
255 ; X86-NEXT: leal (%eax,%ecx,4), %eax
256 ; X86-NEXT: movl %eax, %ecx
257 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
258 ; X86-NEXT: shrl %eax
259 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
260 ; X86-NEXT: leal (%eax,%ecx,2), %eax
263 ; X64-LABEL: test_bitreverse_shli_bitreverse:
265 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
266 ; X64-NEXT: bswapl %edi
267 ; X64-NEXT: movl %edi, %eax
268 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
269 ; X64-NEXT: shll $4, %eax
270 ; X64-NEXT: shrl $4, %edi
271 ; X64-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
272 ; X64-NEXT: orl %eax, %edi
273 ; X64-NEXT: movl %edi, %eax
274 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
275 ; X64-NEXT: shrl $2, %edi
276 ; X64-NEXT: andl $858993459, %edi # imm = 0x33333333
277 ; X64-NEXT: leal (%rdi,%rax,4), %eax
278 ; X64-NEXT: movl %eax, %ecx
279 ; X64-NEXT: andl $5592405, %ecx # imm = 0x555555
280 ; X64-NEXT: shll $6, %eax
281 ; X64-NEXT: andl $-1431655808, %eax # imm = 0xAAAAAA80
282 ; X64-NEXT: shll $8, %ecx
283 ; X64-NEXT: orl %eax, %ecx
284 ; X64-NEXT: bswapl %ecx
285 ; X64-NEXT: movl %ecx, %eax
286 ; X64-NEXT: andl $986895, %eax # imm = 0xF0F0F
287 ; X64-NEXT: shll $4, %eax
288 ; X64-NEXT: shrl $4, %ecx
289 ; X64-NEXT: andl $135204623, %ecx # imm = 0x80F0F0F
290 ; X64-NEXT: orl %eax, %ecx
291 ; X64-NEXT: movl %ecx, %eax
292 ; X64-NEXT: andl $3355443, %eax # imm = 0x333333
293 ; X64-NEXT: shrl $2, %ecx
294 ; X64-NEXT: andl $36909875, %ecx # imm = 0x2333333
295 ; X64-NEXT: leal (%rcx,%rax,4), %eax
296 ; X64-NEXT: movl %eax, %ecx
297 ; X64-NEXT: andl $1431655765, %ecx # imm = 0x55555555
298 ; X64-NEXT: shrl %eax
299 ; X64-NEXT: andl $1431655765, %eax # imm = 0x55555555
300 ; X64-NEXT: leal (%rax,%rcx,2), %eax
302 %b = call i32 @llvm.bitreverse.i32(i32 %a0)
304 %d = call i32 @llvm.bitreverse.i32(i32 %c)
308 define i64 @test_bitreverse_shli_bitreverse_i64(i64 %a) nounwind {
309 ; X86-LABEL: test_bitreverse_shli_bitreverse_i64:
311 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
312 ; X86-NEXT: bswapl %eax
313 ; X86-NEXT: movl %eax, %ecx
314 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
315 ; X86-NEXT: shll $4, %ecx
316 ; X86-NEXT: shrl $4, %eax
317 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
318 ; X86-NEXT: orl %ecx, %eax
319 ; X86-NEXT: movl %eax, %ecx
320 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
321 ; X86-NEXT: shrl $2, %eax
322 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
323 ; X86-NEXT: leal (%eax,%ecx,4), %eax
324 ; X86-NEXT: movl %eax, %ecx
325 ; X86-NEXT: andl $357913941, %ecx # imm = 0x15555555
326 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
327 ; X86-NEXT: leal (%eax,%ecx,4), %eax
328 ; X86-NEXT: bswapl %eax
329 ; X86-NEXT: movl %eax, %ecx
330 ; X86-NEXT: andl $235867919, %ecx # imm = 0xE0F0F0F
331 ; X86-NEXT: shll $4, %ecx
332 ; X86-NEXT: shrl $4, %eax
333 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
334 ; X86-NEXT: orl %ecx, %eax
335 ; X86-NEXT: movl %eax, %ecx
336 ; X86-NEXT: andl $590558003, %ecx # imm = 0x23333333
337 ; X86-NEXT: shrl $2, %eax
338 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
339 ; X86-NEXT: leal (%eax,%ecx,4), %eax
340 ; X86-NEXT: movl %eax, %ecx
341 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
342 ; X86-NEXT: shrl %eax
343 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
344 ; X86-NEXT: leal (%eax,%ecx,2), %eax
345 ; X86-NEXT: xorl %edx, %edx
348 ; X64-LABEL: test_bitreverse_shli_bitreverse_i64:
350 ; X64-NEXT: bswapq %rdi
351 ; X64-NEXT: movl %edi, %eax
352 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
353 ; X64-NEXT: shll $4, %eax
354 ; X64-NEXT: shrl $4, %edi
355 ; X64-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
356 ; X64-NEXT: orl %eax, %edi
357 ; X64-NEXT: movl %edi, %eax
358 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
359 ; X64-NEXT: shrl $2, %edi
360 ; X64-NEXT: andl $858993459, %edi # imm = 0x33333333
361 ; X64-NEXT: leal (%rdi,%rax,4), %eax
362 ; X64-NEXT: movl %eax, %ecx
363 ; X64-NEXT: andl $357913941, %ecx # imm = 0x15555555
364 ; X64-NEXT: shrl %eax
365 ; X64-NEXT: andl $1431655765, %eax # imm = 0x55555555
366 ; X64-NEXT: leal (%rax,%rcx,2), %eax
367 ; X64-NEXT: shlq $33, %rax
368 ; X64-NEXT: bswapq %rax
369 ; X64-NEXT: movl %eax, %ecx
370 ; X64-NEXT: andl $235867919, %ecx # imm = 0xE0F0F0F
371 ; X64-NEXT: shll $4, %ecx
372 ; X64-NEXT: shrl $4, %eax
373 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
374 ; X64-NEXT: orl %ecx, %eax
375 ; X64-NEXT: movl %eax, %ecx
376 ; X64-NEXT: andl $590558003, %ecx # imm = 0x23333333
377 ; X64-NEXT: shrl $2, %eax
378 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
379 ; X64-NEXT: leal (%rax,%rcx,4), %eax
380 ; X64-NEXT: movl %eax, %ecx
381 ; X64-NEXT: andl $357913941, %ecx # imm = 0x15555555
382 ; X64-NEXT: shrl %eax
383 ; X64-NEXT: andl $1431655765, %eax # imm = 0x55555555
384 ; X64-NEXT: leal (%rax,%rcx,2), %eax
386 %1 = call i64 @llvm.bitreverse.i64(i64 %a)
388 %3 = call i64 @llvm.bitreverse.i64(i64 %2)
392 define <4 x i32> @test_demandedbits_bitreverse(<4 x i32> %a0) nounwind {
393 ; X86-LABEL: test_demandedbits_bitreverse:
395 ; X86-NEXT: pxor %xmm1, %xmm1
396 ; X86-NEXT: movdqa %xmm0, %xmm2
397 ; X86-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
398 ; X86-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[3,2,1,0,4,5,6,7]
399 ; X86-NEXT: pshufhw {{.*#+}} xmm2 = xmm2[0,1,2,3,7,6,5,4]
400 ; X86-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
401 ; X86-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[3,2,1,0,4,5,6,7]
402 ; X86-NEXT: pshufhw {{.*#+}} xmm0 = xmm0[0,1,2,3,7,6,5,4]
403 ; X86-NEXT: packuswb %xmm2, %xmm0
404 ; X86-NEXT: movdqa %xmm0, %xmm1
405 ; X86-NEXT: psrlw $4, %xmm1
406 ; X86-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
407 ; X86-NEXT: pand %xmm2, %xmm1
408 ; X86-NEXT: pand %xmm2, %xmm0
409 ; X86-NEXT: psllw $4, %xmm0
410 ; X86-NEXT: por %xmm1, %xmm0
411 ; X86-NEXT: movdqa %xmm0, %xmm1
412 ; X86-NEXT: psrlw $2, %xmm1
413 ; X86-NEXT: movdqa {{.*#+}} xmm2 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
414 ; X86-NEXT: pand %xmm2, %xmm1
415 ; X86-NEXT: pand %xmm2, %xmm0
416 ; X86-NEXT: psllw $2, %xmm0
417 ; X86-NEXT: por %xmm1, %xmm0
418 ; X86-NEXT: movdqa %xmm0, %xmm1
419 ; X86-NEXT: psrlw $1, %xmm1
420 ; X86-NEXT: movdqa {{.*#+}} xmm2 = [85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85]
421 ; X86-NEXT: pand %xmm2, %xmm1
422 ; X86-NEXT: pand %xmm2, %xmm0
423 ; X86-NEXT: paddb %xmm0, %xmm0
424 ; X86-NEXT: por %xmm1, %xmm0
425 ; X86-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
428 ; X64-LABEL: test_demandedbits_bitreverse:
430 ; X64-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12]
431 ; X64-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
432 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm2
433 ; X64-NEXT: vmovdqa {{.*#+}} xmm3 = [0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240]
434 ; X64-NEXT: vpshufb %xmm2, %xmm3, %xmm2
435 ; X64-NEXT: vpsrlw $4, %xmm0, %xmm0
436 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
437 ; X64-NEXT: vmovdqa {{.*#+}} xmm1 = [0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15]
438 ; X64-NEXT: vpshufb %xmm0, %xmm1, %xmm0
439 ; X64-NEXT: vpor %xmm0, %xmm2, %xmm0
440 ; X64-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
442 %b = or <4 x i32> %a0, <i32 2147483648, i32 2147483648, i32 2147483648, i32 2147483648>
443 %c = call <4 x i32> @llvm.bitreverse.v4i32(<4 x i32> %b)
444 %d = and <4 x i32> %c, <i32 -2, i32 -2, i32 -2, i32 -2>