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.fshl.i8(i8, i8, i8) nounwind readnone
8 declare i16 @llvm.fshl.i16(i16, i16, i16) nounwind readnone
9 declare i32 @llvm.fshl.i32(i32, i32, i32) nounwind readnone
10 declare i64 @llvm.fshl.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: shlb %cl, %ch
26 ; X86-NEXT: movb $8, %cl
27 ; X86-NEXT: subb %dl, %cl
28 ; X86-NEXT: shrb %cl, %ah
29 ; X86-NEXT: testb %dl, %dl
30 ; X86-NEXT: je .LBB0_2
32 ; X86-NEXT: orb %ah, %ch
33 ; X86-NEXT: movb %ch, %al
37 ; X64-LABEL: var_shift_i8:
39 ; X64-NEXT: movl %edi, %eax
40 ; X64-NEXT: andb $7, %dl
41 ; X64-NEXT: movl %edx, %ecx
42 ; X64-NEXT: shlb %cl, %dil
43 ; X64-NEXT: movb $8, %cl
44 ; X64-NEXT: subb %dl, %cl
45 ; X64-NEXT: shrb %cl, %sil
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.fshl.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: shldw %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: movzwl {{[0-9]+}}(%esp), %esi
73 ; X86-SLOW-NEXT: movb {{[0-9]+}}(%esp), %dl
74 ; X86-SLOW-NEXT: andb $15, %dl
75 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
76 ; X86-SLOW-NEXT: movl %eax, %edi
77 ; X86-SLOW-NEXT: movl %edx, %ecx
78 ; X86-SLOW-NEXT: shll %cl, %edi
79 ; X86-SLOW-NEXT: movb $16, %cl
80 ; X86-SLOW-NEXT: subb %dl, %cl
81 ; X86-SLOW-NEXT: shrl %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 %esi, %edi
86 ; X86-SLOW-NEXT: movl %edi, %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 %edi, %eax
97 ; X64-FAST-NEXT: andb $15, %cl
98 ; X64-FAST-NEXT: # kill: def $cl killed $cl killed $ecx
99 ; X64-FAST-NEXT: shldw %cl, %si, %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 %edi, %esi
108 ; X64-SLOW-NEXT: movl %edx, %ecx
109 ; X64-SLOW-NEXT: shll %cl, %esi
110 ; X64-SLOW-NEXT: movb $16, %cl
111 ; X64-SLOW-NEXT: subb %dl, %cl
112 ; X64-SLOW-NEXT: shrl %cl, %eax
113 ; X64-SLOW-NEXT: orl %esi, %eax
114 ; X64-SLOW-NEXT: testb %dl, %dl
115 ; X64-SLOW-NEXT: cmovel %edi, %eax
116 ; X64-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
117 ; X64-SLOW-NEXT: retq
118 %tmp = tail call i16 @llvm.fshl.i16(i16 %x, i16 %y, i16 %z)
122 define i32 @var_shift_i32(i32 %x, i32 %y, i32 %z) nounwind {
123 ; X86-FAST-LABEL: var_shift_i32:
125 ; X86-FAST-NEXT: movb {{[0-9]+}}(%esp), %cl
126 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
127 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
128 ; X86-FAST-NEXT: shldl %cl, %edx, %eax
129 ; X86-FAST-NEXT: retl
131 ; X86-SLOW-LABEL: var_shift_i32:
133 ; X86-SLOW-NEXT: pushl %edi
134 ; X86-SLOW-NEXT: pushl %esi
135 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %esi
136 ; X86-SLOW-NEXT: movb {{[0-9]+}}(%esp), %dl
137 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
138 ; X86-SLOW-NEXT: movl %eax, %edi
139 ; X86-SLOW-NEXT: movl %edx, %ecx
140 ; X86-SLOW-NEXT: shll %cl, %edi
141 ; X86-SLOW-NEXT: andb $31, %dl
142 ; X86-SLOW-NEXT: movl %edx, %ecx
143 ; X86-SLOW-NEXT: negb %cl
144 ; X86-SLOW-NEXT: shrl %cl, %esi
145 ; X86-SLOW-NEXT: testb %dl, %dl
146 ; X86-SLOW-NEXT: je .LBB2_2
147 ; X86-SLOW-NEXT: # %bb.1:
148 ; X86-SLOW-NEXT: orl %esi, %edi
149 ; X86-SLOW-NEXT: movl %edi, %eax
150 ; X86-SLOW-NEXT: .LBB2_2:
151 ; X86-SLOW-NEXT: popl %esi
152 ; X86-SLOW-NEXT: popl %edi
153 ; X86-SLOW-NEXT: retl
155 ; X64-FAST-LABEL: var_shift_i32:
157 ; X64-FAST-NEXT: movl %edx, %ecx
158 ; X64-FAST-NEXT: movl %edi, %eax
159 ; X64-FAST-NEXT: # kill: def $cl killed $cl killed $ecx
160 ; X64-FAST-NEXT: shldl %cl, %esi, %eax
161 ; X64-FAST-NEXT: retq
163 ; X64-SLOW-LABEL: var_shift_i32:
165 ; X64-SLOW-NEXT: movl %esi, %eax
166 ; X64-SLOW-NEXT: movl %edi, %esi
167 ; X64-SLOW-NEXT: movl %edx, %ecx
168 ; X64-SLOW-NEXT: shll %cl, %esi
169 ; X64-SLOW-NEXT: andb $31, %dl
170 ; X64-SLOW-NEXT: movl %edx, %ecx
171 ; X64-SLOW-NEXT: negb %cl
172 ; X64-SLOW-NEXT: shrl %cl, %eax
173 ; X64-SLOW-NEXT: orl %esi, %eax
174 ; X64-SLOW-NEXT: testb %dl, %dl
175 ; X64-SLOW-NEXT: cmovel %edi, %eax
176 ; X64-SLOW-NEXT: retq
177 %tmp = tail call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 %z)
181 define i32 @var_shift_i32_optsize(i32 %x, i32 %y, i32 %z) nounwind optsize {
182 ; X86-LABEL: var_shift_i32_optsize:
184 ; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
185 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
186 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
187 ; X86-NEXT: shldl %cl, %edx, %eax
190 ; X64-LABEL: var_shift_i32_optsize:
192 ; X64-NEXT: movl %edx, %ecx
193 ; X64-NEXT: movl %edi, %eax
194 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
195 ; X64-NEXT: shldl %cl, %esi, %eax
197 %tmp = tail call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 %z)
201 define i64 @var_shift_i64(i64 %x, i64 %y, i64 %z) nounwind {
202 ; X86-FAST-LABEL: var_shift_i64:
204 ; X86-FAST-NEXT: pushl %ebp
205 ; X86-FAST-NEXT: pushl %ebx
206 ; X86-FAST-NEXT: pushl %edi
207 ; X86-FAST-NEXT: pushl %esi
208 ; X86-FAST-NEXT: pushl %eax
209 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
210 ; X86-FAST-NEXT: movl %eax, (%esp) # 4-byte Spill
211 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
212 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
213 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ebp
214 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ebx
215 ; X86-FAST-NEXT: andl $63, %ebx
216 ; X86-FAST-NEXT: movl %eax, %edi
217 ; X86-FAST-NEXT: movl %ebx, %ecx
218 ; X86-FAST-NEXT: shll %cl, %edi
219 ; X86-FAST-NEXT: shldl %cl, %eax, %ebp
220 ; X86-FAST-NEXT: testb $32, %bl
221 ; X86-FAST-NEXT: je .LBB4_2
222 ; X86-FAST-NEXT: # %bb.1:
223 ; X86-FAST-NEXT: movl %edi, %ebp
224 ; X86-FAST-NEXT: xorl %edi, %edi
225 ; X86-FAST-NEXT: .LBB4_2:
226 ; X86-FAST-NEXT: movb $64, %cl
227 ; X86-FAST-NEXT: subb %bl, %cl
228 ; X86-FAST-NEXT: movl %edx, %esi
229 ; X86-FAST-NEXT: shrl %cl, %esi
230 ; X86-FAST-NEXT: shrdl %cl, %edx, (%esp) # 4-byte Folded Spill
231 ; X86-FAST-NEXT: testb $32, %cl
232 ; X86-FAST-NEXT: jne .LBB4_3
233 ; X86-FAST-NEXT: # %bb.4:
234 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
235 ; X86-FAST-NEXT: movl (%esp), %ecx # 4-byte Reload
236 ; X86-FAST-NEXT: testl %ebx, %ebx
237 ; X86-FAST-NEXT: jne .LBB4_6
238 ; X86-FAST-NEXT: jmp .LBB4_7
239 ; X86-FAST-NEXT: .LBB4_3:
240 ; X86-FAST-NEXT: movl %esi, %ecx
241 ; X86-FAST-NEXT: xorl %esi, %esi
242 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
243 ; X86-FAST-NEXT: testl %ebx, %ebx
244 ; X86-FAST-NEXT: je .LBB4_7
245 ; X86-FAST-NEXT: .LBB4_6:
246 ; X86-FAST-NEXT: orl %esi, %ebp
247 ; X86-FAST-NEXT: orl %ecx, %edi
248 ; X86-FAST-NEXT: movl %edi, %eax
249 ; X86-FAST-NEXT: movl %ebp, %edx
250 ; X86-FAST-NEXT: .LBB4_7:
251 ; X86-FAST-NEXT: addl $4, %esp
252 ; X86-FAST-NEXT: popl %esi
253 ; X86-FAST-NEXT: popl %edi
254 ; X86-FAST-NEXT: popl %ebx
255 ; X86-FAST-NEXT: popl %ebp
256 ; X86-FAST-NEXT: retl
258 ; X86-SLOW-LABEL: var_shift_i64:
260 ; X86-SLOW-NEXT: pushl %ebp
261 ; X86-SLOW-NEXT: pushl %ebx
262 ; X86-SLOW-NEXT: pushl %edi
263 ; X86-SLOW-NEXT: pushl %esi
264 ; X86-SLOW-NEXT: subl $8, %esp
265 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edi
266 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
267 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %esi
268 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ebx
269 ; X86-SLOW-NEXT: andl $63, %ebx
270 ; X86-SLOW-NEXT: movb $64, %dh
271 ; X86-SLOW-NEXT: subb %bl, %dh
272 ; X86-SLOW-NEXT: movl %eax, (%esp) # 4-byte Spill
273 ; X86-SLOW-NEXT: movb %dh, %cl
274 ; X86-SLOW-NEXT: shrl %cl, %eax
275 ; X86-SLOW-NEXT: movb %dh, %dl
276 ; X86-SLOW-NEXT: andb $31, %dl
277 ; X86-SLOW-NEXT: movl %edx, %ecx
278 ; X86-SLOW-NEXT: negb %cl
279 ; X86-SLOW-NEXT: movl %esi, %ebp
280 ; X86-SLOW-NEXT: shll %cl, %ebp
281 ; X86-SLOW-NEXT: testb %dl, %dl
282 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx
283 ; X86-SLOW-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
284 ; X86-SLOW-NEXT: je .LBB4_2
285 ; X86-SLOW-NEXT: # %bb.1:
286 ; X86-SLOW-NEXT: orl %eax, %ebp
287 ; X86-SLOW-NEXT: movl %ebp, (%esp) # 4-byte Spill
288 ; X86-SLOW-NEXT: .LBB4_2:
289 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ebp
290 ; X86-SLOW-NEXT: movl %ebp, %eax
291 ; X86-SLOW-NEXT: movl %ebx, %ecx
292 ; X86-SLOW-NEXT: shll %cl, %eax
293 ; X86-SLOW-NEXT: movb %bl, %ch
294 ; X86-SLOW-NEXT: andb $31, %ch
295 ; X86-SLOW-NEXT: movb %ch, %cl
296 ; X86-SLOW-NEXT: negb %cl
297 ; X86-SLOW-NEXT: shrl %cl, %edi
298 ; X86-SLOW-NEXT: testb %ch, %ch
299 ; X86-SLOW-NEXT: je .LBB4_4
300 ; X86-SLOW-NEXT: # %bb.3:
301 ; X86-SLOW-NEXT: orl %edi, %eax
302 ; X86-SLOW-NEXT: movl %eax, %ebp
303 ; X86-SLOW-NEXT: .LBB4_4:
304 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
305 ; X86-SLOW-NEXT: movl %eax, %edi
306 ; X86-SLOW-NEXT: movl %ebx, %ecx
307 ; X86-SLOW-NEXT: shll %cl, %edi
308 ; X86-SLOW-NEXT: testb $32, %bl
309 ; X86-SLOW-NEXT: je .LBB4_6
310 ; X86-SLOW-NEXT: # %bb.5:
311 ; X86-SLOW-NEXT: movl %edi, %ebp
312 ; X86-SLOW-NEXT: xorl %edi, %edi
313 ; X86-SLOW-NEXT: .LBB4_6:
314 ; X86-SLOW-NEXT: movb %dh, %cl
315 ; X86-SLOW-NEXT: shrl %cl, %esi
316 ; X86-SLOW-NEXT: testb $32, %dh
317 ; X86-SLOW-NEXT: jne .LBB4_7
318 ; X86-SLOW-NEXT: # %bb.8:
319 ; X86-SLOW-NEXT: movl (%esp), %ecx # 4-byte Reload
320 ; X86-SLOW-NEXT: testl %ebx, %ebx
321 ; X86-SLOW-NEXT: jne .LBB4_10
322 ; X86-SLOW-NEXT: jmp .LBB4_11
323 ; X86-SLOW-NEXT: .LBB4_7:
324 ; X86-SLOW-NEXT: movl %esi, %ecx
325 ; X86-SLOW-NEXT: xorl %esi, %esi
326 ; X86-SLOW-NEXT: testl %ebx, %ebx
327 ; X86-SLOW-NEXT: je .LBB4_11
328 ; X86-SLOW-NEXT: .LBB4_10:
329 ; X86-SLOW-NEXT: orl %esi, %ebp
330 ; X86-SLOW-NEXT: orl %ecx, %edi
331 ; X86-SLOW-NEXT: movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
332 ; X86-SLOW-NEXT: movl %edi, %eax
333 ; X86-SLOW-NEXT: .LBB4_11:
334 ; X86-SLOW-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
335 ; X86-SLOW-NEXT: addl $8, %esp
336 ; X86-SLOW-NEXT: popl %esi
337 ; X86-SLOW-NEXT: popl %edi
338 ; X86-SLOW-NEXT: popl %ebx
339 ; X86-SLOW-NEXT: popl %ebp
340 ; X86-SLOW-NEXT: retl
342 ; X64-FAST-LABEL: var_shift_i64:
344 ; X64-FAST-NEXT: movq %rdx, %rcx
345 ; X64-FAST-NEXT: movq %rdi, %rax
346 ; X64-FAST-NEXT: # kill: def $cl killed $cl killed $rcx
347 ; X64-FAST-NEXT: shldq %cl, %rsi, %rax
348 ; X64-FAST-NEXT: retq
350 ; X64-SLOW-LABEL: var_shift_i64:
352 ; X64-SLOW-NEXT: movq %rsi, %rax
353 ; X64-SLOW-NEXT: movq %rdi, %rsi
354 ; X64-SLOW-NEXT: movl %edx, %ecx
355 ; X64-SLOW-NEXT: shlq %cl, %rsi
356 ; X64-SLOW-NEXT: andb $63, %dl
357 ; X64-SLOW-NEXT: movl %edx, %ecx
358 ; X64-SLOW-NEXT: negb %cl
359 ; X64-SLOW-NEXT: shrq %cl, %rax
360 ; X64-SLOW-NEXT: orq %rsi, %rax
361 ; X64-SLOW-NEXT: testb %dl, %dl
362 ; X64-SLOW-NEXT: cmoveq %rdi, %rax
363 ; X64-SLOW-NEXT: retq
364 %tmp = tail call i64 @llvm.fshl.i64(i64 %x, i64 %y, i64 %z)
372 define i8 @const_shift_i8(i8 %x, i8 %y) nounwind {
373 ; X86-LABEL: const_shift_i8:
375 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
376 ; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
378 ; X86-NEXT: shlb $7, %al
379 ; X86-NEXT: orb %cl, %al
382 ; X64-LABEL: const_shift_i8:
384 ; X64-NEXT: movl %edi, %eax
385 ; X64-NEXT: shrb %sil
386 ; X64-NEXT: shlb $7, %al
387 ; X64-NEXT: orb %sil, %al
388 ; X64-NEXT: # kill: def $al killed $al killed $eax
390 %tmp = tail call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 7)
394 define i16 @const_shift_i16(i16 %x, i16 %y) nounwind {
395 ; X86-FAST-LABEL: const_shift_i16:
397 ; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
398 ; X86-FAST-NEXT: movzwl {{[0-9]+}}(%esp), %eax
399 ; X86-FAST-NEXT: shldw $7, %cx, %ax
400 ; X86-FAST-NEXT: retl
402 ; X86-SLOW-LABEL: const_shift_i16:
404 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
405 ; X86-SLOW-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
406 ; X86-SLOW-NEXT: shrl $9, %ecx
407 ; X86-SLOW-NEXT: shll $7, %eax
408 ; X86-SLOW-NEXT: orl %ecx, %eax
409 ; X86-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
410 ; X86-SLOW-NEXT: retl
412 ; X64-FAST-LABEL: const_shift_i16:
414 ; X64-FAST-NEXT: movl %edi, %eax
415 ; X64-FAST-NEXT: shldw $7, %si, %ax
416 ; X64-FAST-NEXT: # kill: def $ax killed $ax killed $eax
417 ; X64-FAST-NEXT: retq
419 ; X64-SLOW-LABEL: const_shift_i16:
421 ; X64-SLOW-NEXT: movzwl %si, %eax
422 ; X64-SLOW-NEXT: shll $7, %edi
423 ; X64-SLOW-NEXT: shrl $9, %eax
424 ; X64-SLOW-NEXT: orl %edi, %eax
425 ; X64-SLOW-NEXT: # kill: def $ax killed $ax killed $eax
426 ; X64-SLOW-NEXT: retq
427 %tmp = tail call i16 @llvm.fshl.i16(i16 %x, i16 %y, i16 7)
431 define i32 @const_shift_i32(i32 %x, i32 %y) nounwind {
432 ; X86-FAST-LABEL: const_shift_i32:
434 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ecx
435 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
436 ; X86-FAST-NEXT: shldl $7, %ecx, %eax
437 ; X86-FAST-NEXT: retl
439 ; X86-SLOW-LABEL: const_shift_i32:
441 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %eax
442 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx
443 ; X86-SLOW-NEXT: shrl $25, %ecx
444 ; X86-SLOW-NEXT: shll $7, %eax
445 ; X86-SLOW-NEXT: orl %ecx, %eax
446 ; X86-SLOW-NEXT: retl
448 ; X64-FAST-LABEL: const_shift_i32:
450 ; X64-FAST-NEXT: movl %edi, %eax
451 ; X64-FAST-NEXT: shldl $7, %esi, %eax
452 ; X64-FAST-NEXT: retq
454 ; X64-SLOW-LABEL: const_shift_i32:
456 ; X64-SLOW-NEXT: # kill: def $esi killed $esi def $rsi
457 ; X64-SLOW-NEXT: # kill: def $edi killed $edi def $rdi
458 ; X64-SLOW-NEXT: shrl $25, %esi
459 ; X64-SLOW-NEXT: shll $7, %edi
460 ; X64-SLOW-NEXT: leal (%rdi,%rsi), %eax
461 ; X64-SLOW-NEXT: retq
462 %tmp = tail call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 7)
466 define i64 @const_shift_i64(i64 %x, i64 %y) nounwind {
467 ; X86-FAST-LABEL: const_shift_i64:
469 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %eax
470 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %ecx
471 ; X86-FAST-NEXT: movl {{[0-9]+}}(%esp), %edx
472 ; X86-FAST-NEXT: shrdl $25, %ecx, %eax
473 ; X86-FAST-NEXT: shldl $7, %ecx, %edx
474 ; X86-FAST-NEXT: retl
476 ; X86-SLOW-LABEL: const_shift_i64:
478 ; X86-SLOW-NEXT: pushl %esi
479 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %ecx
480 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %edx
481 ; X86-SLOW-NEXT: movl {{[0-9]+}}(%esp), %esi
482 ; X86-SLOW-NEXT: shrl $25, %esi
483 ; X86-SLOW-NEXT: movl %ecx, %eax
484 ; X86-SLOW-NEXT: shll $7, %eax
485 ; X86-SLOW-NEXT: orl %esi, %eax
486 ; X86-SLOW-NEXT: shrl $25, %ecx
487 ; X86-SLOW-NEXT: shll $7, %edx
488 ; X86-SLOW-NEXT: orl %ecx, %edx
489 ; X86-SLOW-NEXT: popl %esi
490 ; X86-SLOW-NEXT: retl
492 ; X64-FAST-LABEL: const_shift_i64:
494 ; X64-FAST-NEXT: movq %rdi, %rax
495 ; X64-FAST-NEXT: shldq $7, %rsi, %rax
496 ; X64-FAST-NEXT: retq
498 ; X64-SLOW-LABEL: const_shift_i64:
500 ; X64-SLOW-NEXT: shrq $57, %rsi
501 ; X64-SLOW-NEXT: shlq $7, %rdi
502 ; X64-SLOW-NEXT: leaq (%rdi,%rsi), %rax
503 ; X64-SLOW-NEXT: retq
504 %tmp = tail call i64 @llvm.fshl.i64(i64 %x, i64 %y, i64 7)