1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefixes=CHECK,X86,X86-FAST
3 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+slow-shld | FileCheck %s --check-prefixes=CHECK,X86,X86-SLOW
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=CHECK,X64,X64-FAST
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+slow-shld | FileCheck %s --check-prefixes=CHECK,X64,X64-SLOW
7 declare i8 @llvm.fshr.i8(i8, i8, i8) nounwind readnone
8 declare i16 @llvm.fshr.i16(i16, i16, i16) nounwind readnone
9 declare i32 @llvm.fshr.i32(i32, i32, i32) nounwind readnone
10 declare i64 @llvm.fshr.i64(i64, i64, i64) nounwind readnone
13 ; Variable Funnel Shift
16 define i8 @var_shift_i8(i8 %x, i8 %y, i8 %z) nounwind {
17 ; X86-LABEL: var_shift_i8:
19 ; X86-NEXT: movb {{[0-9]+}}(%esp), %ah
20 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
21 ; X86-NEXT: movb {{[0-9]+}}(%esp), %dl
22 ; X86-NEXT: andb $7, %dl
23 ; X86-NEXT: movb %al, %ch
24 ; X86-NEXT: movb %dl, %cl
25 ; X86-NEXT: shrb %cl, %ch
26 ; X86-NEXT: movb $8, %cl
27 ; X86-NEXT: subb %dl, %cl
28 ; X86-NEXT: shlb %cl, %ah
29 ; X86-NEXT: testb %dl, %dl
30 ; X86-NEXT: je .LBB0_2
32 ; X86-NEXT: orb %ch, %ah
33 ; X86-NEXT: movb %ah, %al
37 ; X64-LABEL: var_shift_i8:
39 ; X64-NEXT: movl %esi, %eax
40 ; X64-NEXT: andb $7, %dl
41 ; X64-NEXT: movl %edx, %ecx
42 ; X64-NEXT: shrb %cl, %sil
43 ; X64-NEXT: movb $8, %cl
44 ; X64-NEXT: subb %dl, %cl
45 ; X64-NEXT: shlb %cl, %dil
46 ; X64-NEXT: testb %dl, %dl
47 ; X64-NEXT: je .LBB0_2
49 ; X64-NEXT: orb %sil, %dil
50 ; X64-NEXT: movl %edi, %eax
52 ; X64-NEXT: # kill: def $al killed $al killed $eax
54 %tmp = tail call i8 @llvm.fshr.i8(i8 %x, i8 %y, i8 %z)
58 define i16 @var_shift_i16(i16 %x, i16 %y, i16 %z) nounwind {
59 ; X86-FAST-LABEL: var_shift_i16:
61 ; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %edx
62 ; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %eax
63 ; X86-FAST-NEXT: movb {{[0-9]+}}(%esp), %cl
64 ; X86-FAST-NEXT: andb $15, %cl
65 ; X86-FAST-NEXT: shrdw %cl, %dx, %ax
68 ; X86-SLOW-LABEL: var_shift_i16:
70 ; X86-SLOW-NEXT: pushl %edi
71 ; X86-SLOW-NEXT: pushl %esi
72 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %esi
73 ; X86-SLOW-NEXT: movb {{[0-9]+}}(%esp), %dl
74 ; X86-SLOW-NEXT: andb $15, %dl
75 ; X86-SLOW-NEXT: movzwl {{[0-9]+}}(%esp), %eax
76 ; X86-SLOW-NEXT: movl %eax, %edi
77 ; X86-SLOW-NEXT: movl %edx, %ecx
78 ; X86-SLOW-NEXT: shrl %cl, %edi
79 ; X86-SLOW-NEXT: movb $16, %cl
80 ; X86-SLOW-NEXT: subb %dl, %cl
81 ; X86-SLOW-NEXT: shll %cl, %esi
82 ; X86-SLOW-NEXT: testb %dl, %dl
83 ; X86-SLOW-NEXT: je .LBB1_2
84 ; X86-SLOW-NEXT: # %bb.1:
85 ; X86-SLOW-NEXT: orl %edi, %esi
86 ; X86-SLOW-NEXT: movl %esi, %eax
87 ; X86-SLOW-NEXT: .LBB1_2:
88 ; X86-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
89 ; X86-SLOW-NEXT: popl %esi
90 ; X86-SLOW-NEXT: popl %edi
93 ; X64-FAST-LABEL: var_shift_i16:
95 ; X64-FAST-NEXT: movl %edx, %ecx
96 ; X64-FAST-NEXT: movl %esi, %eax
97 ; X64-FAST-NEXT: andb $15, %cl
98 ; X64-FAST-NEXT: # kill: def $cl killed $cl killed $ecx
99 ; X64-FAST-NEXT: shrdw %cl, %di, %ax
100 ; X64-FAST-NEXT: # kill: def $ax killed $ax killed $eax
101 ; X64-FAST-NEXT: retq
103 ; X64-SLOW-LABEL: var_shift_i16:
105 ; X64-SLOW-NEXT: movzwl %si, %eax
106 ; X64-SLOW-NEXT: andb $15, %dl
107 ; X64-SLOW-NEXT: movl %edx, %ecx
108 ; X64-SLOW-NEXT: shrl %cl, %eax
109 ; X64-SLOW-NEXT: movb $16, %cl
110 ; X64-SLOW-NEXT: subb %dl, %cl
111 ; X64-SLOW-NEXT: shll %cl, %edi
112 ; X64-SLOW-NEXT: orl %edi, %eax
113 ; X64-SLOW-NEXT: testb %dl, %dl
114 ; X64-SLOW-NEXT: cmovel %esi, %eax
115 ; X64-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
116 ; X64-SLOW-NEXT: retq
117 %tmp = tail call i16 @llvm.fshr.i16(i16 %x, i16 %y, i16 %z)
121 define i32 @var_shift_i32(i32 %x, i32 %y, i32 %z) nounwind {
122 ; X86-FAST-LABEL: var_shift_i32:
124 ; X86-FAST-NEXT: movb {{[0-9]+}}(%esp), %cl
125 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
126 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
127 ; X86-FAST-NEXT: shrdl %cl, %edx, %eax
128 ; X86-FAST-NEXT: retl
130 ; X86-SLOW-LABEL: var_shift_i32:
132 ; X86-SLOW-NEXT: pushl %edi
133 ; X86-SLOW-NEXT: pushl %esi
134 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %esi
135 ; X86-SLOW-NEXT: movb {{[0-9]+}}(%esp), %dl
136 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
137 ; X86-SLOW-NEXT: movl %eax, %edi
138 ; X86-SLOW-NEXT: movl %edx, %ecx
139 ; X86-SLOW-NEXT: shrl %cl, %edi
140 ; X86-SLOW-NEXT: andb $31, %dl
141 ; X86-SLOW-NEXT: movl %edx, %ecx
142 ; X86-SLOW-NEXT: negb %cl
143 ; X86-SLOW-NEXT: shll %cl, %esi
144 ; X86-SLOW-NEXT: testb %dl, %dl
145 ; X86-SLOW-NEXT: je .LBB2_2
146 ; X86-SLOW-NEXT: # %bb.1:
147 ; X86-SLOW-NEXT: orl %edi, %esi
148 ; X86-SLOW-NEXT: movl %esi, %eax
149 ; X86-SLOW-NEXT: .LBB2_2:
150 ; X86-SLOW-NEXT: popl %esi
151 ; X86-SLOW-NEXT: popl %edi
152 ; X86-SLOW-NEXT: retl
154 ; X64-FAST-LABEL: var_shift_i32:
156 ; X64-FAST-NEXT: movl %edx, %ecx
157 ; X64-FAST-NEXT: movl %esi, %eax
158 ; X64-FAST-NEXT: # kill: def $cl killed $cl killed $ecx
159 ; X64-FAST-NEXT: shrdl %cl, %edi, %eax
160 ; X64-FAST-NEXT: retq
162 ; X64-SLOW-LABEL: var_shift_i32:
164 ; X64-SLOW-NEXT: movl %edi, %eax
165 ; X64-SLOW-NEXT: movl %esi, %edi
166 ; X64-SLOW-NEXT: movl %edx, %ecx
167 ; X64-SLOW-NEXT: shrl %cl, %edi
168 ; X64-SLOW-NEXT: andb $31, %dl
169 ; X64-SLOW-NEXT: movl %edx, %ecx
170 ; X64-SLOW-NEXT: negb %cl
171 ; X64-SLOW-NEXT: shll %cl, %eax
172 ; X64-SLOW-NEXT: orl %edi, %eax
173 ; X64-SLOW-NEXT: testb %dl, %dl
174 ; X64-SLOW-NEXT: cmovel %esi, %eax
175 ; X64-SLOW-NEXT: retq
176 %tmp = tail call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 %z)
180 define i32 @var_shift_i32_optsize(i32 %x, i32 %y, i32 %z) nounwind optsize {
181 ; X86-LABEL: var_shift_i32_optsize:
183 ; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
184 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
185 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
186 ; X86-NEXT: shrdl %cl, %edx, %eax
189 ; X64-LABEL: var_shift_i32_optsize:
191 ; X64-NEXT: movl %edx, %ecx
192 ; X64-NEXT: movl %esi, %eax
193 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
194 ; X64-NEXT: shrdl %cl, %edi, %eax
196 %tmp = tail call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 %z)
200 define i64 @var_shift_i64(i64 %x, i64 %y, i64 %z) nounwind {
201 ; X86-FAST-LABEL: var_shift_i64:
203 ; X86-FAST-NEXT: pushl %ebp
204 ; X86-FAST-NEXT: pushl %ebx
205 ; X86-FAST-NEXT: pushl %edi
206 ; X86-FAST-NEXT: pushl %esi
207 ; X86-FAST-NEXT: pushl %eax
208 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
209 ; X86-FAST-NEXT: movl %eax, (%esp) # 4-byte Spill
210 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
211 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
212 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %esi
213 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ebx
214 ; X86-FAST-NEXT: andl $63, %ebx
215 ; X86-FAST-NEXT: movb $64, %cl
216 ; X86-FAST-NEXT: subb %bl, %cl
217 ; X86-FAST-NEXT: movl %eax, %edi
218 ; X86-FAST-NEXT: shll %cl, %edi
219 ; X86-FAST-NEXT: shldl %cl, %eax, %esi
220 ; X86-FAST-NEXT: testb $32, %cl
221 ; X86-FAST-NEXT: je .LBB4_2
222 ; X86-FAST-NEXT: # %bb.1:
223 ; X86-FAST-NEXT: movl %edi, %esi
224 ; X86-FAST-NEXT: xorl %edi, %edi
225 ; X86-FAST-NEXT: .LBB4_2:
226 ; X86-FAST-NEXT: movl %edx, %ebp
227 ; X86-FAST-NEXT: movl %ebx, %ecx
228 ; X86-FAST-NEXT: shrl %cl, %ebp
229 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
230 ; X86-FAST-NEXT: shrdl %cl, %edx, %eax
231 ; X86-FAST-NEXT: testb $32, %bl
232 ; X86-FAST-NEXT: je .LBB4_4
233 ; X86-FAST-NEXT: # %bb.3:
234 ; X86-FAST-NEXT: movl %ebp, %eax
235 ; X86-FAST-NEXT: xorl %ebp, %ebp
236 ; X86-FAST-NEXT: .LBB4_4:
237 ; X86-FAST-NEXT: testl %ebx, %ebx
238 ; X86-FAST-NEXT: je .LBB4_6
239 ; X86-FAST-NEXT: # %bb.5:
240 ; X86-FAST-NEXT: orl %ebp, %esi
241 ; X86-FAST-NEXT: orl %eax, %edi
242 ; X86-FAST-NEXT: movl %edi, (%esp) # 4-byte Spill
243 ; X86-FAST-NEXT: movl %esi, %edx
244 ; X86-FAST-NEXT: .LBB4_6:
245 ; X86-FAST-NEXT: movl (%esp), %eax # 4-byte Reload
246 ; X86-FAST-NEXT: addl $4, %esp
247 ; X86-FAST-NEXT: popl %esi
248 ; X86-FAST-NEXT: popl %edi
249 ; X86-FAST-NEXT: popl %ebx
250 ; X86-FAST-NEXT: popl %ebp
251 ; X86-FAST-NEXT: retl
253 ; X86-SLOW-LABEL: var_shift_i64:
255 ; X86-SLOW-NEXT: pushl %ebp
256 ; X86-SLOW-NEXT: pushl %ebx
257 ; X86-SLOW-NEXT: pushl %edi
258 ; X86-SLOW-NEXT: pushl %esi
259 ; X86-SLOW-NEXT: subl $8, %esp
260 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
261 ; X86-SLOW-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
262 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %esi
263 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx
264 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ebx
265 ; X86-SLOW-NEXT: andl $63, %ebx
266 ; X86-SLOW-NEXT: movb $64, %al
267 ; X86-SLOW-NEXT: subb %bl, %al
268 ; X86-SLOW-NEXT: movl %edx, (%esp) # 4-byte Spill
269 ; X86-SLOW-NEXT: movl %eax, %ecx
270 ; X86-SLOW-NEXT: shll %cl, %edx
271 ; X86-SLOW-NEXT: movb %al, %ch
272 ; X86-SLOW-NEXT: andb $31, %ch
273 ; X86-SLOW-NEXT: movb %ch, %cl
274 ; X86-SLOW-NEXT: negb %cl
275 ; X86-SLOW-NEXT: movl %esi, %edi
276 ; X86-SLOW-NEXT: shrl %cl, %edi
277 ; X86-SLOW-NEXT: testb %ch, %ch
278 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ebp
279 ; X86-SLOW-NEXT: je .LBB4_2
280 ; X86-SLOW-NEXT: # %bb.1:
281 ; X86-SLOW-NEXT: orl %edi, %edx
282 ; X86-SLOW-NEXT: movl %edx, (%esp) # 4-byte Spill
283 ; X86-SLOW-NEXT: .LBB4_2:
284 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx
285 ; X86-SLOW-NEXT: movl %ecx, %edx
286 ; X86-SLOW-NEXT: movl %ebx, %ecx
287 ; X86-SLOW-NEXT: shrl %cl, %edx
288 ; X86-SLOW-NEXT: movb %bl, %ah
289 ; X86-SLOW-NEXT: andb $31, %ah
290 ; X86-SLOW-NEXT: movb %ah, %cl
291 ; X86-SLOW-NEXT: negb %cl
292 ; X86-SLOW-NEXT: movl %ebp, %edi
293 ; X86-SLOW-NEXT: shll %cl, %edi
294 ; X86-SLOW-NEXT: testb %ah, %ah
295 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ebp
296 ; X86-SLOW-NEXT: je .LBB4_4
297 ; X86-SLOW-NEXT: # %bb.3:
298 ; X86-SLOW-NEXT: orl %edx, %edi
299 ; X86-SLOW-NEXT: movl %edi, %ebp
300 ; X86-SLOW-NEXT: .LBB4_4:
301 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edi
302 ; X86-SLOW-NEXT: movl %ebx, %ecx
303 ; X86-SLOW-NEXT: shrl %cl, %edi
304 ; X86-SLOW-NEXT: testb $32, %bl
305 ; X86-SLOW-NEXT: je .LBB4_6
306 ; X86-SLOW-NEXT: # %bb.5:
307 ; X86-SLOW-NEXT: movl %edi, %ebp
308 ; X86-SLOW-NEXT: xorl %edi, %edi
309 ; X86-SLOW-NEXT: .LBB4_6:
310 ; X86-SLOW-NEXT: movl %eax, %ecx
311 ; X86-SLOW-NEXT: shll %cl, %esi
312 ; X86-SLOW-NEXT: testb $32, %al
313 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx
314 ; X86-SLOW-NEXT: jne .LBB4_7
315 ; X86-SLOW-NEXT: # %bb.8:
316 ; X86-SLOW-NEXT: movl (%esp), %eax # 4-byte Reload
317 ; X86-SLOW-NEXT: testl %ebx, %ebx
318 ; X86-SLOW-NEXT: jne .LBB4_10
319 ; X86-SLOW-NEXT: jmp .LBB4_11
320 ; X86-SLOW-NEXT: .LBB4_7:
321 ; X86-SLOW-NEXT: movl %esi, %eax
322 ; X86-SLOW-NEXT: xorl %esi, %esi
323 ; X86-SLOW-NEXT: testl %ebx, %ebx
324 ; X86-SLOW-NEXT: je .LBB4_11
325 ; X86-SLOW-NEXT: .LBB4_10:
326 ; X86-SLOW-NEXT: orl %ebp, %esi
327 ; X86-SLOW-NEXT: orl %edi, %eax
328 ; X86-SLOW-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
329 ; X86-SLOW-NEXT: movl %eax, %edx
330 ; X86-SLOW-NEXT: .LBB4_11:
331 ; X86-SLOW-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
332 ; X86-SLOW-NEXT: addl $8, %esp
333 ; X86-SLOW-NEXT: popl %esi
334 ; X86-SLOW-NEXT: popl %edi
335 ; X86-SLOW-NEXT: popl %ebx
336 ; X86-SLOW-NEXT: popl %ebp
337 ; X86-SLOW-NEXT: retl
339 ; X64-FAST-LABEL: var_shift_i64:
341 ; X64-FAST-NEXT: movq %rdx, %rcx
342 ; X64-FAST-NEXT: movq %rsi, %rax
343 ; X64-FAST-NEXT: # kill: def $cl killed $cl killed $rcx
344 ; X64-FAST-NEXT: shrdq %cl, %rdi, %rax
345 ; X64-FAST-NEXT: retq
347 ; X64-SLOW-LABEL: var_shift_i64:
349 ; X64-SLOW-NEXT: movq %rdi, %rax
350 ; X64-SLOW-NEXT: movq %rsi, %rdi
351 ; X64-SLOW-NEXT: movl %edx, %ecx
352 ; X64-SLOW-NEXT: shrq %cl, %rdi
353 ; X64-SLOW-NEXT: andb $63, %dl
354 ; X64-SLOW-NEXT: movl %edx, %ecx
355 ; X64-SLOW-NEXT: negb %cl
356 ; X64-SLOW-NEXT: shlq %cl, %rax
357 ; X64-SLOW-NEXT: orq %rdi, %rax
358 ; X64-SLOW-NEXT: testb %dl, %dl
359 ; X64-SLOW-NEXT: cmoveq %rsi, %rax
360 ; X64-SLOW-NEXT: retq
361 %tmp = tail call i64 @llvm.fshr.i64(i64 %x, i64 %y, i64 %z)
369 define i8 @const_shift_i8(i8 %x, i8 %y) nounwind {
370 ; X86-LABEL: const_shift_i8:
372 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
373 ; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
374 ; X86-NEXT: shrb $7, %cl
375 ; X86-NEXT: addb %al, %al
376 ; X86-NEXT: orb %cl, %al
379 ; X64-LABEL: const_shift_i8:
381 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
382 ; X64-NEXT: shrb $7, %sil
383 ; X64-NEXT: leal (%rdi,%rdi), %eax
384 ; X64-NEXT: orb %sil, %al
385 ; X64-NEXT: # kill: def $al killed $al killed $eax
387 %tmp = tail call i8 @llvm.fshr.i8(i8 %x, i8 %y, i8 7)
391 define i16 @const_shift_i16(i16 %x, i16 %y) nounwind {
392 ; X86-FAST-LABEL: const_shift_i16:
394 ; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
395 ; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %eax
396 ; X86-FAST-NEXT: shrdw $7, %cx, %ax
397 ; X86-FAST-NEXT: retl
399 ; X86-SLOW-LABEL: const_shift_i16:
401 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
402 ; X86-SLOW-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
403 ; X86-SLOW-NEXT: shrl $7, %ecx
404 ; X86-SLOW-NEXT: shll $9, %eax
405 ; X86-SLOW-NEXT: orl %ecx, %eax
406 ; X86-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
407 ; X86-SLOW-NEXT: retl
409 ; X64-FAST-LABEL: const_shift_i16:
411 ; X64-FAST-NEXT: movl %esi, %eax
412 ; X64-FAST-NEXT: shrdw $7, %di, %ax
413 ; X64-FAST-NEXT: # kill: def $ax killed $ax killed $eax
414 ; X64-FAST-NEXT: retq
416 ; X64-SLOW-LABEL: const_shift_i16:
418 ; X64-SLOW-NEXT: movzwl %si, %eax
419 ; X64-SLOW-NEXT: shll $9, %edi
420 ; X64-SLOW-NEXT: shrl $7, %eax
421 ; X64-SLOW-NEXT: orl %edi, %eax
422 ; X64-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
423 ; X64-SLOW-NEXT: retq
424 %tmp = tail call i16 @llvm.fshr.i16(i16 %x, i16 %y, i16 7)
428 define i32 @const_shift_i32(i32 %x, i32 %y) nounwind {
429 ; X86-FAST-LABEL: const_shift_i32:
431 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ecx
432 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
433 ; X86-FAST-NEXT: shrdl $7, %ecx, %eax
434 ; X86-FAST-NEXT: retl
436 ; X86-SLOW-LABEL: const_shift_i32:
438 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
439 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx
440 ; X86-SLOW-NEXT: shrl $7, %ecx
441 ; X86-SLOW-NEXT: shll $25, %eax
442 ; X86-SLOW-NEXT: orl %ecx, %eax
443 ; X86-SLOW-NEXT: retl
445 ; X64-FAST-LABEL: const_shift_i32:
447 ; X64-FAST-NEXT: movl %edi, %eax
448 ; X64-FAST-NEXT: shldl $25, %esi, %eax
449 ; X64-FAST-NEXT: retq
451 ; X64-SLOW-LABEL: const_shift_i32:
453 ; X64-SLOW-NEXT: # kill: def $esi killed $esi def $rsi
454 ; X64-SLOW-NEXT: # kill: def $edi killed $edi def $rdi
455 ; X64-SLOW-NEXT: shrl $7, %esi
456 ; X64-SLOW-NEXT: shll $25, %edi
457 ; X64-SLOW-NEXT: leal (%rdi,%rsi), %eax
458 ; X64-SLOW-NEXT: retq
459 %tmp = tail call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 7)
463 define i64 @const_shift_i64(i64 %x, i64 %y) nounwind {
464 ; X86-FAST-LABEL: const_shift_i64:
466 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
467 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ecx
468 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
469 ; X86-FAST-NEXT: shldl $25, %ecx, %edx
470 ; X86-FAST-NEXT: shrdl $7, %ecx, %eax
471 ; X86-FAST-NEXT: retl
473 ; X86-SLOW-LABEL: const_shift_i64:
475 ; X86-SLOW-NEXT: pushl %esi
476 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx
477 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
478 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx
479 ; X86-SLOW-NEXT: movl %ecx, %esi
480 ; X86-SLOW-NEXT: shll $25, %esi
481 ; X86-SLOW-NEXT: shrl $7, %eax
482 ; X86-SLOW-NEXT: orl %esi, %eax
483 ; X86-SLOW-NEXT: shrl $7, %ecx
484 ; X86-SLOW-NEXT: shll $25, %edx
485 ; X86-SLOW-NEXT: orl %ecx, %edx
486 ; X86-SLOW-NEXT: popl %esi
487 ; X86-SLOW-NEXT: retl
489 ; X64-FAST-LABEL: const_shift_i64:
491 ; X64-FAST-NEXT: movq %rdi, %rax
492 ; X64-FAST-NEXT: shldq $57, %rsi, %rax
493 ; X64-FAST-NEXT: retq
495 ; X64-SLOW-LABEL: const_shift_i64:
497 ; X64-SLOW-NEXT: shrq $7, %rsi
498 ; X64-SLOW-NEXT: shlq $57, %rdi
499 ; X64-SLOW-NEXT: leaq (%rdi,%rsi), %rax
500 ; X64-SLOW-NEXT: retq
501 %tmp = tail call i64 @llvm.fshr.i64(i64 %x, i64 %y, i64 7)