1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefixes=CHECK,X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefixes=CHECK,X64
4 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+xop | FileCheck %s --check-prefixes=CHECK,X86XOP
5 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512bw,+avx512vl,+gfni | FileCheck %s --check-prefixes=CHECK,GFNI
7 ; These tests just check that the plumbing is in place for @llvm.bitreverse. The
8 ; actual output is massive at the moment as llvm.bitreverse is not yet legal.
10 declare <2 x i16> @llvm.bitreverse.v2i16(<2 x i16>) readnone
12 define <2 x i16> @test_bitreverse_v2i16(<2 x i16> %a) nounwind {
13 ; X86-LABEL: test_bitreverse_v2i16:
15 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
16 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
17 ; X86-NEXT: rolw $8, %ax
18 ; X86-NEXT: movl %eax, %edx
19 ; X86-NEXT: andl $3855, %edx # imm = 0xF0F
20 ; X86-NEXT: shll $4, %edx
21 ; X86-NEXT: shrl $4, %eax
22 ; X86-NEXT: andl $3855, %eax # imm = 0xF0F
23 ; X86-NEXT: orl %edx, %eax
24 ; X86-NEXT: movl %eax, %edx
25 ; X86-NEXT: andl $13107, %edx # imm = 0x3333
26 ; X86-NEXT: shrl $2, %eax
27 ; X86-NEXT: andl $13107, %eax # imm = 0x3333
28 ; X86-NEXT: leal (%eax,%edx,4), %eax
29 ; X86-NEXT: movl %eax, %edx
30 ; X86-NEXT: andl $21845, %edx # imm = 0x5555
32 ; X86-NEXT: andl $21845, %eax # imm = 0x5555
33 ; X86-NEXT: leal (%eax,%edx,2), %eax
34 ; X86-NEXT: rolw $8, %cx
35 ; X86-NEXT: movl %ecx, %edx
36 ; X86-NEXT: andl $3855, %edx # imm = 0xF0F
37 ; X86-NEXT: shll $4, %edx
38 ; X86-NEXT: shrl $4, %ecx
39 ; X86-NEXT: andl $3855, %ecx # imm = 0xF0F
40 ; X86-NEXT: orl %edx, %ecx
41 ; X86-NEXT: movl %ecx, %edx
42 ; X86-NEXT: andl $13107, %edx # imm = 0x3333
43 ; X86-NEXT: shrl $2, %ecx
44 ; X86-NEXT: andl $13107, %ecx # imm = 0x3333
45 ; X86-NEXT: leal (%ecx,%edx,4), %ecx
46 ; X86-NEXT: movl %ecx, %edx
47 ; X86-NEXT: andl $21845, %edx # imm = 0x5555
49 ; X86-NEXT: andl $21845, %ecx # imm = 0x5555
50 ; X86-NEXT: leal (%ecx,%edx,2), %edx
51 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
52 ; X86-NEXT: # kill: def $dx killed $dx killed $edx
55 ; X64-LABEL: test_bitreverse_v2i16:
57 ; X64-NEXT: movdqa %xmm0, %xmm1
58 ; X64-NEXT: psrlw $8, %xmm1
59 ; X64-NEXT: psllw $8, %xmm0
60 ; X64-NEXT: por %xmm1, %xmm0
61 ; X64-NEXT: movdqa %xmm0, %xmm1
62 ; X64-NEXT: psrlw $4, %xmm1
63 ; X64-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
64 ; X64-NEXT: pand %xmm2, %xmm1
65 ; X64-NEXT: pand %xmm2, %xmm0
66 ; X64-NEXT: psllw $4, %xmm0
67 ; X64-NEXT: por %xmm1, %xmm0
68 ; X64-NEXT: movdqa %xmm0, %xmm1
69 ; X64-NEXT: psrlw $2, %xmm1
70 ; X64-NEXT: movdqa {{.*#+}} xmm2 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
71 ; X64-NEXT: pand %xmm2, %xmm1
72 ; X64-NEXT: pand %xmm2, %xmm0
73 ; X64-NEXT: psllw $2, %xmm0
74 ; X64-NEXT: por %xmm1, %xmm0
75 ; X64-NEXT: movdqa %xmm0, %xmm1
76 ; X64-NEXT: psrlw $1, %xmm1
77 ; X64-NEXT: movdqa {{.*#+}} xmm2 = [85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85]
78 ; X64-NEXT: pand %xmm2, %xmm1
79 ; X64-NEXT: pand %xmm2, %xmm0
80 ; X64-NEXT: paddb %xmm0, %xmm0
81 ; X64-NEXT: por %xmm1, %xmm0
84 ; X86XOP-LABEL: test_bitreverse_v2i16:
86 ; X86XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0, %xmm0
89 ; GFNI-LABEL: test_bitreverse_v2i16:
91 ; GFNI-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[1,0,3,2,5,4,7,6,9,8,11,10,13,12,15,14]
92 ; GFNI-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
94 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> %a)
98 declare i64 @llvm.bitreverse.i64(i64) readnone
100 define i64 @test_bitreverse_i64(i64 %a) nounwind {
101 ; X86-LABEL: test_bitreverse_i64:
103 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
104 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
105 ; X86-NEXT: bswapl %eax
106 ; X86-NEXT: movl %eax, %edx
107 ; X86-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
108 ; X86-NEXT: shll $4, %edx
109 ; X86-NEXT: shrl $4, %eax
110 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
111 ; X86-NEXT: orl %edx, %eax
112 ; X86-NEXT: movl %eax, %edx
113 ; X86-NEXT: andl $858993459, %edx # imm = 0x33333333
114 ; X86-NEXT: shrl $2, %eax
115 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
116 ; X86-NEXT: leal (%eax,%edx,4), %eax
117 ; X86-NEXT: movl %eax, %edx
118 ; X86-NEXT: andl $1431655765, %edx # imm = 0x55555555
119 ; X86-NEXT: shrl %eax
120 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
121 ; X86-NEXT: leal (%eax,%edx,2), %eax
122 ; X86-NEXT: bswapl %ecx
123 ; X86-NEXT: movl %ecx, %edx
124 ; X86-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
125 ; X86-NEXT: shll $4, %edx
126 ; X86-NEXT: shrl $4, %ecx
127 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
128 ; X86-NEXT: orl %edx, %ecx
129 ; X86-NEXT: movl %ecx, %edx
130 ; X86-NEXT: andl $858993459, %edx # imm = 0x33333333
131 ; X86-NEXT: shrl $2, %ecx
132 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
133 ; X86-NEXT: leal (%ecx,%edx,4), %ecx
134 ; X86-NEXT: movl %ecx, %edx
135 ; X86-NEXT: andl $1431655765, %edx # imm = 0x55555555
136 ; X86-NEXT: shrl %ecx
137 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
138 ; X86-NEXT: leal (%ecx,%edx,2), %edx
141 ; X64-LABEL: test_bitreverse_i64:
143 ; X64-NEXT: bswapq %rdi
144 ; X64-NEXT: movq %rdi, %rax
145 ; X64-NEXT: shrq $4, %rax
146 ; X64-NEXT: movabsq $1085102592571150095, %rcx # imm = 0xF0F0F0F0F0F0F0F
147 ; X64-NEXT: andq %rcx, %rax
148 ; X64-NEXT: andq %rcx, %rdi
149 ; X64-NEXT: shlq $4, %rdi
150 ; X64-NEXT: orq %rax, %rdi
151 ; X64-NEXT: movabsq $3689348814741910323, %rax # imm = 0x3333333333333333
152 ; X64-NEXT: movq %rdi, %rcx
153 ; X64-NEXT: andq %rax, %rcx
154 ; X64-NEXT: shrq $2, %rdi
155 ; X64-NEXT: andq %rax, %rdi
156 ; X64-NEXT: leaq (%rdi,%rcx,4), %rax
157 ; X64-NEXT: movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555
158 ; X64-NEXT: movq %rax, %rdx
159 ; X64-NEXT: andq %rcx, %rdx
160 ; X64-NEXT: shrq %rax
161 ; X64-NEXT: andq %rcx, %rax
162 ; X64-NEXT: leaq (%rax,%rdx,2), %rax
165 ; X86XOP-LABEL: test_bitreverse_i64:
167 ; X86XOP-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
168 ; X86XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0, %xmm0
169 ; X86XOP-NEXT: vmovd %xmm0, %eax
170 ; X86XOP-NEXT: vpextrd $1, %xmm0, %edx
173 ; GFNI-LABEL: test_bitreverse_i64:
175 ; GFNI-NEXT: vmovq %rdi, %xmm0
176 ; GFNI-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
177 ; GFNI-NEXT: vmovq %xmm0, %rax
178 ; GFNI-NEXT: bswapq %rax
180 %b = call i64 @llvm.bitreverse.i64(i64 %a)
184 declare i32 @llvm.bitreverse.i32(i32) readnone
186 define i32 @test_bitreverse_i32(i32 %a) nounwind {
187 ; X86-LABEL: test_bitreverse_i32:
189 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
190 ; X86-NEXT: bswapl %eax
191 ; X86-NEXT: movl %eax, %ecx
192 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
193 ; X86-NEXT: shll $4, %ecx
194 ; X86-NEXT: shrl $4, %eax
195 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
196 ; X86-NEXT: orl %ecx, %eax
197 ; X86-NEXT: movl %eax, %ecx
198 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
199 ; X86-NEXT: shrl $2, %eax
200 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
201 ; X86-NEXT: leal (%eax,%ecx,4), %eax
202 ; X86-NEXT: movl %eax, %ecx
203 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
204 ; X86-NEXT: shrl %eax
205 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
206 ; X86-NEXT: leal (%eax,%ecx,2), %eax
209 ; X64-LABEL: test_bitreverse_i32:
211 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
212 ; X64-NEXT: bswapl %edi
213 ; X64-NEXT: movl %edi, %eax
214 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
215 ; X64-NEXT: shll $4, %eax
216 ; X64-NEXT: shrl $4, %edi
217 ; X64-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
218 ; X64-NEXT: orl %eax, %edi
219 ; X64-NEXT: movl %edi, %eax
220 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
221 ; X64-NEXT: shrl $2, %edi
222 ; X64-NEXT: andl $858993459, %edi # imm = 0x33333333
223 ; X64-NEXT: leal (%rdi,%rax,4), %eax
224 ; X64-NEXT: movl %eax, %ecx
225 ; X64-NEXT: andl $1431655765, %ecx # imm = 0x55555555
226 ; X64-NEXT: shrl %eax
227 ; X64-NEXT: andl $1431655765, %eax # imm = 0x55555555
228 ; X64-NEXT: leal (%rax,%rcx,2), %eax
231 ; X86XOP-LABEL: test_bitreverse_i32:
233 ; X86XOP-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
234 ; X86XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0, %xmm0
235 ; X86XOP-NEXT: vmovd %xmm0, %eax
238 ; GFNI-LABEL: test_bitreverse_i32:
240 ; GFNI-NEXT: vmovd %edi, %xmm0
241 ; GFNI-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
242 ; GFNI-NEXT: vmovd %xmm0, %eax
243 ; GFNI-NEXT: bswapl %eax
245 %b = call i32 @llvm.bitreverse.i32(i32 %a)
249 declare i24 @llvm.bitreverse.i24(i24) readnone
251 define i24 @test_bitreverse_i24(i24 %a) nounwind {
252 ; X86-LABEL: test_bitreverse_i24:
254 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
255 ; X86-NEXT: bswapl %eax
256 ; X86-NEXT: movl %eax, %ecx
257 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
258 ; X86-NEXT: shll $4, %ecx
259 ; X86-NEXT: shrl $4, %eax
260 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
261 ; X86-NEXT: orl %ecx, %eax
262 ; X86-NEXT: movl %eax, %ecx
263 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
264 ; X86-NEXT: shrl $2, %eax
265 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
266 ; X86-NEXT: leal (%eax,%ecx,4), %eax
267 ; X86-NEXT: movl %eax, %ecx
268 ; X86-NEXT: andl $1431655680, %ecx # imm = 0x55555500
269 ; X86-NEXT: shrl %eax
270 ; X86-NEXT: andl $1431655680, %eax # imm = 0x55555500
271 ; X86-NEXT: leal (%eax,%ecx,2), %eax
272 ; X86-NEXT: shrl $8, %eax
275 ; X64-LABEL: test_bitreverse_i24:
277 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
278 ; X64-NEXT: bswapl %edi
279 ; X64-NEXT: movl %edi, %eax
280 ; X64-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
281 ; X64-NEXT: shll $4, %eax
282 ; X64-NEXT: shrl $4, %edi
283 ; X64-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
284 ; X64-NEXT: orl %eax, %edi
285 ; X64-NEXT: movl %edi, %eax
286 ; X64-NEXT: andl $858993459, %eax # imm = 0x33333333
287 ; X64-NEXT: shrl $2, %edi
288 ; X64-NEXT: andl $858993459, %edi # imm = 0x33333333
289 ; X64-NEXT: leal (%rdi,%rax,4), %eax
290 ; X64-NEXT: movl %eax, %ecx
291 ; X64-NEXT: andl $1431655680, %ecx # imm = 0x55555500
292 ; X64-NEXT: shrl %eax
293 ; X64-NEXT: andl $1431655680, %eax # imm = 0x55555500
294 ; X64-NEXT: leal (%rax,%rcx,2), %eax
295 ; X64-NEXT: shrl $8, %eax
298 ; X86XOP-LABEL: test_bitreverse_i24:
300 ; X86XOP-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
301 ; X86XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0, %xmm0
302 ; X86XOP-NEXT: vmovd %xmm0, %eax
303 ; X86XOP-NEXT: shrl $8, %eax
306 ; GFNI-LABEL: test_bitreverse_i24:
308 ; GFNI-NEXT: vmovd %edi, %xmm0
309 ; GFNI-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
310 ; GFNI-NEXT: vmovd %xmm0, %eax
311 ; GFNI-NEXT: bswapl %eax
312 ; GFNI-NEXT: shrl $8, %eax
314 %b = call i24 @llvm.bitreverse.i24(i24 %a)
318 declare i16 @llvm.bitreverse.i16(i16) readnone
320 define i16 @test_bitreverse_i16(i16 %a) nounwind {
321 ; X86-LABEL: test_bitreverse_i16:
323 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
324 ; X86-NEXT: rolw $8, %ax
325 ; X86-NEXT: movl %eax, %ecx
326 ; X86-NEXT: andl $3855, %ecx # imm = 0xF0F
327 ; X86-NEXT: shll $4, %ecx
328 ; X86-NEXT: shrl $4, %eax
329 ; X86-NEXT: andl $3855, %eax # imm = 0xF0F
330 ; X86-NEXT: orl %ecx, %eax
331 ; X86-NEXT: movl %eax, %ecx
332 ; X86-NEXT: andl $13107, %ecx # imm = 0x3333
333 ; X86-NEXT: shrl $2, %eax
334 ; X86-NEXT: andl $13107, %eax # imm = 0x3333
335 ; X86-NEXT: leal (%eax,%ecx,4), %eax
336 ; X86-NEXT: movl %eax, %ecx
337 ; X86-NEXT: andl $21845, %ecx # imm = 0x5555
338 ; X86-NEXT: shrl %eax
339 ; X86-NEXT: andl $21845, %eax # imm = 0x5555
340 ; X86-NEXT: leal (%eax,%ecx,2), %eax
341 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
344 ; X64-LABEL: test_bitreverse_i16:
346 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
347 ; X64-NEXT: rolw $8, %di
348 ; X64-NEXT: movl %edi, %eax
349 ; X64-NEXT: andl $3855, %eax # imm = 0xF0F
350 ; X64-NEXT: shll $4, %eax
351 ; X64-NEXT: shrl $4, %edi
352 ; X64-NEXT: andl $3855, %edi # imm = 0xF0F
353 ; X64-NEXT: orl %eax, %edi
354 ; X64-NEXT: movl %edi, %eax
355 ; X64-NEXT: andl $13107, %eax # imm = 0x3333
356 ; X64-NEXT: shrl $2, %edi
357 ; X64-NEXT: andl $13107, %edi # imm = 0x3333
358 ; X64-NEXT: leal (%rdi,%rax,4), %eax
359 ; X64-NEXT: movl %eax, %ecx
360 ; X64-NEXT: andl $21845, %ecx # imm = 0x5555
361 ; X64-NEXT: shrl %eax
362 ; X64-NEXT: andl $21845, %eax # imm = 0x5555
363 ; X64-NEXT: leal (%rax,%rcx,2), %eax
364 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
367 ; X86XOP-LABEL: test_bitreverse_i16:
369 ; X86XOP-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
370 ; X86XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0, %xmm0
371 ; X86XOP-NEXT: vmovd %xmm0, %eax
372 ; X86XOP-NEXT: # kill: def $ax killed $ax killed $eax
375 ; GFNI-LABEL: test_bitreverse_i16:
377 ; GFNI-NEXT: vmovd %edi, %xmm0
378 ; GFNI-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
379 ; GFNI-NEXT: vmovd %xmm0, %eax
380 ; GFNI-NEXT: rolw $8, %ax
381 ; GFNI-NEXT: # kill: def $ax killed $ax killed $eax
383 %b = call i16 @llvm.bitreverse.i16(i16 %a)
387 declare i8 @llvm.bitreverse.i8(i8) readnone
389 define i8 @test_bitreverse_i8(i8 %a) {
390 ; X86-LABEL: test_bitreverse_i8:
392 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
393 ; X86-NEXT: rolb $4, %al
394 ; X86-NEXT: movl %eax, %ecx
395 ; X86-NEXT: andb $51, %cl
396 ; X86-NEXT: shlb $2, %cl
397 ; X86-NEXT: shrb $2, %al
398 ; X86-NEXT: andb $51, %al
399 ; X86-NEXT: orb %cl, %al
400 ; X86-NEXT: movl %eax, %ecx
401 ; X86-NEXT: andb $85, %cl
402 ; X86-NEXT: addb %cl, %cl
404 ; X86-NEXT: andb $85, %al
405 ; X86-NEXT: orb %cl, %al
408 ; X64-LABEL: test_bitreverse_i8:
410 ; X64-NEXT: rolb $4, %dil
411 ; X64-NEXT: movl %edi, %eax
412 ; X64-NEXT: andb $51, %al
413 ; X64-NEXT: shlb $2, %al
414 ; X64-NEXT: shrb $2, %dil
415 ; X64-NEXT: andb $51, %dil
416 ; X64-NEXT: orb %dil, %al
417 ; X64-NEXT: movl %eax, %ecx
418 ; X64-NEXT: andb $85, %cl
419 ; X64-NEXT: addb %cl, %cl
421 ; X64-NEXT: andb $85, %al
422 ; X64-NEXT: orb %cl, %al
425 ; X86XOP-LABEL: test_bitreverse_i8:
427 ; X86XOP-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
428 ; X86XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0, %xmm0
429 ; X86XOP-NEXT: vmovd %xmm0, %eax
430 ; X86XOP-NEXT: # kill: def $al killed $al killed $eax
433 ; GFNI-LABEL: test_bitreverse_i8:
435 ; GFNI-NEXT: vmovd %edi, %xmm0
436 ; GFNI-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
437 ; GFNI-NEXT: vmovd %xmm0, %eax
438 ; GFNI-NEXT: # kill: def $al killed $al killed $eax
440 %b = call i8 @llvm.bitreverse.i8(i8 %a)
444 declare i4 @llvm.bitreverse.i4(i4) readnone
446 define i4 @test_bitreverse_i4(i4 %a) {
447 ; X86-LABEL: test_bitreverse_i4:
449 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
450 ; X86-NEXT: movl %ecx, %eax
451 ; X86-NEXT: andb $8, %al
452 ; X86-NEXT: movl %ecx, %edx
453 ; X86-NEXT: addb %cl, %dl
454 ; X86-NEXT: andb $4, %dl
455 ; X86-NEXT: movb %cl, %ah
456 ; X86-NEXT: shlb $3, %ah
457 ; X86-NEXT: andb $8, %ah
458 ; X86-NEXT: orb %dl, %ah
460 ; X86-NEXT: andb $2, %cl
461 ; X86-NEXT: orb %ah, %cl
462 ; X86-NEXT: shrb $3, %al
463 ; X86-NEXT: orb %cl, %al
466 ; X64-LABEL: test_bitreverse_i4:
468 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
469 ; X64-NEXT: movl %edi, %eax
470 ; X64-NEXT: andb $8, %al
471 ; X64-NEXT: leal (%rdi,%rdi), %ecx
472 ; X64-NEXT: andb $4, %cl
473 ; X64-NEXT: leal (,%rdi,8), %edx
474 ; X64-NEXT: andb $8, %dl
475 ; X64-NEXT: orb %cl, %dl
476 ; X64-NEXT: shrb %dil
477 ; X64-NEXT: andb $2, %dil
478 ; X64-NEXT: orb %dil, %dl
479 ; X64-NEXT: shrb $3, %al
480 ; X64-NEXT: orb %dl, %al
483 ; X86XOP-LABEL: test_bitreverse_i4:
485 ; X86XOP-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
486 ; X86XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0, %xmm0
487 ; X86XOP-NEXT: vmovd %xmm0, %eax
488 ; X86XOP-NEXT: shrb $4, %al
489 ; X86XOP-NEXT: # kill: def $al killed $al killed $eax
492 ; GFNI-LABEL: test_bitreverse_i4:
494 ; GFNI-NEXT: vmovd %edi, %xmm0
495 ; GFNI-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
496 ; GFNI-NEXT: vmovd %xmm0, %eax
497 ; GFNI-NEXT: shrb $4, %al
498 ; GFNI-NEXT: # kill: def $al killed $al killed $eax
500 %b = call i4 @llvm.bitreverse.i4(i4 %a)
504 ; These tests check that bitreverse(constant) calls are folded
506 define <2 x i16> @fold_v2i16() {
507 ; X86-LABEL: fold_v2i16:
509 ; X86-NEXT: movw $-4096, %ax # imm = 0xF000
510 ; X86-NEXT: movw $240, %dx
513 ; X64-LABEL: fold_v2i16:
515 ; X64-NEXT: movss {{.*#+}} xmm0 = [61440,240,0,0,0,0,0,0]
518 ; X86XOP-LABEL: fold_v2i16:
520 ; X86XOP-NEXT: vmovss {{.*#+}} xmm0 = [61440,240,0,0,0,0,0,0]
523 ; GFNI-LABEL: fold_v2i16:
525 ; GFNI-NEXT: vmovss {{.*#+}} xmm0 = [61440,240,0,0,0,0,0,0]
527 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> <i16 15, i16 3840>)
531 define i24 @fold_i24() {
532 ; CHECK-LABEL: fold_i24:
534 ; CHECK-NEXT: movl $2048, %eax # imm = 0x800
535 ; CHECK-NEXT: ret{{[l|q]}}
536 %b = call i24 @llvm.bitreverse.i24(i24 4096)
540 define i8 @fold_i8() {
541 ; CHECK-LABEL: fold_i8:
543 ; CHECK-NEXT: movb $-16, %al
544 ; CHECK-NEXT: ret{{[l|q]}}
545 %b = call i8 @llvm.bitreverse.i8(i8 15)
549 define i4 @fold_i4() {
550 ; CHECK-LABEL: fold_i4:
552 ; CHECK-NEXT: movb $1, %al
553 ; CHECK-NEXT: ret{{[l|q]}}
554 %b = call i4 @llvm.bitreverse.i4(i4 8)
558 ; These tests check that bitreverse(bitreverse()) calls are removed
560 define i8 @identity_i8(i8 %a) {
561 ; X86-LABEL: identity_i8:
563 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
566 ; X64-LABEL: identity_i8:
568 ; X64-NEXT: movl %edi, %eax
569 ; X64-NEXT: # kill: def $al killed $al killed $eax
572 ; X86XOP-LABEL: identity_i8:
574 ; X86XOP-NEXT: movzbl {{[0-9]+}}(%esp), %eax
577 ; GFNI-LABEL: identity_i8:
579 ; GFNI-NEXT: movl %edi, %eax
580 ; GFNI-NEXT: # kill: def $al killed $al killed $eax
582 %b = call i8 @llvm.bitreverse.i8(i8 %a)
583 %c = call i8 @llvm.bitreverse.i8(i8 %b)
587 define <2 x i16> @identity_v2i16(<2 x i16> %a) {
588 ; X86-LABEL: identity_v2i16:
590 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
591 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx
594 ; X64-LABEL: identity_v2i16:
598 ; X86XOP-LABEL: identity_v2i16:
602 ; GFNI-LABEL: identity_v2i16:
605 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> %a)
606 %c = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> %b)
610 ; These tests check that bitreverse(undef) calls are removed
612 define i8 @undef_i8() {
613 ; CHECK-LABEL: undef_i8:
615 ; CHECK-NEXT: ret{{[l|q]}}
616 %b = call i8 @llvm.bitreverse.i8(i8 undef)
620 define <2 x i16> @undef_v2i16() {
621 ; CHECK-LABEL: undef_v2i16:
623 ; CHECK-NEXT: ret{{[l|q]}}
624 %b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> undef)
628 ; Make sure we don't assert during type legalization promoting a large
629 ; bitreverse due to the need for a large shift that won't fit in the i8 returned
630 ; from getShiftAmountTy.
631 define i528 @large_promotion(i528 %A) nounwind {
632 ; X86-LABEL: large_promotion:
634 ; X86-NEXT: pushl %ebp
635 ; X86-NEXT: pushl %ebx
636 ; X86-NEXT: pushl %edi
637 ; X86-NEXT: pushl %esi
638 ; X86-NEXT: subl $60, %esp
639 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
640 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
641 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
642 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
643 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
644 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
645 ; X86-NEXT: bswapl %ebx
646 ; X86-NEXT: movl %ebx, %ebp
647 ; X86-NEXT: andl $252645135, %ebp # imm = 0xF0F0F0F
648 ; X86-NEXT: shll $4, %ebp
649 ; X86-NEXT: shrl $4, %ebx
650 ; X86-NEXT: andl $252645135, %ebx # imm = 0xF0F0F0F
651 ; X86-NEXT: orl %ebp, %ebx
652 ; X86-NEXT: movl %ebx, %ebp
653 ; X86-NEXT: andl $858993459, %ebp # imm = 0x33333333
654 ; X86-NEXT: shrl $2, %ebx
655 ; X86-NEXT: andl $858993459, %ebx # imm = 0x33333333
656 ; X86-NEXT: leal (%ebx,%ebp,4), %ebx
657 ; X86-NEXT: movl %ebx, %ebp
658 ; X86-NEXT: andl $1431633920, %ebp # imm = 0x55550000
659 ; X86-NEXT: shrl %ebx
660 ; X86-NEXT: andl $1431633920, %ebx # imm = 0x55550000
661 ; X86-NEXT: leal (%ebx,%ebp,2), %ebp
662 ; X86-NEXT: bswapl %edi
663 ; X86-NEXT: movl %edi, %ebx
664 ; X86-NEXT: andl $252645135, %ebx # imm = 0xF0F0F0F
665 ; X86-NEXT: shll $4, %ebx
666 ; X86-NEXT: shrl $4, %edi
667 ; X86-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
668 ; X86-NEXT: orl %ebx, %edi
669 ; X86-NEXT: movl %edi, %ebx
670 ; X86-NEXT: andl $858993459, %ebx # imm = 0x33333333
671 ; X86-NEXT: shrl $2, %edi
672 ; X86-NEXT: andl $858993459, %edi # imm = 0x33333333
673 ; X86-NEXT: leal (%edi,%ebx,4), %edi
674 ; X86-NEXT: movl %edi, %ebx
675 ; X86-NEXT: andl $1431655765, %ebx # imm = 0x55555555
676 ; X86-NEXT: shrl %edi
677 ; X86-NEXT: andl $1431655765, %edi # imm = 0x55555555
678 ; X86-NEXT: leal (%edi,%ebx,2), %edi
679 ; X86-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
680 ; X86-NEXT: bswapl %esi
681 ; X86-NEXT: movl %esi, %edi
682 ; X86-NEXT: andl $252645135, %edi # imm = 0xF0F0F0F
683 ; X86-NEXT: shll $4, %edi
684 ; X86-NEXT: shrl $4, %esi
685 ; X86-NEXT: andl $252645135, %esi # imm = 0xF0F0F0F
686 ; X86-NEXT: orl %edi, %esi
687 ; X86-NEXT: movl %esi, %edi
688 ; X86-NEXT: andl $858993459, %edi # imm = 0x33333333
689 ; X86-NEXT: shrl $2, %esi
690 ; X86-NEXT: andl $858993459, %esi # imm = 0x33333333
691 ; X86-NEXT: leal (%esi,%edi,4), %esi
692 ; X86-NEXT: movl %esi, %edi
693 ; X86-NEXT: andl $1431655765, %edi # imm = 0x55555555
694 ; X86-NEXT: shrl %esi
695 ; X86-NEXT: andl $1431655765, %esi # imm = 0x55555555
696 ; X86-NEXT: leal (%esi,%edi,2), %ebx
697 ; X86-NEXT: bswapl %edx
698 ; X86-NEXT: movl %edx, %esi
699 ; X86-NEXT: andl $252645135, %esi # imm = 0xF0F0F0F
700 ; X86-NEXT: shll $4, %esi
701 ; X86-NEXT: shrl $4, %edx
702 ; X86-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
703 ; X86-NEXT: orl %esi, %edx
704 ; X86-NEXT: movl %edx, %esi
705 ; X86-NEXT: andl $858993459, %esi # imm = 0x33333333
706 ; X86-NEXT: shrl $2, %edx
707 ; X86-NEXT: andl $858993459, %edx # imm = 0x33333333
708 ; X86-NEXT: leal (%edx,%esi,4), %edx
709 ; X86-NEXT: movl %edx, %esi
710 ; X86-NEXT: andl $1431655765, %esi # imm = 0x55555555
711 ; X86-NEXT: shrl %edx
712 ; X86-NEXT: andl $1431655765, %edx # imm = 0x55555555
713 ; X86-NEXT: leal (%edx,%esi,2), %edx
714 ; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
715 ; X86-NEXT: bswapl %ecx
716 ; X86-NEXT: movl %ecx, %edx
717 ; X86-NEXT: andl $252645135, %edx # imm = 0xF0F0F0F
718 ; X86-NEXT: shll $4, %edx
719 ; X86-NEXT: shrl $4, %ecx
720 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
721 ; X86-NEXT: orl %edx, %ecx
722 ; X86-NEXT: movl %ecx, %edx
723 ; X86-NEXT: andl $858993459, %edx # imm = 0x33333333
724 ; X86-NEXT: shrl $2, %ecx
725 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
726 ; X86-NEXT: leal (%ecx,%edx,4), %ecx
727 ; X86-NEXT: movl %ecx, %edx
728 ; X86-NEXT: andl $1431655765, %edx # imm = 0x55555555
729 ; X86-NEXT: shrl %ecx
730 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
731 ; X86-NEXT: leal (%ecx,%edx,2), %ecx
732 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
733 ; X86-NEXT: bswapl %eax
734 ; X86-NEXT: movl %eax, %ecx
735 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
736 ; X86-NEXT: shll $4, %ecx
737 ; X86-NEXT: shrl $4, %eax
738 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
739 ; X86-NEXT: orl %ecx, %eax
740 ; X86-NEXT: movl %eax, %ecx
741 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
742 ; X86-NEXT: shrl $2, %eax
743 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
744 ; X86-NEXT: leal (%eax,%ecx,4), %eax
745 ; X86-NEXT: movl %eax, %ecx
746 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
747 ; X86-NEXT: shrl %eax
748 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
749 ; X86-NEXT: leal (%eax,%ecx,2), %eax
750 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
751 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
752 ; X86-NEXT: bswapl %eax
753 ; X86-NEXT: movl %eax, %ecx
754 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
755 ; X86-NEXT: shll $4, %ecx
756 ; X86-NEXT: shrl $4, %eax
757 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
758 ; X86-NEXT: orl %ecx, %eax
759 ; X86-NEXT: movl %eax, %ecx
760 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
761 ; X86-NEXT: shrl $2, %eax
762 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
763 ; X86-NEXT: leal (%eax,%ecx,4), %eax
764 ; X86-NEXT: movl %eax, %ecx
765 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
766 ; X86-NEXT: shrl %eax
767 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
768 ; X86-NEXT: leal (%eax,%ecx,2), %eax
769 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
770 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
771 ; X86-NEXT: bswapl %eax
772 ; X86-NEXT: movl %eax, %ecx
773 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
774 ; X86-NEXT: shll $4, %ecx
775 ; X86-NEXT: shrl $4, %eax
776 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
777 ; X86-NEXT: orl %ecx, %eax
778 ; X86-NEXT: movl %eax, %ecx
779 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
780 ; X86-NEXT: shrl $2, %eax
781 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
782 ; X86-NEXT: leal (%eax,%ecx,4), %eax
783 ; X86-NEXT: movl %eax, %ecx
784 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
785 ; X86-NEXT: shrl %eax
786 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
787 ; X86-NEXT: leal (%eax,%ecx,2), %eax
788 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
789 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
790 ; X86-NEXT: bswapl %eax
791 ; X86-NEXT: movl %eax, %ecx
792 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
793 ; X86-NEXT: shll $4, %ecx
794 ; X86-NEXT: shrl $4, %eax
795 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
796 ; X86-NEXT: orl %ecx, %eax
797 ; X86-NEXT: movl %eax, %ecx
798 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
799 ; X86-NEXT: shrl $2, %eax
800 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
801 ; X86-NEXT: leal (%eax,%ecx,4), %eax
802 ; X86-NEXT: movl %eax, %ecx
803 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
804 ; X86-NEXT: shrl %eax
805 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
806 ; X86-NEXT: leal (%eax,%ecx,2), %eax
807 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
808 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
809 ; X86-NEXT: bswapl %eax
810 ; X86-NEXT: movl %eax, %ecx
811 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
812 ; X86-NEXT: shll $4, %ecx
813 ; X86-NEXT: shrl $4, %eax
814 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
815 ; X86-NEXT: orl %ecx, %eax
816 ; X86-NEXT: movl %eax, %ecx
817 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
818 ; X86-NEXT: shrl $2, %eax
819 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
820 ; X86-NEXT: leal (%eax,%ecx,4), %eax
821 ; X86-NEXT: movl %eax, %ecx
822 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
823 ; X86-NEXT: shrl %eax
824 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
825 ; X86-NEXT: leal (%eax,%ecx,2), %edi
826 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
827 ; X86-NEXT: bswapl %eax
828 ; X86-NEXT: movl %eax, %ecx
829 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
830 ; X86-NEXT: shll $4, %ecx
831 ; X86-NEXT: shrl $4, %eax
832 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
833 ; X86-NEXT: orl %ecx, %eax
834 ; X86-NEXT: movl %eax, %ecx
835 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
836 ; X86-NEXT: shrl $2, %eax
837 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
838 ; X86-NEXT: leal (%eax,%ecx,4), %eax
839 ; X86-NEXT: movl %eax, %ecx
840 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
841 ; X86-NEXT: shrl %eax
842 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
843 ; X86-NEXT: leal (%eax,%ecx,2), %eax
844 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
845 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
846 ; X86-NEXT: bswapl %eax
847 ; X86-NEXT: movl %eax, %ecx
848 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
849 ; X86-NEXT: shll $4, %ecx
850 ; X86-NEXT: shrl $4, %eax
851 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
852 ; X86-NEXT: orl %ecx, %eax
853 ; X86-NEXT: movl %eax, %ecx
854 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
855 ; X86-NEXT: shrl $2, %eax
856 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
857 ; X86-NEXT: leal (%eax,%ecx,4), %eax
858 ; X86-NEXT: movl %eax, %ecx
859 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
860 ; X86-NEXT: shrl %eax
861 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
862 ; X86-NEXT: leal (%eax,%ecx,2), %eax
863 ; X86-NEXT: movl %eax, (%esp) # 4-byte Spill
864 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
865 ; X86-NEXT: bswapl %eax
866 ; X86-NEXT: movl %eax, %ecx
867 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
868 ; X86-NEXT: shll $4, %ecx
869 ; X86-NEXT: shrl $4, %eax
870 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
871 ; X86-NEXT: orl %ecx, %eax
872 ; X86-NEXT: movl %eax, %ecx
873 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
874 ; X86-NEXT: shrl $2, %eax
875 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
876 ; X86-NEXT: leal (%eax,%ecx,4), %eax
877 ; X86-NEXT: movl %eax, %ecx
878 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
879 ; X86-NEXT: shrl %eax
880 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
881 ; X86-NEXT: leal (%eax,%ecx,2), %eax
882 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
883 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
884 ; X86-NEXT: bswapl %eax
885 ; X86-NEXT: movl %eax, %ecx
886 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
887 ; X86-NEXT: shll $4, %ecx
888 ; X86-NEXT: shrl $4, %eax
889 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
890 ; X86-NEXT: orl %ecx, %eax
891 ; X86-NEXT: movl %eax, %ecx
892 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
893 ; X86-NEXT: shrl $2, %eax
894 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
895 ; X86-NEXT: leal (%eax,%ecx,4), %eax
896 ; X86-NEXT: movl %eax, %ecx
897 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
898 ; X86-NEXT: shrl %eax
899 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
900 ; X86-NEXT: leal (%eax,%ecx,2), %eax
901 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
902 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
903 ; X86-NEXT: bswapl %eax
904 ; X86-NEXT: movl %eax, %ecx
905 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
906 ; X86-NEXT: shll $4, %ecx
907 ; X86-NEXT: shrl $4, %eax
908 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
909 ; X86-NEXT: orl %ecx, %eax
910 ; X86-NEXT: movl %eax, %ecx
911 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
912 ; X86-NEXT: shrl $2, %eax
913 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
914 ; X86-NEXT: leal (%eax,%ecx,4), %eax
915 ; X86-NEXT: movl %eax, %ecx
916 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
917 ; X86-NEXT: shrl %eax
918 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
919 ; X86-NEXT: leal (%eax,%ecx,2), %eax
920 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
921 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
922 ; X86-NEXT: bswapl %eax
923 ; X86-NEXT: movl %eax, %ecx
924 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
925 ; X86-NEXT: shll $4, %ecx
926 ; X86-NEXT: shrl $4, %eax
927 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
928 ; X86-NEXT: orl %ecx, %eax
929 ; X86-NEXT: movl %eax, %ecx
930 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
931 ; X86-NEXT: shrl $2, %eax
932 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
933 ; X86-NEXT: leal (%eax,%ecx,4), %eax
934 ; X86-NEXT: movl %eax, %ecx
935 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
936 ; X86-NEXT: shrl %eax
937 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
938 ; X86-NEXT: leal (%eax,%ecx,2), %eax
939 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
940 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
941 ; X86-NEXT: bswapl %eax
942 ; X86-NEXT: movl %eax, %ecx
943 ; X86-NEXT: andl $252645135, %ecx # imm = 0xF0F0F0F
944 ; X86-NEXT: shll $4, %ecx
945 ; X86-NEXT: shrl $4, %eax
946 ; X86-NEXT: andl $252645135, %eax # imm = 0xF0F0F0F
947 ; X86-NEXT: orl %ecx, %eax
948 ; X86-NEXT: movl %eax, %ecx
949 ; X86-NEXT: andl $858993459, %ecx # imm = 0x33333333
950 ; X86-NEXT: shrl $2, %eax
951 ; X86-NEXT: andl $858993459, %eax # imm = 0x33333333
952 ; X86-NEXT: leal (%eax,%ecx,4), %eax
953 ; X86-NEXT: movl %eax, %ecx
954 ; X86-NEXT: andl $1431655765, %ecx # imm = 0x55555555
955 ; X86-NEXT: shrl %eax
956 ; X86-NEXT: andl $1431655765, %eax # imm = 0x55555555
957 ; X86-NEXT: leal (%eax,%ecx,2), %edx
958 ; X86-NEXT: movl %ebp, %esi
959 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
960 ; X86-NEXT: shrdl $16, %ecx, %esi
961 ; X86-NEXT: movl %ebx, %eax
962 ; X86-NEXT: shrdl $16, %ebx, %ecx
963 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
964 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
965 ; X86-NEXT: shrdl $16, %ecx, %eax
966 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
967 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
968 ; X86-NEXT: shrdl $16, %eax, %ecx
969 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
970 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
971 ; X86-NEXT: shrdl $16, %ecx, %eax
972 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
973 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
974 ; X86-NEXT: shrdl $16, %eax, %ecx
975 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
976 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
977 ; X86-NEXT: shrdl $16, %ecx, %eax
978 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
979 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
980 ; X86-NEXT: shrdl $16, %eax, %ecx
981 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
982 ; X86-NEXT: shrdl $16, %edi, %eax
983 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
984 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
985 ; X86-NEXT: shrdl $16, %eax, %edi
986 ; X86-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
987 ; X86-NEXT: movl (%esp), %ecx # 4-byte Reload
988 ; X86-NEXT: shrdl $16, %ecx, %eax
989 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
990 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Reload
991 ; X86-NEXT: shrdl $16, %ebp, %ecx
992 ; X86-NEXT: movl %ecx, (%esp) # 4-byte Spill
993 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
994 ; X86-NEXT: shrdl $16, %ebx, %ebp
995 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
996 ; X86-NEXT: shrdl $16, %edi, %ebx
997 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
998 ; X86-NEXT: shrdl $16, %ecx, %edi
999 ; X86-NEXT: shrdl $16, %edx, %ecx
1000 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1001 ; X86-NEXT: movl %ecx, 60(%eax)
1002 ; X86-NEXT: movl %edi, 56(%eax)
1003 ; X86-NEXT: movl %ebx, 52(%eax)
1004 ; X86-NEXT: movl %ebp, 48(%eax)
1005 ; X86-NEXT: movl (%esp), %ecx # 4-byte Reload
1006 ; X86-NEXT: movl %ecx, 44(%eax)
1007 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1008 ; X86-NEXT: movl %ecx, 40(%eax)
1009 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1010 ; X86-NEXT: movl %ecx, 36(%eax)
1011 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1012 ; X86-NEXT: movl %ecx, 32(%eax)
1013 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1014 ; X86-NEXT: movl %ecx, 28(%eax)
1015 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1016 ; X86-NEXT: movl %ecx, 24(%eax)
1017 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1018 ; X86-NEXT: movl %ecx, 20(%eax)
1019 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1020 ; X86-NEXT: movl %ecx, 16(%eax)
1021 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1022 ; X86-NEXT: movl %ecx, 12(%eax)
1023 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1024 ; X86-NEXT: movl %ecx, 8(%eax)
1025 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1026 ; X86-NEXT: movl %ecx, 4(%eax)
1027 ; X86-NEXT: movl %esi, (%eax)
1028 ; X86-NEXT: shrl $16, %edx
1029 ; X86-NEXT: movw %dx, 64(%eax)
1030 ; X86-NEXT: addl $60, %esp
1031 ; X86-NEXT: popl %esi
1032 ; X86-NEXT: popl %edi
1033 ; X86-NEXT: popl %ebx
1034 ; X86-NEXT: popl %ebp
1037 ; X64-LABEL: large_promotion:
1039 ; X64-NEXT: pushq %r15
1040 ; X64-NEXT: pushq %r14
1041 ; X64-NEXT: pushq %r13
1042 ; X64-NEXT: pushq %r12
1043 ; X64-NEXT: pushq %rbx
1044 ; X64-NEXT: movq %rdi, %rax
1045 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %r12
1046 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %r15
1047 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %rbx
1048 ; X64-NEXT: movq {{[0-9]+}}(%rsp), %rdi
1049 ; X64-NEXT: bswapq %rdi
1050 ; X64-NEXT: movq %rdi, %r10
1051 ; X64-NEXT: shrq $4, %r10
1052 ; X64-NEXT: movabsq $1085102592571150095, %r11 # imm = 0xF0F0F0F0F0F0F0F
1053 ; X64-NEXT: andq %r11, %r10
1054 ; X64-NEXT: andq %r11, %rdi
1055 ; X64-NEXT: shlq $4, %rdi
1056 ; X64-NEXT: orq %r10, %rdi
1057 ; X64-NEXT: movabsq $3689348814741910323, %r10 # imm = 0x3333333333333333
1058 ; X64-NEXT: movq %rdi, %r14
1059 ; X64-NEXT: andq %r10, %r14
1060 ; X64-NEXT: shrq $2, %rdi
1061 ; X64-NEXT: andq %r10, %rdi
1062 ; X64-NEXT: leaq (%rdi,%r14,4), %rdi
1063 ; X64-NEXT: movabsq $6148820866244280320, %r14 # imm = 0x5555000000000000
1064 ; X64-NEXT: movq %rdi, %r13
1065 ; X64-NEXT: andq %r14, %r13
1066 ; X64-NEXT: shrq %rdi
1067 ; X64-NEXT: andq %r14, %rdi
1068 ; X64-NEXT: leaq (%rdi,%r13,2), %rdi
1069 ; X64-NEXT: bswapq %rbx
1070 ; X64-NEXT: movq %rbx, %r14
1071 ; X64-NEXT: shrq $4, %r14
1072 ; X64-NEXT: andq %r11, %r14
1073 ; X64-NEXT: andq %r11, %rbx
1074 ; X64-NEXT: shlq $4, %rbx
1075 ; X64-NEXT: orq %r14, %rbx
1076 ; X64-NEXT: movq %rbx, %r14
1077 ; X64-NEXT: andq %r10, %r14
1078 ; X64-NEXT: shrq $2, %rbx
1079 ; X64-NEXT: andq %r10, %rbx
1080 ; X64-NEXT: leaq (%rbx,%r14,4), %rbx
1081 ; X64-NEXT: movabsq $6148914691236517205, %r14 # imm = 0x5555555555555555
1082 ; X64-NEXT: movq %rbx, %r13
1083 ; X64-NEXT: andq %r14, %r13
1084 ; X64-NEXT: shrq %rbx
1085 ; X64-NEXT: andq %r14, %rbx
1086 ; X64-NEXT: leaq (%rbx,%r13,2), %rbx
1087 ; X64-NEXT: shrdq $48, %rbx, %rdi
1088 ; X64-NEXT: bswapq %r15
1089 ; X64-NEXT: movq %r15, %r13
1090 ; X64-NEXT: shrq $4, %r13
1091 ; X64-NEXT: andq %r11, %r13
1092 ; X64-NEXT: andq %r11, %r15
1093 ; X64-NEXT: shlq $4, %r15
1094 ; X64-NEXT: orq %r13, %r15
1095 ; X64-NEXT: movq %r15, %r13
1096 ; X64-NEXT: andq %r10, %r13
1097 ; X64-NEXT: shrq $2, %r15
1098 ; X64-NEXT: andq %r10, %r15
1099 ; X64-NEXT: leaq (%r15,%r13,4), %r15
1100 ; X64-NEXT: movq %r15, %r13
1101 ; X64-NEXT: andq %r14, %r13
1102 ; X64-NEXT: shrq %r15
1103 ; X64-NEXT: andq %r14, %r15
1104 ; X64-NEXT: leaq (%r15,%r13,2), %r15
1105 ; X64-NEXT: shrdq $48, %r15, %rbx
1106 ; X64-NEXT: bswapq %r12
1107 ; X64-NEXT: movq %r12, %r13
1108 ; X64-NEXT: shrq $4, %r13
1109 ; X64-NEXT: andq %r11, %r13
1110 ; X64-NEXT: andq %r11, %r12
1111 ; X64-NEXT: shlq $4, %r12
1112 ; X64-NEXT: orq %r13, %r12
1113 ; X64-NEXT: movq %r12, %r13
1114 ; X64-NEXT: andq %r10, %r13
1115 ; X64-NEXT: shrq $2, %r12
1116 ; X64-NEXT: andq %r10, %r12
1117 ; X64-NEXT: leaq (%r12,%r13,4), %r12
1118 ; X64-NEXT: movq %r12, %r13
1119 ; X64-NEXT: andq %r14, %r13
1120 ; X64-NEXT: shrq %r12
1121 ; X64-NEXT: andq %r14, %r12
1122 ; X64-NEXT: leaq (%r12,%r13,2), %r12
1123 ; X64-NEXT: shrdq $48, %r12, %r15
1124 ; X64-NEXT: bswapq %r9
1125 ; X64-NEXT: movq %r9, %r13
1126 ; X64-NEXT: shrq $4, %r13
1127 ; X64-NEXT: andq %r11, %r13
1128 ; X64-NEXT: andq %r11, %r9
1129 ; X64-NEXT: shlq $4, %r9
1130 ; X64-NEXT: orq %r13, %r9
1131 ; X64-NEXT: movq %r9, %r13
1132 ; X64-NEXT: andq %r10, %r13
1133 ; X64-NEXT: shrq $2, %r9
1134 ; X64-NEXT: andq %r10, %r9
1135 ; X64-NEXT: leaq (%r9,%r13,4), %r9
1136 ; X64-NEXT: movq %r9, %r13
1137 ; X64-NEXT: andq %r14, %r13
1138 ; X64-NEXT: shrq %r9
1139 ; X64-NEXT: andq %r14, %r9
1140 ; X64-NEXT: leaq (%r9,%r13,2), %r9
1141 ; X64-NEXT: shrdq $48, %r9, %r12
1142 ; X64-NEXT: bswapq %r8
1143 ; X64-NEXT: movq %r8, %r13
1144 ; X64-NEXT: shrq $4, %r13
1145 ; X64-NEXT: andq %r11, %r13
1146 ; X64-NEXT: andq %r11, %r8
1147 ; X64-NEXT: shlq $4, %r8
1148 ; X64-NEXT: orq %r13, %r8
1149 ; X64-NEXT: movq %r8, %r13
1150 ; X64-NEXT: andq %r10, %r13
1151 ; X64-NEXT: shrq $2, %r8
1152 ; X64-NEXT: andq %r10, %r8
1153 ; X64-NEXT: leaq (%r8,%r13,4), %r8
1154 ; X64-NEXT: movq %r8, %r13
1155 ; X64-NEXT: andq %r14, %r13
1156 ; X64-NEXT: shrq %r8
1157 ; X64-NEXT: andq %r14, %r8
1158 ; X64-NEXT: leaq (%r8,%r13,2), %r8
1159 ; X64-NEXT: shrdq $48, %r8, %r9
1160 ; X64-NEXT: bswapq %rcx
1161 ; X64-NEXT: movq %rcx, %r13
1162 ; X64-NEXT: shrq $4, %r13
1163 ; X64-NEXT: andq %r11, %r13
1164 ; X64-NEXT: andq %r11, %rcx
1165 ; X64-NEXT: shlq $4, %rcx
1166 ; X64-NEXT: orq %r13, %rcx
1167 ; X64-NEXT: movq %rcx, %r13
1168 ; X64-NEXT: andq %r10, %r13
1169 ; X64-NEXT: shrq $2, %rcx
1170 ; X64-NEXT: andq %r10, %rcx
1171 ; X64-NEXT: leaq (%rcx,%r13,4), %rcx
1172 ; X64-NEXT: movq %rcx, %r13
1173 ; X64-NEXT: andq %r14, %r13
1174 ; X64-NEXT: shrq %rcx
1175 ; X64-NEXT: andq %r14, %rcx
1176 ; X64-NEXT: leaq (%rcx,%r13,2), %rcx
1177 ; X64-NEXT: shrdq $48, %rcx, %r8
1178 ; X64-NEXT: bswapq %rdx
1179 ; X64-NEXT: movq %rdx, %r13
1180 ; X64-NEXT: shrq $4, %r13
1181 ; X64-NEXT: andq %r11, %r13
1182 ; X64-NEXT: andq %r11, %rdx
1183 ; X64-NEXT: shlq $4, %rdx
1184 ; X64-NEXT: orq %r13, %rdx
1185 ; X64-NEXT: movq %rdx, %r13
1186 ; X64-NEXT: andq %r10, %r13
1187 ; X64-NEXT: shrq $2, %rdx
1188 ; X64-NEXT: andq %r10, %rdx
1189 ; X64-NEXT: leaq (%rdx,%r13,4), %rdx
1190 ; X64-NEXT: movq %rdx, %r13
1191 ; X64-NEXT: andq %r14, %r13
1192 ; X64-NEXT: shrq %rdx
1193 ; X64-NEXT: andq %r14, %rdx
1194 ; X64-NEXT: leaq (%rdx,%r13,2), %rdx
1195 ; X64-NEXT: shrdq $48, %rdx, %rcx
1196 ; X64-NEXT: bswapq %rsi
1197 ; X64-NEXT: movq %rsi, %r13
1198 ; X64-NEXT: shrq $4, %r13
1199 ; X64-NEXT: andq %r11, %r13
1200 ; X64-NEXT: andq %r11, %rsi
1201 ; X64-NEXT: shlq $4, %rsi
1202 ; X64-NEXT: orq %r13, %rsi
1203 ; X64-NEXT: movq %rsi, %r11
1204 ; X64-NEXT: andq %r10, %r11
1205 ; X64-NEXT: shrq $2, %rsi
1206 ; X64-NEXT: andq %r10, %rsi
1207 ; X64-NEXT: leaq (%rsi,%r11,4), %rsi
1208 ; X64-NEXT: movq %rsi, %r10
1209 ; X64-NEXT: andq %r14, %r10
1210 ; X64-NEXT: shrq %rsi
1211 ; X64-NEXT: andq %r14, %rsi
1212 ; X64-NEXT: leaq (%rsi,%r10,2), %rsi
1213 ; X64-NEXT: shrdq $48, %rsi, %rdx
1214 ; X64-NEXT: shrq $48, %rsi
1215 ; X64-NEXT: movq %rdx, 56(%rax)
1216 ; X64-NEXT: movq %rcx, 48(%rax)
1217 ; X64-NEXT: movq %r8, 40(%rax)
1218 ; X64-NEXT: movq %r9, 32(%rax)
1219 ; X64-NEXT: movq %r12, 24(%rax)
1220 ; X64-NEXT: movq %r15, 16(%rax)
1221 ; X64-NEXT: movq %rbx, 8(%rax)
1222 ; X64-NEXT: movq %rdi, (%rax)
1223 ; X64-NEXT: movw %si, 64(%rax)
1224 ; X64-NEXT: popq %rbx
1225 ; X64-NEXT: popq %r12
1226 ; X64-NEXT: popq %r13
1227 ; X64-NEXT: popq %r14
1228 ; X64-NEXT: popq %r15
1231 ; X86XOP-LABEL: large_promotion:
1233 ; X86XOP-NEXT: pushl %ebp
1234 ; X86XOP-NEXT: pushl %ebx
1235 ; X86XOP-NEXT: pushl %edi
1236 ; X86XOP-NEXT: pushl %esi
1237 ; X86XOP-NEXT: subl $44, %esp
1238 ; X86XOP-NEXT: vmovdqa {{.*#+}} xmm0 = [87,86,85,84,83,82,81,80,95,94,93,92,91,90,89,88]
1239 ; X86XOP-NEXT: vmovd {{.*#+}} xmm1 = mem[0],zero,zero,zero
1240 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1241 ; X86XOP-NEXT: vpextrd $1, %xmm1, %eax
1242 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1243 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1244 ; X86XOP-NEXT: vmovd %xmm1, %ecx
1245 ; X86XOP-NEXT: shrdl $16, %ecx, %eax
1246 ; X86XOP-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1247 ; X86XOP-NEXT: vpextrd $1, %xmm1, %eax
1248 ; X86XOP-NEXT: shrdl $16, %eax, %ecx
1249 ; X86XOP-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1250 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1251 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1252 ; X86XOP-NEXT: vmovd %xmm1, %ecx
1253 ; X86XOP-NEXT: shrdl $16, %ecx, %eax
1254 ; X86XOP-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1255 ; X86XOP-NEXT: vpextrd $1, %xmm1, %eax
1256 ; X86XOP-NEXT: shrdl $16, %eax, %ecx
1257 ; X86XOP-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1258 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1259 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1260 ; X86XOP-NEXT: vmovd %xmm1, %ecx
1261 ; X86XOP-NEXT: shrdl $16, %ecx, %eax
1262 ; X86XOP-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1263 ; X86XOP-NEXT: vpextrd $1, %xmm1, %eax
1264 ; X86XOP-NEXT: shrdl $16, %eax, %ecx
1265 ; X86XOP-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1266 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1267 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1268 ; X86XOP-NEXT: vmovd %xmm1, %ecx
1269 ; X86XOP-NEXT: shrdl $16, %ecx, %eax
1270 ; X86XOP-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1271 ; X86XOP-NEXT: vpextrd $1, %xmm1, %eax
1272 ; X86XOP-NEXT: shrdl $16, %eax, %ecx
1273 ; X86XOP-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1274 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1275 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1276 ; X86XOP-NEXT: vmovd %xmm1, %ecx
1277 ; X86XOP-NEXT: shrdl $16, %ecx, %eax
1278 ; X86XOP-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1279 ; X86XOP-NEXT: vpextrd $1, %xmm1, %eax
1280 ; X86XOP-NEXT: shrdl $16, %eax, %ecx
1281 ; X86XOP-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1282 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1283 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1284 ; X86XOP-NEXT: vmovd %xmm1, %ebp
1285 ; X86XOP-NEXT: shrdl $16, %ebp, %eax
1286 ; X86XOP-NEXT: movl %eax, (%esp) # 4-byte Spill
1287 ; X86XOP-NEXT: vpextrd $1, %xmm1, %ebx
1288 ; X86XOP-NEXT: shrdl $16, %ebx, %ebp
1289 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1290 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm1
1291 ; X86XOP-NEXT: vmovd %xmm1, %esi
1292 ; X86XOP-NEXT: shrdl $16, %esi, %ebx
1293 ; X86XOP-NEXT: vpextrd $1, %xmm1, %edx
1294 ; X86XOP-NEXT: shrdl $16, %edx, %esi
1295 ; X86XOP-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1296 ; X86XOP-NEXT: vpperm %xmm0, %xmm1, %xmm0, %xmm0
1297 ; X86XOP-NEXT: vmovd %xmm0, %ecx
1298 ; X86XOP-NEXT: shrdl $16, %ecx, %edx
1299 ; X86XOP-NEXT: vpextrd $1, %xmm0, %edi
1300 ; X86XOP-NEXT: shrdl $16, %edi, %ecx
1301 ; X86XOP-NEXT: movl {{[0-9]+}}(%esp), %eax
1302 ; X86XOP-NEXT: movl %ecx, 60(%eax)
1303 ; X86XOP-NEXT: movl %edx, 56(%eax)
1304 ; X86XOP-NEXT: movl %esi, 52(%eax)
1305 ; X86XOP-NEXT: movl %ebx, 48(%eax)
1306 ; X86XOP-NEXT: movl %ebp, 44(%eax)
1307 ; X86XOP-NEXT: movl (%esp), %ecx # 4-byte Reload
1308 ; X86XOP-NEXT: movl %ecx, 40(%eax)
1309 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1310 ; X86XOP-NEXT: movl %ecx, 36(%eax)
1311 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1312 ; X86XOP-NEXT: movl %ecx, 32(%eax)
1313 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1314 ; X86XOP-NEXT: movl %ecx, 28(%eax)
1315 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1316 ; X86XOP-NEXT: movl %ecx, 24(%eax)
1317 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1318 ; X86XOP-NEXT: movl %ecx, 20(%eax)
1319 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1320 ; X86XOP-NEXT: movl %ecx, 16(%eax)
1321 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1322 ; X86XOP-NEXT: movl %ecx, 12(%eax)
1323 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1324 ; X86XOP-NEXT: movl %ecx, 8(%eax)
1325 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1326 ; X86XOP-NEXT: movl %ecx, 4(%eax)
1327 ; X86XOP-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
1328 ; X86XOP-NEXT: movl %ecx, (%eax)
1329 ; X86XOP-NEXT: shrl $16, %edi
1330 ; X86XOP-NEXT: movw %di, 64(%eax)
1331 ; X86XOP-NEXT: addl $44, %esp
1332 ; X86XOP-NEXT: popl %esi
1333 ; X86XOP-NEXT: popl %edi
1334 ; X86XOP-NEXT: popl %ebx
1335 ; X86XOP-NEXT: popl %ebp
1336 ; X86XOP-NEXT: retl $4
1338 ; GFNI-LABEL: large_promotion:
1340 ; GFNI-NEXT: pushq %r14
1341 ; GFNI-NEXT: pushq %rbx
1342 ; GFNI-NEXT: movq %rdi, %rax
1343 ; GFNI-NEXT: vpbroadcastq {{.*#+}} xmm0 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
1344 ; GFNI-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1345 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1346 ; GFNI-NEXT: vmovq %xmm1, %r10
1347 ; GFNI-NEXT: bswapq %r10
1348 ; GFNI-NEXT: vmovq %r9, %xmm1
1349 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1350 ; GFNI-NEXT: vmovq %xmm1, %rdi
1351 ; GFNI-NEXT: bswapq %rdi
1352 ; GFNI-NEXT: vmovq %r8, %xmm1
1353 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1354 ; GFNI-NEXT: vmovq %xmm1, %r8
1355 ; GFNI-NEXT: bswapq %r8
1356 ; GFNI-NEXT: movq %r8, %r9
1357 ; GFNI-NEXT: shldq $16, %rdi, %r9
1358 ; GFNI-NEXT: shldq $16, %r10, %rdi
1359 ; GFNI-NEXT: vmovq %rcx, %xmm1
1360 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1361 ; GFNI-NEXT: vmovq %xmm1, %rcx
1362 ; GFNI-NEXT: bswapq %rcx
1363 ; GFNI-NEXT: shrdq $48, %rcx, %r8
1364 ; GFNI-NEXT: vmovq %rdx, %xmm1
1365 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1366 ; GFNI-NEXT: vmovq %xmm1, %rdx
1367 ; GFNI-NEXT: bswapq %rdx
1368 ; GFNI-NEXT: shrdq $48, %rdx, %rcx
1369 ; GFNI-NEXT: vmovq %rsi, %xmm1
1370 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1371 ; GFNI-NEXT: vmovq %xmm1, %rsi
1372 ; GFNI-NEXT: bswapq %rsi
1373 ; GFNI-NEXT: shrdq $48, %rsi, %rdx
1374 ; GFNI-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1375 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1376 ; GFNI-NEXT: vmovq %xmm1, %r11
1377 ; GFNI-NEXT: bswapq %r11
1378 ; GFNI-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1379 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
1380 ; GFNI-NEXT: vmovq %xmm1, %rbx
1381 ; GFNI-NEXT: bswapq %rbx
1382 ; GFNI-NEXT: shrdq $48, %rbx, %r11
1383 ; GFNI-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
1384 ; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm0
1385 ; GFNI-NEXT: vmovq %xmm0, %r14
1386 ; GFNI-NEXT: bswapq %r14
1387 ; GFNI-NEXT: shrdq $48, %r14, %rbx
1388 ; GFNI-NEXT: shrdq $48, %r10, %r14
1389 ; GFNI-NEXT: shrq $48, %rsi
1390 ; GFNI-NEXT: movq %r14, 16(%rax)
1391 ; GFNI-NEXT: movq %rbx, 8(%rax)
1392 ; GFNI-NEXT: movq %r11, (%rax)
1393 ; GFNI-NEXT: movq %rdx, 56(%rax)
1394 ; GFNI-NEXT: movq %rcx, 48(%rax)
1395 ; GFNI-NEXT: movq %r8, 40(%rax)
1396 ; GFNI-NEXT: movq %r9, 32(%rax)
1397 ; GFNI-NEXT: movq %rdi, 24(%rax)
1398 ; GFNI-NEXT: movw %si, 64(%rax)
1399 ; GFNI-NEXT: popq %rbx
1400 ; GFNI-NEXT: popq %r14
1402 %Z = call i528 @llvm.bitreverse.i528(i528 %A)
1405 declare i528 @llvm.bitreverse.i528(i528)