1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown | 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 <2 x i16> @llvm.bitreverse.v2i16(<2 x i16>) readnone
10 define <2 x i16> @test_bitreverse_v2i16(<2 x i16> %a) nounwind {
11 ; X86-LABEL: test_bitreverse_v2i16:
13 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
14 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
15 ; X86-NEXT: rolw $8, %ax
16 ; X86-NEXT: movl %eax, %edx
17 ; X86-NEXT: andl $3855, %edx # imm = 0xF0F
18 ; X86-NEXT: shll $4, %edx
19 ; X86-NEXT: andl $61680, %eax # imm = 0xF0F0
20 ; X86-NEXT: shrl $4, %eax
21 ; X86-NEXT: orl %edx, %eax
22 ; X86-NEXT: movl %eax, %edx
23 ; X86-NEXT: andl $13107, %edx # imm = 0x3333
24 ; X86-NEXT: andl $52428, %eax # imm = 0xCCCC
25 ; X86-NEXT: shrl $2, %eax
26 ; X86-NEXT: leal (%eax,%edx,4), %eax
27 ; X86-NEXT: movl %eax, %edx
28 ; X86-NEXT: andl $21845, %edx # imm = 0x5555
29 ; X86-NEXT: andl $43690, %eax # imm = 0xAAAA
31 ; X86-NEXT: leal (%eax,%edx,2), %eax
32 ; X86-NEXT: rolw $8, %cx
33 ; X86-NEXT: movl %ecx, %edx
34 ; X86-NEXT: andl $3855, %edx # imm = 0xF0F
35 ; X86-NEXT: shll $4, %edx
36 ; X86-NEXT: andl $61680, %ecx # imm = 0xF0F0
37 ; X86-NEXT: shrl $4, %ecx
38 ; X86-NEXT: orl %edx, %ecx
39 ; X86-NEXT: movl %ecx, %edx
40 ; X86-NEXT: andl $13107, %edx # imm = 0x3333
41 ; X86-NEXT: andl $52428, %ecx # imm = 0xCCCC
42 ; X86-NEXT: shrl $2, %ecx
43 ; X86-NEXT: leal (%ecx,%edx,4), %ecx
44 ; X86-NEXT: movl %ecx, %edx
45 ; X86-NEXT: andl $21845, %edx # imm = 0x5555
46 ; X86-NEXT: andl $43690, %ecx # imm = 0xAAAA
48 ; X86-NEXT: leal (%ecx,%edx,2), %edx
49 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
50 ; X86-NEXT: # kill: def $dx killed $dx killed $edx
53 ; X64-LABEL: test_bitreverse_v2i16:
55 ; X64-NEXT: pxor %xmm1, %xmm1
56 ; X64-NEXT: movdqa %xmm0, %xmm2
57 ; X64-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]
58 ; X64-NEXT: pshufd {{.*#+}} xmm2 = xmm2[2,3,0,1]
59 ; X64-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[3,2,1,0,4,5,6,7]
60 ; X64-NEXT: pshufhw {{.*#+}} xmm2 = xmm2[0,1,2,3,7,6,5,4]
61 ; X64-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]
62 ; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
63 ; X64-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[3,2,1,0,4,5,6,7]
64 ; X64-NEXT: pshufhw {{.*#+}} xmm0 = xmm0[0,1,2,3,7,6,5,4]
65 ; X64-NEXT: packuswb %xmm2, %xmm0
66 ; X64-NEXT: movdqa %xmm0, %xmm1
67 ; X64-NEXT: psllw $4, %xmm1
68 ; X64-NEXT: pand {{.*}}(%rip), %xmm1
69 ; X64-NEXT: psrlw $4, %xmm0
70 ; X64-NEXT: pand {{.*}}(%rip), %xmm0
71 ; X64-NEXT: por %xmm1, %xmm0
72 ; X64-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
73 ; X64-NEXT: pand %xmm0, %xmm1
74 ; X64-NEXT: psllw $2, %xmm1
75 ; X64-NEXT: pand {{.*}}(%rip), %xmm0
76 ; X64-NEXT: psrlw $2, %xmm0
77 ; X64-NEXT: por %xmm1, %xmm0
78 ; X64-NEXT: movdqa {{.*#+}} xmm1 = [85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85]
79 ; X64-NEXT: pand %xmm0, %xmm1
80 ; X64-NEXT: paddb %xmm1, %xmm1
81 ; X64-NEXT: pand {{.*}}(%rip), %xmm0
82 ; X64-NEXT: psrlw $1, %xmm0
83 ; X64-NEXT: por %xmm1, %xmm0
84 ; X64-NEXT: psrlq $48, %xmm0
86 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> %a)
90 declare i64 @llvm.bitreverse.i64(i64) readnone
92 define i64 @test_bitreverse_i64(i64 %a) nounwind {
93 ; X86-LABEL: test_bitreverse_i64:
95 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
96 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
97 ; X86-NEXT: bswapl %eax
98 ; X86-NEXT: movl %eax, %edx
99 ; X86-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
100 ; X86-NEXT: shll $4, %edx
101 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
102 ; X86-NEXT: shrl $4, %eax
103 ; X86-NEXT: orl %edx, %eax
104 ; X86-NEXT: movl %eax, %edx
105 ; X86-NEXT: andl $858993459, %edx # imm = 0x33333333
106 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
107 ; X86-NEXT: shrl $2, %eax
108 ; X86-NEXT: leal (%eax,%edx,4), %eax
109 ; X86-NEXT: movl %eax, %edx
110 ; X86-NEXT: andl $1431655765, %edx # imm = 0x55555555
111 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
112 ; X86-NEXT: shrl %eax
113 ; X86-NEXT: leal (%eax,%edx,2), %eax
114 ; X86-NEXT: bswapl %ecx
115 ; X86-NEXT: movl %ecx, %edx
116 ; X86-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
117 ; X86-NEXT: shll $4, %edx
118 ; X86-NEXT: andl $-252645136, %ecx # imm = 0xF0F0F0F0
119 ; X86-NEXT: shrl $4, %ecx
120 ; X86-NEXT: orl %edx, %ecx
121 ; X86-NEXT: movl %ecx, %edx
122 ; X86-NEXT: andl $858993459, %edx # imm = 0x33333333
123 ; X86-NEXT: andl $-858993460, %ecx # imm = 0xCCCCCCCC
124 ; X86-NEXT: shrl $2, %ecx
125 ; X86-NEXT: leal (%ecx,%edx,4), %ecx
126 ; X86-NEXT: movl %ecx, %edx
127 ; X86-NEXT: andl $1431655765, %edx # imm = 0x55555555
128 ; X86-NEXT: andl $-1431655766, %ecx # imm = 0xAAAAAAAA
129 ; X86-NEXT: shrl %ecx
130 ; X86-NEXT: leal (%ecx,%edx,2), %edx
133 ; X64-LABEL: test_bitreverse_i64:
135 ; X64-NEXT: bswapq %rdi
136 ; X64-NEXT: movabsq $1085102592571150095, %rax # imm = 0xF0F0F0F0F0F0F0F
137 ; X64-NEXT: andq %rdi, %rax
138 ; X64-NEXT: shlq $4, %rax
139 ; X64-NEXT: movabsq $-1085102592571150096, %rcx # imm = 0xF0F0F0F0F0F0F0F0
140 ; X64-NEXT: andq %rdi, %rcx
141 ; X64-NEXT: shrq $4, %rcx
142 ; X64-NEXT: orq %rax, %rcx
143 ; X64-NEXT: movabsq $3689348814741910323, %rax # imm = 0x3333333333333333
144 ; X64-NEXT: andq %rcx, %rax
145 ; X64-NEXT: movabsq $-3689348814741910324, %rdx # imm = 0xCCCCCCCCCCCCCCCC
146 ; X64-NEXT: andq %rcx, %rdx
147 ; X64-NEXT: shrq $2, %rdx
148 ; X64-NEXT: leaq (%rdx,%rax,4), %rax
149 ; X64-NEXT: movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555
150 ; X64-NEXT: andq %rax, %rcx
151 ; X64-NEXT: movabsq $-6148914691236517206, %rdx # imm = 0xAAAAAAAAAAAAAAAA
152 ; X64-NEXT: andq %rax, %rdx
153 ; X64-NEXT: shrq %rdx
154 ; X64-NEXT: leaq (%rdx,%rcx,2), %rax
156 %b = call i64 @llvm.bitreverse.i64(i64 %a)
160 declare i32 @llvm.bitreverse.i32(i32) readnone
162 define i32 @test_bitreverse_i32(i32 %a) nounwind {
163 ; X86-LABEL: test_bitreverse_i32:
165 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
166 ; X86-NEXT: bswapl %eax
167 ; X86-NEXT: movl %eax, %ecx
168 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
169 ; X86-NEXT: shll $4, %ecx
170 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
171 ; X86-NEXT: shrl $4, %eax
172 ; X86-NEXT: orl %ecx, %eax
173 ; X86-NEXT: movl %eax, %ecx
174 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
175 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
176 ; X86-NEXT: shrl $2, %eax
177 ; X86-NEXT: leal (%eax,%ecx,4), %eax
178 ; X86-NEXT: movl %eax, %ecx
179 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
180 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
181 ; X86-NEXT: shrl %eax
182 ; X86-NEXT: leal (%eax,%ecx,2), %eax
185 ; X64-LABEL: test_bitreverse_i32:
187 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
188 ; X64-NEXT: bswapl %edi
189 ; X64-NEXT: movl %edi, %eax
190 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
191 ; X64-NEXT: shll $4, %eax
192 ; X64-NEXT: andl $-252645136, %edi # imm = 0xF0F0F0F0
193 ; X64-NEXT: shrl $4, %edi
194 ; X64-NEXT: orl %eax, %edi
195 ; X64-NEXT: movl %edi, %eax
196 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
197 ; X64-NEXT: andl $-858993460, %edi # imm = 0xCCCCCCCC
198 ; X64-NEXT: shrl $2, %edi
199 ; X64-NEXT: leal (%rdi,%rax,4), %eax
200 ; X64-NEXT: movl %eax, %ecx
201 ; X64-NEXT: andl $1431655765, %ecx # imm = 0x55555555
202 ; X64-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
203 ; X64-NEXT: shrl %eax
204 ; X64-NEXT: leal (%rax,%rcx,2), %eax
206 %b = call i32 @llvm.bitreverse.i32(i32 %a)
210 declare i24 @llvm.bitreverse.i24(i24) readnone
212 define i24 @test_bitreverse_i24(i24 %a) nounwind {
213 ; X86-LABEL: test_bitreverse_i24:
215 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
216 ; X86-NEXT: bswapl %eax
217 ; X86-NEXT: movl %eax, %ecx
218 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
219 ; X86-NEXT: shll $4, %ecx
220 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
221 ; X86-NEXT: shrl $4, %eax
222 ; X86-NEXT: orl %ecx, %eax
223 ; X86-NEXT: movl %eax, %ecx
224 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
225 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
226 ; X86-NEXT: shrl $2, %eax
227 ; X86-NEXT: leal (%eax,%ecx,4), %eax
228 ; X86-NEXT: movl %eax, %ecx
229 ; X86-NEXT: andl $1431655680, %ecx # imm = 0x55555500
230 ; X86-NEXT: andl $-1431655936, %eax # imm = 0xAAAAAA00
231 ; X86-NEXT: shrl %eax
232 ; X86-NEXT: leal (%eax,%ecx,2), %eax
233 ; X86-NEXT: shrl $8, %eax
236 ; X64-LABEL: test_bitreverse_i24:
238 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
239 ; X64-NEXT: bswapl %edi
240 ; X64-NEXT: movl %edi, %eax
241 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
242 ; X64-NEXT: shll $4, %eax
243 ; X64-NEXT: andl $-252645136, %edi # imm = 0xF0F0F0F0
244 ; X64-NEXT: shrl $4, %edi
245 ; X64-NEXT: orl %eax, %edi
246 ; X64-NEXT: movl %edi, %eax
247 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
248 ; X64-NEXT: andl $-858993460, %edi # imm = 0xCCCCCCCC
249 ; X64-NEXT: shrl $2, %edi
250 ; X64-NEXT: leal (%rdi,%rax,4), %eax
251 ; X64-NEXT: movl %eax, %ecx
252 ; X64-NEXT: andl $1431655680, %ecx # imm = 0x55555500
253 ; X64-NEXT: andl $-1431655936, %eax # imm = 0xAAAAAA00
254 ; X64-NEXT: shrl %eax
255 ; X64-NEXT: leal (%rax,%rcx,2), %eax
256 ; X64-NEXT: shrl $8, %eax
258 %b = call i24 @llvm.bitreverse.i24(i24 %a)
262 declare i16 @llvm.bitreverse.i16(i16) readnone
264 define i16 @test_bitreverse_i16(i16 %a) nounwind {
265 ; X86-LABEL: test_bitreverse_i16:
267 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
268 ; X86-NEXT: rolw $8, %ax
269 ; X86-NEXT: movl %eax, %ecx
270 ; X86-NEXT: andl $3855, %ecx # imm = 0xF0F
271 ; X86-NEXT: shll $4, %ecx
272 ; X86-NEXT: andl $61680, %eax # imm = 0xF0F0
273 ; X86-NEXT: shrl $4, %eax
274 ; X86-NEXT: orl %ecx, %eax
275 ; X86-NEXT: movl %eax, %ecx
276 ; X86-NEXT: andl $13107, %ecx # imm = 0x3333
277 ; X86-NEXT: andl $52428, %eax # imm = 0xCCCC
278 ; X86-NEXT: shrl $2, %eax
279 ; X86-NEXT: leal (%eax,%ecx,4), %eax
280 ; X86-NEXT: movl %eax, %ecx
281 ; X86-NEXT: andl $21845, %ecx # imm = 0x5555
282 ; X86-NEXT: andl $43690, %eax # imm = 0xAAAA
283 ; X86-NEXT: shrl %eax
284 ; X86-NEXT: leal (%eax,%ecx,2), %eax
285 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
288 ; X64-LABEL: test_bitreverse_i16:
290 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
291 ; X64-NEXT: rolw $8, %di
292 ; X64-NEXT: movl %edi, %eax
293 ; X64-NEXT: andl $3855, %eax # imm = 0xF0F
294 ; X64-NEXT: shll $4, %eax
295 ; X64-NEXT: andl $61680, %edi # imm = 0xF0F0
296 ; X64-NEXT: shrl $4, %edi
297 ; X64-NEXT: orl %eax, %edi
298 ; X64-NEXT: movl %edi, %eax
299 ; X64-NEXT: andl $13107, %eax # imm = 0x3333
300 ; X64-NEXT: andl $52428, %edi # imm = 0xCCCC
301 ; X64-NEXT: shrl $2, %edi
302 ; X64-NEXT: leal (%rdi,%rax,4), %eax
303 ; X64-NEXT: movl %eax, %ecx
304 ; X64-NEXT: andl $21845, %ecx # imm = 0x5555
305 ; X64-NEXT: andl $43690, %eax # imm = 0xAAAA
306 ; X64-NEXT: shrl %eax
307 ; X64-NEXT: leal (%rax,%rcx,2), %eax
308 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
310 %b = call i16 @llvm.bitreverse.i16(i16 %a)
314 declare i8 @llvm.bitreverse.i8(i8) readnone
316 define i8 @test_bitreverse_i8(i8 %a) {
317 ; X86-LABEL: test_bitreverse_i8:
319 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
320 ; X86-NEXT: rolb $4, %al
321 ; X86-NEXT: movl %eax, %ecx
322 ; X86-NEXT: andb $51, %cl
323 ; X86-NEXT: shlb $2, %cl
324 ; X86-NEXT: andb $-52, %al
325 ; X86-NEXT: shrb $2, %al
326 ; X86-NEXT: orb %cl, %al
327 ; X86-NEXT: movl %eax, %ecx
328 ; X86-NEXT: andb $85, %cl
329 ; X86-NEXT: addb %cl, %cl
330 ; X86-NEXT: andb $-86, %al
332 ; X86-NEXT: orb %cl, %al
335 ; X64-LABEL: test_bitreverse_i8:
337 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
338 ; X64-NEXT: rolb $4, %dil
339 ; X64-NEXT: movl %edi, %eax
340 ; X64-NEXT: andb $51, %al
341 ; X64-NEXT: shlb $2, %al
342 ; X64-NEXT: andb $-52, %dil
343 ; X64-NEXT: shrb $2, %dil
344 ; X64-NEXT: orb %al, %dil
345 ; X64-NEXT: movl %edi, %eax
346 ; X64-NEXT: andb $85, %al
347 ; X64-NEXT: addb %al, %al
348 ; X64-NEXT: andb $-86, %dil
349 ; X64-NEXT: shrb %dil
350 ; X64-NEXT: addl %edi, %eax
351 ; X64-NEXT: # kill: def $al killed $al killed $eax
353 %b = call i8 @llvm.bitreverse.i8(i8 %a)
357 declare i4 @llvm.bitreverse.i4(i4) readnone
359 define i4 @test_bitreverse_i4(i4 %a) {
360 ; X86-LABEL: test_bitreverse_i4:
362 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
363 ; X86-NEXT: rolb $4, %al
364 ; X86-NEXT: movl %eax, %ecx
365 ; X86-NEXT: andb $51, %cl
366 ; X86-NEXT: shlb $2, %cl
367 ; X86-NEXT: andb $-52, %al
368 ; X86-NEXT: shrb $2, %al
369 ; X86-NEXT: orb %cl, %al
370 ; X86-NEXT: movl %eax, %ecx
371 ; X86-NEXT: andb $80, %cl
372 ; X86-NEXT: addb %cl, %cl
373 ; X86-NEXT: andb $-96, %al
375 ; X86-NEXT: orb %cl, %al
376 ; X86-NEXT: shrb $4, %al
379 ; X64-LABEL: test_bitreverse_i4:
381 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
382 ; X64-NEXT: rolb $4, %dil
383 ; X64-NEXT: movl %edi, %eax
384 ; X64-NEXT: andb $51, %al
385 ; X64-NEXT: shlb $2, %al
386 ; X64-NEXT: andb $-52, %dil
387 ; X64-NEXT: shrb $2, %dil
388 ; X64-NEXT: orb %al, %dil
389 ; X64-NEXT: movl %edi, %eax
390 ; X64-NEXT: andb $80, %al
391 ; X64-NEXT: addb %al, %al
392 ; X64-NEXT: andb $-96, %dil
393 ; X64-NEXT: shrb %dil
394 ; X64-NEXT: addl %edi, %eax
395 ; X64-NEXT: shrb $4, %al
396 ; X64-NEXT: # kill: def $al killed $al killed $eax
398 %b = call i4 @llvm.bitreverse.i4(i4 %a)
402 ; These tests check that bitreverse(constant) calls are folded
404 define <2 x i16> @fold_v2i16() {
405 ; X86-LABEL: fold_v2i16:
407 ; X86-NEXT: movw $-4096, %ax # imm = 0xF000
408 ; X86-NEXT: movw $240, %dx
411 ; X64-LABEL: fold_v2i16:
413 ; X64-NEXT: movaps {{.*#+}} xmm0 = [61440,240]
415 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> <i16 15, i16 3840>)
419 define i24 @fold_i24() {
420 ; X86-LABEL: fold_i24:
422 ; X86-NEXT: movl $2048, %eax # imm = 0x800
425 ; X64-LABEL: fold_i24:
427 ; X64-NEXT: movl $2048, %eax # imm = 0x800
429 %b = call i24 @llvm.bitreverse.i24(i24 4096)
433 define i8 @fold_i8() {
434 ; X86-LABEL: fold_i8:
436 ; X86-NEXT: movb $-16, %al
439 ; X64-LABEL: fold_i8:
441 ; X64-NEXT: movb $-16, %al
443 %b = call i8 @llvm.bitreverse.i8(i8 15)
447 define i4 @fold_i4() {
448 ; X86-LABEL: fold_i4:
450 ; X86-NEXT: movb $1, %al
453 ; X64-LABEL: fold_i4:
455 ; X64-NEXT: movb $1, %al
457 %b = call i4 @llvm.bitreverse.i4(i4 8)
461 ; These tests check that bitreverse(bitreverse()) calls are removed
463 define i8 @identity_i8(i8 %a) {
464 ; X86-LABEL: identity_i8:
466 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
469 ; X64-LABEL: identity_i8:
471 ; X64-NEXT: movl %edi, %eax
472 ; X64-NEXT: # kill: def $al killed $al killed $eax
474 %b = call i8 @llvm.bitreverse.i8(i8 %a)
475 %c = call i8 @llvm.bitreverse.i8(i8 %b)
479 define <2 x i16> @identity_v2i16(<2 x i16> %a) {
480 ; X86-LABEL: identity_v2i16:
482 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
483 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx
486 ; X64-LABEL: identity_v2i16:
489 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> %a)
490 %c = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> %b)
494 ; These tests check that bitreverse(undef) calls are removed
496 define i8 @undef_i8() {
497 ; X86-LABEL: undef_i8:
501 ; X64-LABEL: undef_i8:
504 %b = call i8 @llvm.bitreverse.i8(i8 undef)
508 define <2 x i16> @undef_v2i16() {
509 ; X86-LABEL: undef_v2i16:
513 ; X64-LABEL: undef_v2i16:
516 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> undef)
520 ; Make sure we don't assert during type legalization promoting a large
521 ; bitreverse due to the need for a large shift that won't fit in the i8 returned
522 ; from getShiftAmountTy.
523 define i528 @large_promotion(i528 %A) nounwind {
524 ; X86-LABEL: large_promotion:
526 ; X86-NEXT: pushl %ebp
527 ; X86-NEXT: pushl %ebx
528 ; X86-NEXT: pushl %edi
529 ; X86-NEXT: pushl %esi
530 ; X86-NEXT: subl $56, %esp
531 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
532 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
533 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
534 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
535 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
536 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
537 ; X86-NEXT: bswapl %ebx
538 ; X86-NEXT: movl %ebx, %ebp
539 ; X86-NEXT: andl $252645135, %ebp # imm = 0xF0F0F0F
540 ; X86-NEXT: shll $4, %ebp
541 ; X86-NEXT: andl $-252645136, %ebx # imm = 0xF0F0F0F0
542 ; X86-NEXT: shrl $4, %ebx
543 ; X86-NEXT: orl %ebp, %ebx
544 ; X86-NEXT: movl %ebx, %ebp
545 ; X86-NEXT: andl $858993459, %ebp # imm = 0x33333333
546 ; X86-NEXT: andl $-858993460, %ebx # imm = 0xCCCCCCCC
547 ; X86-NEXT: shrl $2, %ebx
548 ; X86-NEXT: leal (%ebx,%ebp,4), %ebx
549 ; X86-NEXT: movl %ebx, %ebp
550 ; X86-NEXT: andl $1431633920, %ebp # imm = 0x55550000
551 ; X86-NEXT: andl $-1431699456, %ebx # imm = 0xAAAA0000
552 ; X86-NEXT: shrl %ebx
553 ; X86-NEXT: leal (%ebx,%ebp,2), %ebx
554 ; X86-NEXT: movl %ebx, (%esp) # 4-byte Spill
555 ; X86-NEXT: bswapl %edi
556 ; X86-NEXT: movl %edi, %ebx
557 ; X86-NEXT: andl $252645135, %ebx # imm = 0xF0F0F0F
558 ; X86-NEXT: shll $4, %ebx
559 ; X86-NEXT: andl $-252645136, %edi # imm = 0xF0F0F0F0
560 ; X86-NEXT: shrl $4, %edi
561 ; X86-NEXT: orl %ebx, %edi
562 ; X86-NEXT: movl %edi, %ebx
563 ; X86-NEXT: andl $858993459, %ebx # imm = 0x33333333
564 ; X86-NEXT: andl $-858993460, %edi # imm = 0xCCCCCCCC
565 ; X86-NEXT: shrl $2, %edi
566 ; X86-NEXT: leal (%edi,%ebx,4), %edi
567 ; X86-NEXT: movl %edi, %ebx
568 ; X86-NEXT: andl $1431655765, %ebx # imm = 0x55555555
569 ; X86-NEXT: andl $-1431655766, %edi # imm = 0xAAAAAAAA
570 ; X86-NEXT: shrl %edi
571 ; X86-NEXT: leal (%edi,%ebx,2), %edi
572 ; X86-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
573 ; X86-NEXT: bswapl %esi
574 ; X86-NEXT: movl %esi, %edi
575 ; X86-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
576 ; X86-NEXT: shll $4, %edi
577 ; X86-NEXT: andl $-252645136, %esi # imm = 0xF0F0F0F0
578 ; X86-NEXT: shrl $4, %esi
579 ; X86-NEXT: orl %edi, %esi
580 ; X86-NEXT: movl %esi, %edi
581 ; X86-NEXT: andl $858993459, %edi # imm = 0x33333333
582 ; X86-NEXT: andl $-858993460, %esi # imm = 0xCCCCCCCC
583 ; X86-NEXT: shrl $2, %esi
584 ; X86-NEXT: leal (%esi,%edi,4), %esi
585 ; X86-NEXT: movl %esi, %edi
586 ; X86-NEXT: andl $1431655765, %edi # imm = 0x55555555
587 ; X86-NEXT: andl $-1431655766, %esi # imm = 0xAAAAAAAA
588 ; X86-NEXT: shrl %esi
589 ; X86-NEXT: leal (%esi,%edi,2), %ebx
590 ; X86-NEXT: bswapl %edx
591 ; X86-NEXT: movl %edx, %esi
592 ; X86-NEXT: andl $252645135, %esi # imm = 0xF0F0F0F
593 ; X86-NEXT: shll $4, %esi
594 ; X86-NEXT: andl $-252645136, %edx # imm = 0xF0F0F0F0
595 ; X86-NEXT: shrl $4, %edx
596 ; X86-NEXT: orl %esi, %edx
597 ; X86-NEXT: movl %edx, %esi
598 ; X86-NEXT: andl $858993459, %esi # imm = 0x33333333
599 ; X86-NEXT: andl $-858993460, %edx # imm = 0xCCCCCCCC
600 ; X86-NEXT: shrl $2, %edx
601 ; X86-NEXT: leal (%edx,%esi,4), %edx
602 ; X86-NEXT: movl %edx, %esi
603 ; X86-NEXT: andl $1431655765, %esi # imm = 0x55555555
604 ; X86-NEXT: andl $-1431655766, %edx # imm = 0xAAAAAAAA
605 ; X86-NEXT: shrl %edx
606 ; X86-NEXT: leal (%edx,%esi,2), %edx
607 ; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
608 ; X86-NEXT: bswapl %ecx
609 ; X86-NEXT: movl %ecx, %edx
610 ; X86-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
611 ; X86-NEXT: shll $4, %edx
612 ; X86-NEXT: andl $-252645136, %ecx # imm = 0xF0F0F0F0
613 ; X86-NEXT: shrl $4, %ecx
614 ; X86-NEXT: orl %edx, %ecx
615 ; X86-NEXT: movl %ecx, %edx
616 ; X86-NEXT: andl $858993459, %edx # imm = 0x33333333
617 ; X86-NEXT: andl $-858993460, %ecx # imm = 0xCCCCCCCC
618 ; X86-NEXT: shrl $2, %ecx
619 ; X86-NEXT: leal (%ecx,%edx,4), %ecx
620 ; X86-NEXT: movl %ecx, %edx
621 ; X86-NEXT: andl $1431655765, %edx # imm = 0x55555555
622 ; X86-NEXT: andl $-1431655766, %ecx # imm = 0xAAAAAAAA
623 ; X86-NEXT: shrl %ecx
624 ; X86-NEXT: leal (%ecx,%edx,2), %ecx
625 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
626 ; X86-NEXT: bswapl %eax
627 ; X86-NEXT: movl %eax, %ecx
628 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
629 ; X86-NEXT: shll $4, %ecx
630 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
631 ; X86-NEXT: shrl $4, %eax
632 ; X86-NEXT: orl %ecx, %eax
633 ; X86-NEXT: movl %eax, %ecx
634 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
635 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
636 ; X86-NEXT: shrl $2, %eax
637 ; X86-NEXT: leal (%eax,%ecx,4), %eax
638 ; X86-NEXT: movl %eax, %ecx
639 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
640 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
641 ; X86-NEXT: shrl %eax
642 ; X86-NEXT: leal (%eax,%ecx,2), %eax
643 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
644 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
645 ; X86-NEXT: bswapl %eax
646 ; X86-NEXT: movl %eax, %ecx
647 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
648 ; X86-NEXT: shll $4, %ecx
649 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
650 ; X86-NEXT: shrl $4, %eax
651 ; X86-NEXT: orl %ecx, %eax
652 ; X86-NEXT: movl %eax, %ecx
653 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
654 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
655 ; X86-NEXT: shrl $2, %eax
656 ; X86-NEXT: leal (%eax,%ecx,4), %eax
657 ; X86-NEXT: movl %eax, %ecx
658 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
659 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
660 ; X86-NEXT: shrl %eax
661 ; X86-NEXT: leal (%eax,%ecx,2), %eax
662 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
663 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
664 ; X86-NEXT: bswapl %eax
665 ; X86-NEXT: movl %eax, %ecx
666 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
667 ; X86-NEXT: shll $4, %ecx
668 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
669 ; X86-NEXT: shrl $4, %eax
670 ; X86-NEXT: orl %ecx, %eax
671 ; X86-NEXT: movl %eax, %ecx
672 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
673 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
674 ; X86-NEXT: shrl $2, %eax
675 ; X86-NEXT: leal (%eax,%ecx,4), %eax
676 ; X86-NEXT: movl %eax, %ecx
677 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
678 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
679 ; X86-NEXT: shrl %eax
680 ; X86-NEXT: leal (%eax,%ecx,2), %eax
681 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
682 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
683 ; X86-NEXT: bswapl %eax
684 ; X86-NEXT: movl %eax, %ecx
685 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
686 ; X86-NEXT: shll $4, %ecx
687 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
688 ; X86-NEXT: shrl $4, %eax
689 ; X86-NEXT: orl %ecx, %eax
690 ; X86-NEXT: movl %eax, %ecx
691 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
692 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
693 ; X86-NEXT: shrl $2, %eax
694 ; X86-NEXT: leal (%eax,%ecx,4), %eax
695 ; X86-NEXT: movl %eax, %ecx
696 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
697 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
698 ; X86-NEXT: shrl %eax
699 ; X86-NEXT: leal (%eax,%ecx,2), %eax
700 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
701 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
702 ; X86-NEXT: bswapl %eax
703 ; X86-NEXT: movl %eax, %ecx
704 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
705 ; X86-NEXT: shll $4, %ecx
706 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
707 ; X86-NEXT: shrl $4, %eax
708 ; X86-NEXT: orl %ecx, %eax
709 ; X86-NEXT: movl %eax, %ecx
710 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
711 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
712 ; X86-NEXT: shrl $2, %eax
713 ; X86-NEXT: leal (%eax,%ecx,4), %eax
714 ; X86-NEXT: movl %eax, %ecx
715 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
716 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
717 ; X86-NEXT: shrl %eax
718 ; X86-NEXT: leal (%eax,%ecx,2), %eax
719 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
720 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
721 ; X86-NEXT: bswapl %eax
722 ; X86-NEXT: movl %eax, %ecx
723 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
724 ; X86-NEXT: shll $4, %ecx
725 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
726 ; X86-NEXT: shrl $4, %eax
727 ; X86-NEXT: orl %ecx, %eax
728 ; X86-NEXT: movl %eax, %ecx
729 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
730 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
731 ; X86-NEXT: shrl $2, %eax
732 ; X86-NEXT: leal (%eax,%ecx,4), %eax
733 ; X86-NEXT: movl %eax, %ecx
734 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
735 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
736 ; X86-NEXT: shrl %eax
737 ; X86-NEXT: leal (%eax,%ecx,2), %eax
738 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
739 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
740 ; X86-NEXT: bswapl %eax
741 ; X86-NEXT: movl %eax, %ecx
742 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
743 ; X86-NEXT: shll $4, %ecx
744 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
745 ; X86-NEXT: shrl $4, %eax
746 ; X86-NEXT: orl %ecx, %eax
747 ; X86-NEXT: movl %eax, %ecx
748 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
749 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
750 ; X86-NEXT: shrl $2, %eax
751 ; X86-NEXT: leal (%eax,%ecx,4), %eax
752 ; X86-NEXT: movl %eax, %ecx
753 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
754 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
755 ; X86-NEXT: shrl %eax
756 ; X86-NEXT: leal (%eax,%ecx,2), %eax
757 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
758 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
759 ; X86-NEXT: bswapl %eax
760 ; X86-NEXT: movl %eax, %ecx
761 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
762 ; X86-NEXT: shll $4, %ecx
763 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
764 ; X86-NEXT: shrl $4, %eax
765 ; X86-NEXT: orl %ecx, %eax
766 ; X86-NEXT: movl %eax, %ecx
767 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
768 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
769 ; X86-NEXT: shrl $2, %eax
770 ; X86-NEXT: leal (%eax,%ecx,4), %eax
771 ; X86-NEXT: movl %eax, %ecx
772 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
773 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
774 ; X86-NEXT: shrl %eax
775 ; X86-NEXT: leal (%eax,%ecx,2), %eax
776 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
777 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
778 ; X86-NEXT: bswapl %eax
779 ; X86-NEXT: movl %eax, %ecx
780 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
781 ; X86-NEXT: shll $4, %ecx
782 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
783 ; X86-NEXT: shrl $4, %eax
784 ; X86-NEXT: orl %ecx, %eax
785 ; X86-NEXT: movl %eax, %ecx
786 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
787 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
788 ; X86-NEXT: shrl $2, %eax
789 ; X86-NEXT: leal (%eax,%ecx,4), %eax
790 ; X86-NEXT: movl %eax, %ecx
791 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
792 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
793 ; X86-NEXT: shrl %eax
794 ; X86-NEXT: leal (%eax,%ecx,2), %eax
795 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
796 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
797 ; X86-NEXT: bswapl %eax
798 ; X86-NEXT: movl %eax, %ecx
799 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
800 ; X86-NEXT: shll $4, %ecx
801 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
802 ; X86-NEXT: shrl $4, %eax
803 ; X86-NEXT: orl %ecx, %eax
804 ; X86-NEXT: movl %eax, %ecx
805 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
806 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
807 ; X86-NEXT: shrl $2, %eax
808 ; X86-NEXT: leal (%eax,%ecx,4), %eax
809 ; X86-NEXT: movl %eax, %ecx
810 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
811 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
812 ; X86-NEXT: shrl %eax
813 ; X86-NEXT: leal (%eax,%ecx,2), %eax
814 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
815 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
816 ; X86-NEXT: bswapl %eax
817 ; X86-NEXT: movl %eax, %ecx
818 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
819 ; X86-NEXT: shll $4, %ecx
820 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
821 ; X86-NEXT: shrl $4, %eax
822 ; X86-NEXT: orl %ecx, %eax
823 ; X86-NEXT: movl %eax, %ecx
824 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
825 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
826 ; X86-NEXT: shrl $2, %eax
827 ; X86-NEXT: leal (%eax,%ecx,4), %eax
828 ; X86-NEXT: movl %eax, %ecx
829 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
830 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
831 ; X86-NEXT: shrl %eax
832 ; X86-NEXT: leal (%eax,%ecx,2), %edi
833 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
834 ; X86-NEXT: bswapl %eax
835 ; X86-NEXT: movl %eax, %ecx
836 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
837 ; X86-NEXT: shll $4, %ecx
838 ; X86-NEXT: andl $-252645136, %eax # imm = 0xF0F0F0F0
839 ; X86-NEXT: shrl $4, %eax
840 ; X86-NEXT: orl %ecx, %eax
841 ; X86-NEXT: movl %eax, %ecx
842 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
843 ; X86-NEXT: andl $-858993460, %eax # imm = 0xCCCCCCCC
844 ; X86-NEXT: shrl $2, %eax
845 ; X86-NEXT: leal (%eax,%ecx,4), %eax
846 ; X86-NEXT: movl %eax, %ecx
847 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
848 ; X86-NEXT: andl $-1431655766, %eax # imm = 0xAAAAAAAA
849 ; X86-NEXT: shrl %eax
850 ; X86-NEXT: leal (%eax,%ecx,2), %edx
851 ; X86-NEXT: movl (%esp), %esi # 4-byte Reload
852 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
853 ; X86-NEXT: shrdl $16, %eax, %esi
854 ; X86-NEXT: shrdl $16, %ebx, %eax
855 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
856 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
857 ; X86-NEXT: shrdl $16, %ecx, %ebx
858 ; X86-NEXT: movl %ebx, (%esp) # 4-byte Spill
859 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
860 ; X86-NEXT: shrdl $16, %eax, %ecx
861 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
862 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
863 ; X86-NEXT: shrdl $16, %ecx, %eax
864 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
865 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
866 ; X86-NEXT: shrdl $16, %eax, %ecx
867 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
868 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
869 ; X86-NEXT: shrdl $16, %ecx, %eax
870 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
871 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
872 ; X86-NEXT: shrdl $16, %eax, %ecx
873 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
874 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
875 ; X86-NEXT: shrdl $16, %ecx, %eax
876 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
877 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
878 ; X86-NEXT: shrdl $16, %eax, %ecx
879 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
880 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
881 ; X86-NEXT: shrdl $16, %ecx, %eax
882 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
883 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Reload
884 ; X86-NEXT: shrdl $16, %ebp, %ecx
885 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
886 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
887 ; X86-NEXT: shrdl $16, %ebx, %ebp
888 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
889 ; X86-NEXT: shrdl $16, %eax, %ebx
890 ; X86-NEXT: shrdl $16, %edi, %eax
891 ; X86-NEXT: movl %eax, %ecx
892 ; X86-NEXT: shrdl $16, %edx, %edi
893 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
894 ; X86-NEXT: movl %edi, 60(%eax)
895 ; X86-NEXT: movl %ecx, 56(%eax)
896 ; X86-NEXT: movl %ebx, 52(%eax)
897 ; X86-NEXT: movl %ebp, 48(%eax)
898 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
899 ; X86-NEXT: movl %ecx, 44(%eax)
900 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
901 ; X86-NEXT: movl %ecx, 40(%eax)
902 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
903 ; X86-NEXT: movl %ecx, 36(%eax)
904 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
905 ; X86-NEXT: movl %ecx, 32(%eax)
906 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
907 ; X86-NEXT: movl %ecx, 28(%eax)
908 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
909 ; X86-NEXT: movl %ecx, 24(%eax)
910 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
911 ; X86-NEXT: movl %ecx, 20(%eax)
912 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
913 ; X86-NEXT: movl %ecx, 16(%eax)
914 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
915 ; X86-NEXT: movl %ecx, 12(%eax)
916 ; X86-NEXT: movl (%esp), %ecx # 4-byte Reload
917 ; X86-NEXT: movl %ecx, 8(%eax)
918 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
919 ; X86-NEXT: movl %ecx, 4(%eax)
920 ; X86-NEXT: movl %esi, (%eax)
921 ; X86-NEXT: shrl $16, %edx
922 ; X86-NEXT: movw %dx, 64(%eax)
923 ; X86-NEXT: addl $56, %esp
924 ; X86-NEXT: popl %esi
925 ; X86-NEXT: popl %edi
926 ; X86-NEXT: popl %ebx
927 ; X86-NEXT: popl %ebp
930 ; X64-LABEL: large_promotion:
932 ; X64-NEXT: pushq %rbp
933 ; X64-NEXT: pushq %r15
934 ; X64-NEXT: pushq %r14
935 ; X64-NEXT: pushq %r13
936 ; X64-NEXT: pushq %r12
937 ; X64-NEXT: pushq %rbx
938 ; X64-NEXT: movq %rdi, %r12
939 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %rbp
940 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %rbx
941 ; X64-NEXT: bswapq %rbx
942 ; X64-NEXT: movabsq $1085102592571150095, %r13 # imm = 0xF0F0F0F0F0F0F0F
943 ; X64-NEXT: movq %rbx, %r10
944 ; X64-NEXT: andq %r13, %r10
945 ; X64-NEXT: shlq $4, %r10
946 ; X64-NEXT: movabsq $-1085102592571150096, %rax # imm = 0xF0F0F0F0F0F0F0F0
947 ; X64-NEXT: andq %rax, %rbx
948 ; X64-NEXT: shrq $4, %rbx
949 ; X64-NEXT: orq %r10, %rbx
950 ; X64-NEXT: movabsq $3689348814741910323, %r11 # imm = 0x3333333333333333
951 ; X64-NEXT: movq %rbx, %r10
952 ; X64-NEXT: andq %r11, %r10
953 ; X64-NEXT: movabsq $-3689348814741910324, %r14 # imm = 0xCCCCCCCCCCCCCCCC
954 ; X64-NEXT: andq %r14, %rbx
955 ; X64-NEXT: shrq $2, %rbx
956 ; X64-NEXT: leaq (%rbx,%r10,4), %r10
957 ; X64-NEXT: movabsq $6148820866244280320, %rbx # imm = 0x5555000000000000
958 ; X64-NEXT: andq %r10, %rbx
959 ; X64-NEXT: movabsq $-6149102341220990976, %rdi # imm = 0xAAAA000000000000
960 ; X64-NEXT: andq %r10, %rdi
961 ; X64-NEXT: shrq %rdi
962 ; X64-NEXT: leaq (%rdi,%rbx,2), %rdi
963 ; X64-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
964 ; X64-NEXT: bswapq %rbp
965 ; X64-NEXT: movq %rbp, %rdi
966 ; X64-NEXT: andq %r13, %rdi
967 ; X64-NEXT: shlq $4, %rdi
968 ; X64-NEXT: andq %rax, %rbp
969 ; X64-NEXT: shrq $4, %rbp
970 ; X64-NEXT: orq %rdi, %rbp
971 ; X64-NEXT: movq %rbp, %rdi
972 ; X64-NEXT: andq %r11, %rdi
973 ; X64-NEXT: andq %r14, %rbp
974 ; X64-NEXT: shrq $2, %rbp
975 ; X64-NEXT: leaq (%rbp,%rdi,4), %rbp
976 ; X64-NEXT: movabsq $6148914691236517205, %rbx # imm = 0x5555555555555555
977 ; X64-NEXT: movq %rbp, %r10
978 ; X64-NEXT: andq %rbx, %r10
979 ; X64-NEXT: movabsq $-6148914691236517206, %rdi # imm = 0xAAAAAAAAAAAAAAAA
980 ; X64-NEXT: andq %rdi, %rbp
981 ; X64-NEXT: shrq %rbp
982 ; X64-NEXT: leaq (%rbp,%r10,2), %rbp
983 ; X64-NEXT: movq %rbp, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
984 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %rbp
985 ; X64-NEXT: bswapq %rbp
986 ; X64-NEXT: movq %rbp, %r10
987 ; X64-NEXT: andq %r13, %r10
988 ; X64-NEXT: shlq $4, %r10
989 ; X64-NEXT: andq %rax, %rbp
990 ; X64-NEXT: movq %rax, %r15
991 ; X64-NEXT: shrq $4, %rbp
992 ; X64-NEXT: orq %r10, %rbp
993 ; X64-NEXT: movq %rbp, %r10
994 ; X64-NEXT: andq %r11, %r10
995 ; X64-NEXT: andq %r14, %rbp
996 ; X64-NEXT: shrq $2, %rbp
997 ; X64-NEXT: leaq (%rbp,%r10,4), %rbp
998 ; X64-NEXT: movq %rbp, %r10
999 ; X64-NEXT: andq %rbx, %r10
1000 ; X64-NEXT: andq %rdi, %rbp
1001 ; X64-NEXT: shrq %rbp
1002 ; X64-NEXT: leaq (%rbp,%r10,2), %rbp
1003 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %r10
1004 ; X64-NEXT: bswapq %r10
1005 ; X64-NEXT: movq %r10, %rax
1006 ; X64-NEXT: andq %r13, %rax
1007 ; X64-NEXT: shlq $4, %rax
1008 ; X64-NEXT: movq %r15, %rdi
1009 ; X64-NEXT: andq %r15, %r10
1010 ; X64-NEXT: shrq $4, %r10
1011 ; X64-NEXT: orq %rax, %r10
1012 ; X64-NEXT: movq %r10, %rax
1013 ; X64-NEXT: andq %r11, %rax
1014 ; X64-NEXT: andq %r14, %r10
1015 ; X64-NEXT: shrq $2, %r10
1016 ; X64-NEXT: leaq (%r10,%rax,4), %rax
1017 ; X64-NEXT: movq %rax, %r10
1018 ; X64-NEXT: andq %rbx, %r10
1019 ; X64-NEXT: movabsq $-6148914691236517206, %r15 # imm = 0xAAAAAAAAAAAAAAAA
1020 ; X64-NEXT: andq %r15, %rax
1021 ; X64-NEXT: shrq %rax
1022 ; X64-NEXT: leaq (%rax,%r10,2), %r10
1023 ; X64-NEXT: bswapq %r9
1024 ; X64-NEXT: movq %r9, %rax
1025 ; X64-NEXT: andq %r13, %rax
1026 ; X64-NEXT: shlq $4, %rax
1027 ; X64-NEXT: andq %rdi, %r9
1028 ; X64-NEXT: shrq $4, %r9
1029 ; X64-NEXT: orq %rax, %r9
1030 ; X64-NEXT: movq %r9, %rax
1031 ; X64-NEXT: andq %r11, %rax
1032 ; X64-NEXT: andq %r14, %r9
1033 ; X64-NEXT: shrq $2, %r9
1034 ; X64-NEXT: leaq (%r9,%rax,4), %rax
1035 ; X64-NEXT: movq %rax, %r9
1036 ; X64-NEXT: andq %rbx, %r9
1037 ; X64-NEXT: andq %r15, %rax
1038 ; X64-NEXT: shrq %rax
1039 ; X64-NEXT: leaq (%rax,%r9,2), %r9
1040 ; X64-NEXT: bswapq %r8
1041 ; X64-NEXT: movq %r8, %rax
1042 ; X64-NEXT: andq %r13, %rax
1043 ; X64-NEXT: shlq $4, %rax
1044 ; X64-NEXT: andq %rdi, %r8
1045 ; X64-NEXT: shrq $4, %r8
1046 ; X64-NEXT: orq %rax, %r8
1047 ; X64-NEXT: movq %r8, %rax
1048 ; X64-NEXT: andq %r11, %rax
1049 ; X64-NEXT: andq %r14, %r8
1050 ; X64-NEXT: shrq $2, %r8
1051 ; X64-NEXT: leaq (%r8,%rax,4), %rax
1052 ; X64-NEXT: movq %rax, %r8
1053 ; X64-NEXT: andq %rbx, %r8
1054 ; X64-NEXT: andq %r15, %rax
1055 ; X64-NEXT: shrq %rax
1056 ; X64-NEXT: leaq (%rax,%r8,2), %r8
1057 ; X64-NEXT: bswapq %rcx
1058 ; X64-NEXT: movq %rcx, %rax
1059 ; X64-NEXT: andq %r13, %rax
1060 ; X64-NEXT: shlq $4, %rax
1061 ; X64-NEXT: andq %rdi, %rcx
1062 ; X64-NEXT: shrq $4, %rcx
1063 ; X64-NEXT: orq %rax, %rcx
1064 ; X64-NEXT: movq %rcx, %rax
1065 ; X64-NEXT: andq %r11, %rax
1066 ; X64-NEXT: andq %r14, %rcx
1067 ; X64-NEXT: shrq $2, %rcx
1068 ; X64-NEXT: leaq (%rcx,%rax,4), %rax
1069 ; X64-NEXT: movq %rax, %rcx
1070 ; X64-NEXT: andq %rbx, %rcx
1071 ; X64-NEXT: andq %r15, %rax
1072 ; X64-NEXT: shrq %rax
1073 ; X64-NEXT: leaq (%rax,%rcx,2), %rcx
1074 ; X64-NEXT: bswapq %rdx
1075 ; X64-NEXT: movq %rdx, %rax
1076 ; X64-NEXT: andq %r13, %rax
1077 ; X64-NEXT: shlq $4, %rax
1078 ; X64-NEXT: andq %rdi, %rdx
1079 ; X64-NEXT: shrq $4, %rdx
1080 ; X64-NEXT: orq %rax, %rdx
1081 ; X64-NEXT: movq %rdx, %rax
1082 ; X64-NEXT: andq %r11, %rax
1083 ; X64-NEXT: andq %r14, %rdx
1084 ; X64-NEXT: shrq $2, %rdx
1085 ; X64-NEXT: leaq (%rdx,%rax,4), %rax
1086 ; X64-NEXT: movq %rax, %rdx
1087 ; X64-NEXT: andq %rbx, %rdx
1088 ; X64-NEXT: andq %r15, %rax
1089 ; X64-NEXT: shrq %rax
1090 ; X64-NEXT: leaq (%rax,%rdx,2), %rax
1091 ; X64-NEXT: bswapq %rsi
1092 ; X64-NEXT: andq %rsi, %r13
1093 ; X64-NEXT: andq %rdi, %rsi
1094 ; X64-NEXT: shlq $4, %r13
1095 ; X64-NEXT: shrq $4, %rsi
1096 ; X64-NEXT: orq %r13, %rsi
1097 ; X64-NEXT: andq %rsi, %r11
1098 ; X64-NEXT: andq %r14, %rsi
1099 ; X64-NEXT: shrq $2, %rsi
1100 ; X64-NEXT: leaq (%rsi,%r11,4), %rdx
1101 ; X64-NEXT: andq %rdx, %rbx
1102 ; X64-NEXT: andq %r15, %rdx
1103 ; X64-NEXT: shrq %rdx
1104 ; X64-NEXT: leaq (%rdx,%rbx,2), %rdx
1105 ; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
1106 ; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
1107 ; X64-NEXT: shrdq $48, %rdi, %rsi
1108 ; X64-NEXT: shrdq $48, %rbp, %rdi
1109 ; X64-NEXT: shrdq $48, %r10, %rbp
1110 ; X64-NEXT: shrdq $48, %r9, %r10
1111 ; X64-NEXT: shrdq $48, %r8, %r9
1112 ; X64-NEXT: shrdq $48, %rcx, %r8
1113 ; X64-NEXT: shrdq $48, %rax, %rcx
1114 ; X64-NEXT: shrdq $48, %rdx, %rax
1115 ; X64-NEXT: movq %rax, 56(%r12)
1116 ; X64-NEXT: movq %rcx, 48(%r12)
1117 ; X64-NEXT: movq %r8, 40(%r12)
1118 ; X64-NEXT: movq %r9, 32(%r12)
1119 ; X64-NEXT: movq %r10, 24(%r12)
1120 ; X64-NEXT: movq %rbp, 16(%r12)
1121 ; X64-NEXT: movq %rdi, 8(%r12)
1122 ; X64-NEXT: movq %rsi, (%r12)
1123 ; X64-NEXT: shrq $48, %rdx
1124 ; X64-NEXT: movw %dx, 64(%r12)
1125 ; X64-NEXT: movq %r12, %rax
1126 ; X64-NEXT: popq %rbx
1127 ; X64-NEXT: popq %r12
1128 ; X64-NEXT: popq %r13
1129 ; X64-NEXT: popq %r14
1130 ; X64-NEXT: popq %r15
1131 ; X64-NEXT: popq %rbp
1133 %Z = call i528 @llvm.bitreverse.i528(i528 %A)
1136 declare i528 @llvm.bitreverse.i528(i528)