1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64
3 ; RUN: llc < %s -mtriple=i686 -mattr=cmov | FileCheck %s --check-prefix=X86
5 declare i4 @llvm.sdiv.fix.i4 (i4, i4, i32)
6 declare i15 @llvm.sdiv.fix.i15 (i15, i15, i32)
7 declare i16 @llvm.sdiv.fix.i16 (i16, i16, i32)
8 declare i18 @llvm.sdiv.fix.i18 (i18, i18, i32)
9 declare i64 @llvm.sdiv.fix.i64 (i64, i64, i32)
10 declare <4 x i32> @llvm.sdiv.fix.v4i32(<4 x i32>, <4 x i32>, i32)
12 define i16 @func(i16 %x, i16 %y) nounwind {
15 ; X64-NEXT: movswl %si, %esi
16 ; X64-NEXT: movswl %di, %ecx
17 ; X64-NEXT: shll $7, %ecx
18 ; X64-NEXT: movl %ecx, %eax
20 ; X64-NEXT: idivl %esi
21 ; X64-NEXT: # kill: def $eax killed $eax def $rax
22 ; X64-NEXT: leal -1(%rax), %edi
23 ; X64-NEXT: testl %esi, %esi
25 ; X64-NEXT: testl %ecx, %ecx
27 ; X64-NEXT: xorb %sil, %cl
28 ; X64-NEXT: testl %edx, %edx
30 ; X64-NEXT: testb %cl, %dl
31 ; X64-NEXT: cmovnel %edi, %eax
32 ; X64-NEXT: # kill: def $ax killed $ax killed $rax
37 ; X86-NEXT: pushl %ebx
38 ; X86-NEXT: pushl %edi
39 ; X86-NEXT: pushl %esi
40 ; X86-NEXT: movswl {{[0-9]+}}(%esp), %esi
41 ; X86-NEXT: movswl {{[0-9]+}}(%esp), %ecx
42 ; X86-NEXT: shll $7, %ecx
43 ; X86-NEXT: movl %ecx, %eax
45 ; X86-NEXT: idivl %esi
46 ; X86-NEXT: leal -1(%eax), %edi
47 ; X86-NEXT: testl %esi, %esi
49 ; X86-NEXT: testl %ecx, %ecx
51 ; X86-NEXT: xorb %bl, %cl
52 ; X86-NEXT: testl %edx, %edx
54 ; X86-NEXT: testb %cl, %dl
55 ; X86-NEXT: cmovnel %edi, %eax
56 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
61 %tmp = call i16 @llvm.sdiv.fix.i16(i16 %x, i16 %y, i32 7)
65 define i16 @func2(i8 %x, i8 %y) nounwind {
68 ; X64-NEXT: movsbl %sil, %esi
69 ; X64-NEXT: movsbl %dil, %ecx
70 ; X64-NEXT: shll $14, %ecx
71 ; X64-NEXT: movl %ecx, %eax
73 ; X64-NEXT: idivl %esi
74 ; X64-NEXT: # kill: def $eax killed $eax def $rax
75 ; X64-NEXT: leal -1(%rax), %edi
76 ; X64-NEXT: testl %esi, %esi
78 ; X64-NEXT: testl %ecx, %ecx
80 ; X64-NEXT: xorb %sil, %cl
81 ; X64-NEXT: testl %edx, %edx
83 ; X64-NEXT: testb %cl, %dl
84 ; X64-NEXT: cmovel %eax, %edi
85 ; X64-NEXT: addl %edi, %edi
86 ; X64-NEXT: movswl %di, %eax
88 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
93 ; X86-NEXT: pushl %ebx
94 ; X86-NEXT: pushl %edi
95 ; X86-NEXT: pushl %esi
96 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %edi
97 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %ecx
98 ; X86-NEXT: shll $14, %ecx
99 ; X86-NEXT: movl %ecx, %eax
101 ; X86-NEXT: idivl %edi
102 ; X86-NEXT: leal -1(%eax), %esi
103 ; X86-NEXT: testl %edi, %edi
105 ; X86-NEXT: testl %ecx, %ecx
107 ; X86-NEXT: xorb %bl, %cl
108 ; X86-NEXT: testl %edx, %edx
109 ; X86-NEXT: setne %dl
110 ; X86-NEXT: testb %cl, %dl
111 ; X86-NEXT: cmovel %eax, %esi
112 ; X86-NEXT: addl %esi, %esi
113 ; X86-NEXT: movswl %si, %eax
114 ; X86-NEXT: shrl %eax
115 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
116 ; X86-NEXT: popl %esi
117 ; X86-NEXT: popl %edi
118 ; X86-NEXT: popl %ebx
120 %x2 = sext i8 %x to i15
121 %y2 = sext i8 %y to i15
122 %tmp = call i15 @llvm.sdiv.fix.i15(i15 %x2, i15 %y2, i32 14)
123 %tmp2 = sext i15 %tmp to i16
127 define i16 @func3(i15 %x, i8 %y) nounwind {
130 ; X64-NEXT: shll $8, %esi
131 ; X64-NEXT: movswl %si, %ecx
132 ; X64-NEXT: addl %edi, %edi
133 ; X64-NEXT: shrl $4, %ecx
134 ; X64-NEXT: movl %edi, %eax
136 ; X64-NEXT: idivw %cx
137 ; X64-NEXT: # kill: def $ax killed $ax def $rax
138 ; X64-NEXT: leal -1(%rax), %esi
139 ; X64-NEXT: testw %di, %di
140 ; X64-NEXT: sets %dil
141 ; X64-NEXT: testw %cx, %cx
143 ; X64-NEXT: xorb %dil, %cl
144 ; X64-NEXT: testw %dx, %dx
145 ; X64-NEXT: setne %dl
146 ; X64-NEXT: testb %cl, %dl
147 ; X64-NEXT: cmovel %eax, %esi
148 ; X64-NEXT: addl %esi, %esi
149 ; X64-NEXT: movswl %si, %eax
150 ; X64-NEXT: shrl %eax
151 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
156 ; X86-NEXT: pushl %edi
157 ; X86-NEXT: pushl %esi
158 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
159 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
160 ; X86-NEXT: shll $8, %eax
161 ; X86-NEXT: movswl %ax, %esi
162 ; X86-NEXT: addl %ecx, %ecx
163 ; X86-NEXT: shrl $4, %esi
164 ; X86-NEXT: movl %ecx, %eax
166 ; X86-NEXT: idivw %si
167 ; X86-NEXT: # kill: def $ax killed $ax def $eax
168 ; X86-NEXT: leal -1(%eax), %edi
169 ; X86-NEXT: testw %cx, %cx
171 ; X86-NEXT: testw %si, %si
173 ; X86-NEXT: xorb %cl, %ch
174 ; X86-NEXT: testw %dx, %dx
175 ; X86-NEXT: setne %cl
176 ; X86-NEXT: testb %ch, %cl
177 ; X86-NEXT: cmovel %eax, %edi
178 ; X86-NEXT: addl %edi, %edi
179 ; X86-NEXT: movswl %di, %eax
180 ; X86-NEXT: shrl %eax
181 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
182 ; X86-NEXT: popl %esi
183 ; X86-NEXT: popl %edi
185 %y2 = sext i8 %y to i15
187 %tmp = call i15 @llvm.sdiv.fix.i15(i15 %x, i15 %y3, i32 4)
188 %tmp2 = sext i15 %tmp to i16
192 define i4 @func4(i4 %x, i4 %y) nounwind {
195 ; X64-NEXT: shlb $4, %sil
196 ; X64-NEXT: sarb $4, %sil
197 ; X64-NEXT: shlb $4, %dil
198 ; X64-NEXT: sarb $4, %dil
199 ; X64-NEXT: shlb $2, %dil
200 ; X64-NEXT: movsbl %dil, %ecx
201 ; X64-NEXT: movl %ecx, %eax
202 ; X64-NEXT: idivb %sil
203 ; X64-NEXT: movsbl %ah, %edx
204 ; X64-NEXT: movzbl %al, %edi
205 ; X64-NEXT: leal -1(%rdi), %eax
206 ; X64-NEXT: movzbl %al, %eax
207 ; X64-NEXT: testb %sil, %sil
208 ; X64-NEXT: sets %sil
209 ; X64-NEXT: testb %cl, %cl
211 ; X64-NEXT: xorb %sil, %cl
212 ; X64-NEXT: testb %dl, %dl
213 ; X64-NEXT: setne %dl
214 ; X64-NEXT: testb %cl, %dl
215 ; X64-NEXT: cmovel %edi, %eax
216 ; X64-NEXT: # kill: def $al killed $al killed $eax
221 ; X86-NEXT: pushl %ebx
222 ; X86-NEXT: pushl %esi
223 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
224 ; X86-NEXT: shlb $4, %cl
225 ; X86-NEXT: sarb $4, %cl
226 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %edx
227 ; X86-NEXT: shlb $4, %dl
228 ; X86-NEXT: sarb $4, %dl
229 ; X86-NEXT: shlb $2, %dl
230 ; X86-NEXT: movsbl %dl, %eax
231 ; X86-NEXT: idivb %cl
232 ; X86-NEXT: movsbl %ah, %ebx
233 ; X86-NEXT: movzbl %al, %esi
235 ; X86-NEXT: movzbl %al, %eax
236 ; X86-NEXT: testb %cl, %cl
238 ; X86-NEXT: testb %dl, %dl
240 ; X86-NEXT: xorb %cl, %dl
241 ; X86-NEXT: testb %bl, %bl
242 ; X86-NEXT: setne %cl
243 ; X86-NEXT: testb %dl, %cl
244 ; X86-NEXT: cmovel %esi, %eax
245 ; X86-NEXT: # kill: def $al killed $al killed $eax
246 ; X86-NEXT: popl %esi
247 ; X86-NEXT: popl %ebx
249 %tmp = call i4 @llvm.sdiv.fix.i4(i4 %x, i4 %y, i32 2)
253 define i64 @func5(i64 %x, i64 %y) nounwind {
256 ; X64-NEXT: pushq %rbp
257 ; X64-NEXT: pushq %r15
258 ; X64-NEXT: pushq %r14
259 ; X64-NEXT: pushq %r13
260 ; X64-NEXT: pushq %r12
261 ; X64-NEXT: pushq %rbx
262 ; X64-NEXT: pushq %rax
263 ; X64-NEXT: movq %rsi, %rbx
264 ; X64-NEXT: movq %rdi, %r14
265 ; X64-NEXT: movq %rdi, %r15
266 ; X64-NEXT: sarq $63, %r15
267 ; X64-NEXT: shldq $31, %rdi, %r15
268 ; X64-NEXT: shlq $31, %r14
269 ; X64-NEXT: movq %rsi, %r12
270 ; X64-NEXT: sarq $63, %r12
271 ; X64-NEXT: movq %r14, %rdi
272 ; X64-NEXT: movq %r15, %rsi
273 ; X64-NEXT: movq %rbx, %rdx
274 ; X64-NEXT: movq %r12, %rcx
275 ; X64-NEXT: callq __divti3@PLT
276 ; X64-NEXT: movq %rax, (%rsp) # 8-byte Spill
277 ; X64-NEXT: leaq -1(%rax), %rbp
278 ; X64-NEXT: testq %r15, %r15
280 ; X64-NEXT: testq %r12, %r12
281 ; X64-NEXT: sets %r13b
282 ; X64-NEXT: xorb %al, %r13b
283 ; X64-NEXT: movq %r14, %rdi
284 ; X64-NEXT: movq %r15, %rsi
285 ; X64-NEXT: movq %rbx, %rdx
286 ; X64-NEXT: movq %r12, %rcx
287 ; X64-NEXT: callq __modti3@PLT
288 ; X64-NEXT: orq %rax, %rdx
289 ; X64-NEXT: setne %al
290 ; X64-NEXT: testb %r13b, %al
291 ; X64-NEXT: cmoveq (%rsp), %rbp # 8-byte Folded Reload
292 ; X64-NEXT: movq %rbp, %rax
293 ; X64-NEXT: addq $8, %rsp
294 ; X64-NEXT: popq %rbx
295 ; X64-NEXT: popq %r12
296 ; X64-NEXT: popq %r13
297 ; X64-NEXT: popq %r14
298 ; X64-NEXT: popq %r15
299 ; X64-NEXT: popq %rbp
304 ; X86-NEXT: pushl %ebp
305 ; X86-NEXT: movl %esp, %ebp
306 ; X86-NEXT: pushl %ebx
307 ; X86-NEXT: pushl %edi
308 ; X86-NEXT: pushl %esi
309 ; X86-NEXT: andl $-16, %esp
310 ; X86-NEXT: subl $80, %esp
311 ; X86-NEXT: movl 8(%ebp), %ecx
312 ; X86-NEXT: movl 12(%ebp), %eax
313 ; X86-NEXT: movl 20(%ebp), %edx
314 ; X86-NEXT: movl %edx, %esi
315 ; X86-NEXT: sarl $31, %esi
316 ; X86-NEXT: movl %eax, %edi
317 ; X86-NEXT: sarl $31, %edi
318 ; X86-NEXT: movl %edi, %ebx
319 ; X86-NEXT: shldl $31, %eax, %ebx
320 ; X86-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
321 ; X86-NEXT: shldl $31, %ecx, %eax
322 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
323 ; X86-NEXT: shll $31, %ecx
324 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
325 ; X86-NEXT: pushl %esi
326 ; X86-NEXT: pushl %esi
327 ; X86-NEXT: pushl %edx
328 ; X86-NEXT: pushl 16(%ebp)
329 ; X86-NEXT: pushl %edi
330 ; X86-NEXT: pushl %ebx
331 ; X86-NEXT: pushl %eax
332 ; X86-NEXT: pushl %ecx
333 ; X86-NEXT: leal {{[0-9]+}}(%esp), %eax
334 ; X86-NEXT: pushl %eax
335 ; X86-NEXT: calll __divti3
336 ; X86-NEXT: addl $32, %esp
337 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
338 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
339 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
340 ; X86-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
341 ; X86-NEXT: movl %ecx, %eax
342 ; X86-NEXT: subl $1, %eax
343 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
344 ; X86-NEXT: sbbl $0, %ebx
345 ; X86-NEXT: testl %esi, %esi
347 ; X86-NEXT: testl %edi, %edi
349 ; X86-NEXT: xorb %al, %cl
350 ; X86-NEXT: movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
351 ; X86-NEXT: leal {{[0-9]+}}(%esp), %eax
352 ; X86-NEXT: pushl %esi
353 ; X86-NEXT: pushl %esi
354 ; X86-NEXT: pushl 20(%ebp)
355 ; X86-NEXT: pushl 16(%ebp)
356 ; X86-NEXT: pushl %edi
357 ; X86-NEXT: pushl {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
358 ; X86-NEXT: pushl {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
359 ; X86-NEXT: pushl {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
360 ; X86-NEXT: pushl %eax
361 ; X86-NEXT: calll __modti3
362 ; X86-NEXT: addl $32, %esp
363 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
364 ; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
365 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
366 ; X86-NEXT: orl {{[0-9]+}}(%esp), %ecx
367 ; X86-NEXT: orl %eax, %ecx
368 ; X86-NEXT: setne %al
369 ; X86-NEXT: testb %al, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Reload
370 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
371 ; X86-NEXT: cmovel {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload
372 ; X86-NEXT: cmovel {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Folded Reload
373 ; X86-NEXT: movl %ebx, %edx
374 ; X86-NEXT: leal -12(%ebp), %esp
375 ; X86-NEXT: popl %esi
376 ; X86-NEXT: popl %edi
377 ; X86-NEXT: popl %ebx
378 ; X86-NEXT: popl %ebp
380 %tmp = call i64 @llvm.sdiv.fix.i64(i64 %x, i64 %y, i32 31)
384 define i18 @func6(i16 %x, i16 %y) nounwind {
387 ; X64-NEXT: movswl %di, %ecx
388 ; X64-NEXT: movswl %si, %esi
389 ; X64-NEXT: shll $7, %ecx
390 ; X64-NEXT: movl %ecx, %eax
392 ; X64-NEXT: idivl %esi
393 ; X64-NEXT: # kill: def $eax killed $eax def $rax
394 ; X64-NEXT: leal -1(%rax), %edi
395 ; X64-NEXT: testl %esi, %esi
396 ; X64-NEXT: sets %sil
397 ; X64-NEXT: testl %ecx, %ecx
399 ; X64-NEXT: xorb %sil, %cl
400 ; X64-NEXT: testl %edx, %edx
401 ; X64-NEXT: setne %dl
402 ; X64-NEXT: testb %cl, %dl
403 ; X64-NEXT: cmovnel %edi, %eax
404 ; X64-NEXT: # kill: def $eax killed $eax killed $rax
409 ; X86-NEXT: pushl %ebx
410 ; X86-NEXT: pushl %edi
411 ; X86-NEXT: pushl %esi
412 ; X86-NEXT: movswl {{[0-9]+}}(%esp), %esi
413 ; X86-NEXT: movswl {{[0-9]+}}(%esp), %ecx
414 ; X86-NEXT: shll $7, %ecx
415 ; X86-NEXT: movl %ecx, %eax
417 ; X86-NEXT: idivl %esi
418 ; X86-NEXT: leal -1(%eax), %edi
419 ; X86-NEXT: testl %esi, %esi
421 ; X86-NEXT: testl %ecx, %ecx
423 ; X86-NEXT: xorb %bl, %cl
424 ; X86-NEXT: testl %edx, %edx
425 ; X86-NEXT: setne %dl
426 ; X86-NEXT: testb %cl, %dl
427 ; X86-NEXT: cmovnel %edi, %eax
428 ; X86-NEXT: popl %esi
429 ; X86-NEXT: popl %edi
430 ; X86-NEXT: popl %ebx
432 %x2 = sext i16 %x to i18
433 %y2 = sext i16 %y to i18
434 %tmp = call i18 @llvm.sdiv.fix.i18(i18 %x2, i18 %y2, i32 7)
438 define <4 x i32> @vec(<4 x i32> %x, <4 x i32> %y) nounwind {
441 ; X64-NEXT: pxor %xmm2, %xmm2
442 ; X64-NEXT: pcmpgtd %xmm1, %xmm2
443 ; X64-NEXT: pshufd {{.*#+}} xmm4 = xmm1[2,3,2,3]
444 ; X64-NEXT: movdqa %xmm1, %xmm3
445 ; X64-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
446 ; X64-NEXT: movq %xmm3, %rcx
447 ; X64-NEXT: pxor %xmm5, %xmm5
448 ; X64-NEXT: pcmpgtd %xmm0, %xmm5
449 ; X64-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
450 ; X64-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1]
451 ; X64-NEXT: psllq $31, %xmm0
452 ; X64-NEXT: movq %xmm0, %rax
454 ; X64-NEXT: idivq %rcx
455 ; X64-NEXT: movq %rax, %rsi
456 ; X64-NEXT: movq %rdx, %r8
457 ; X64-NEXT: pshufd {{.*#+}} xmm3 = xmm3[2,3,2,3]
458 ; X64-NEXT: movq %xmm3, %rcx
459 ; X64-NEXT: pshufd {{.*#+}} xmm3 = xmm0[2,3,2,3]
460 ; X64-NEXT: movq %xmm3, %rax
462 ; X64-NEXT: idivq %rcx
463 ; X64-NEXT: movq %rax, %rdi
464 ; X64-NEXT: movq %rdx, %r10
465 ; X64-NEXT: pxor %xmm3, %xmm3
466 ; X64-NEXT: pcmpgtd %xmm4, %xmm3
467 ; X64-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1]
468 ; X64-NEXT: movq %xmm4, %rcx
469 ; X64-NEXT: pxor %xmm5, %xmm5
470 ; X64-NEXT: pcmpgtd %xmm1, %xmm5
471 ; X64-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm5[0],xmm1[1],xmm5[1]
472 ; X64-NEXT: psllq $31, %xmm1
473 ; X64-NEXT: movq %xmm1, %rax
475 ; X64-NEXT: idivq %rcx
476 ; X64-NEXT: movq %rax, %rcx
477 ; X64-NEXT: movq %rdx, %r9
478 ; X64-NEXT: pshufd {{.*#+}} xmm4 = xmm4[2,3,2,3]
479 ; X64-NEXT: movq %xmm4, %r11
480 ; X64-NEXT: pshufd {{.*#+}} xmm4 = xmm1[2,3,2,3]
481 ; X64-NEXT: movq %xmm4, %rax
483 ; X64-NEXT: idivq %r11
484 ; X64-NEXT: movq %r8, %xmm5
485 ; X64-NEXT: movq %r10, %xmm6
486 ; X64-NEXT: pxor %xmm4, %xmm4
487 ; X64-NEXT: punpcklqdq {{.*#+}} xmm5 = xmm5[0],xmm6[0]
488 ; X64-NEXT: pcmpeqd %xmm4, %xmm5
489 ; X64-NEXT: pshufd {{.*#+}} xmm6 = xmm5[1,0,3,2]
490 ; X64-NEXT: pand %xmm5, %xmm6
491 ; X64-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,0,1,1]
492 ; X64-NEXT: pxor %xmm5, %xmm5
493 ; X64-NEXT: pcmpgtd %xmm2, %xmm5
494 ; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
495 ; X64-NEXT: pxor %xmm2, %xmm2
496 ; X64-NEXT: pcmpgtd %xmm0, %xmm2
497 ; X64-NEXT: movq %rsi, %xmm0
498 ; X64-NEXT: pxor %xmm5, %xmm2
499 ; X64-NEXT: movq %rdi, %xmm5
500 ; X64-NEXT: pandn %xmm2, %xmm6
501 ; X64-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm5[0]
502 ; X64-NEXT: movdqa %xmm6, %xmm5
503 ; X64-NEXT: pandn %xmm0, %xmm5
504 ; X64-NEXT: pcmpeqd %xmm2, %xmm2
505 ; X64-NEXT: paddq %xmm2, %xmm0
506 ; X64-NEXT: pand %xmm6, %xmm0
507 ; X64-NEXT: por %xmm5, %xmm0
508 ; X64-NEXT: movq %r9, %xmm5
509 ; X64-NEXT: movq %rdx, %xmm6
510 ; X64-NEXT: punpcklqdq {{.*#+}} xmm5 = xmm5[0],xmm6[0]
511 ; X64-NEXT: pcmpeqd %xmm4, %xmm5
512 ; X64-NEXT: pshufd {{.*#+}} xmm6 = xmm5[1,0,3,2]
513 ; X64-NEXT: pand %xmm5, %xmm6
514 ; X64-NEXT: pshufd {{.*#+}} xmm3 = xmm3[0,0,1,1]
515 ; X64-NEXT: pxor %xmm5, %xmm5
516 ; X64-NEXT: pcmpgtd %xmm3, %xmm5
517 ; X64-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
518 ; X64-NEXT: pcmpgtd %xmm1, %xmm4
519 ; X64-NEXT: pxor %xmm5, %xmm4
520 ; X64-NEXT: pandn %xmm4, %xmm6
521 ; X64-NEXT: movq %rcx, %xmm1
522 ; X64-NEXT: movq %rax, %xmm3
523 ; X64-NEXT: punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
524 ; X64-NEXT: movdqa %xmm6, %xmm3
525 ; X64-NEXT: pandn %xmm1, %xmm3
526 ; X64-NEXT: paddq %xmm2, %xmm1
527 ; X64-NEXT: pand %xmm6, %xmm1
528 ; X64-NEXT: por %xmm3, %xmm1
529 ; X64-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
534 ; X86-NEXT: pushl %ebp
535 ; X86-NEXT: pushl %ebx
536 ; X86-NEXT: pushl %edi
537 ; X86-NEXT: pushl %esi
538 ; X86-NEXT: subl $60, %esp
539 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
540 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
541 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
542 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
543 ; X86-NEXT: movl %esi, %ebp
544 ; X86-NEXT: sarl $31, %ebp
545 ; X86-NEXT: movl %ebp, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
546 ; X86-NEXT: movl %ecx, %edx
547 ; X86-NEXT: shll $31, %edx
548 ; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
549 ; X86-NEXT: movl %ecx, %eax
550 ; X86-NEXT: shrl $31, %eax
551 ; X86-NEXT: shldl $31, %ecx, %eax
552 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
553 ; X86-NEXT: pushl %ebp
554 ; X86-NEXT: pushl %esi
555 ; X86-NEXT: pushl %eax
556 ; X86-NEXT: pushl %edx
557 ; X86-NEXT: calll __divdi3
558 ; X86-NEXT: addl $16, %esp
559 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
560 ; X86-NEXT: movl %edi, %eax
561 ; X86-NEXT: sarl $31, %eax
562 ; X86-NEXT: movl %ebx, %ebp
563 ; X86-NEXT: shll $31, %ebp
564 ; X86-NEXT: movl %ebx, %ecx
565 ; X86-NEXT: shrl $31, %ecx
566 ; X86-NEXT: shldl $31, %ebx, %ecx
567 ; X86-NEXT: pushl %eax
568 ; X86-NEXT: movl %eax, %esi
569 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
570 ; X86-NEXT: pushl %edi
571 ; X86-NEXT: pushl %ecx
572 ; X86-NEXT: movl %ecx, %ebx
573 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
574 ; X86-NEXT: pushl %ebp
575 ; X86-NEXT: calll __moddi3
576 ; X86-NEXT: addl $16, %esp
577 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
578 ; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
579 ; X86-NEXT: pushl %esi
580 ; X86-NEXT: pushl %edi
581 ; X86-NEXT: pushl %ebx
582 ; X86-NEXT: pushl %ebp
583 ; X86-NEXT: calll __divdi3
584 ; X86-NEXT: addl $16, %esp
585 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
586 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
587 ; X86-NEXT: movl %eax, %ecx
588 ; X86-NEXT: sarl $31, %ecx
589 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
590 ; X86-NEXT: movl %edx, %ebx
591 ; X86-NEXT: shll $31, %ebx
592 ; X86-NEXT: movl %edx, %edi
593 ; X86-NEXT: shrl $31, %edi
594 ; X86-NEXT: shldl $31, %edx, %edi
595 ; X86-NEXT: pushl %ecx
596 ; X86-NEXT: movl %ecx, %ebp
597 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
598 ; X86-NEXT: pushl %eax
599 ; X86-NEXT: movl %eax, %esi
600 ; X86-NEXT: pushl %edi
601 ; X86-NEXT: pushl %ebx
602 ; X86-NEXT: calll __moddi3
603 ; X86-NEXT: addl $16, %esp
604 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
605 ; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
606 ; X86-NEXT: pushl %ebp
607 ; X86-NEXT: pushl %esi
608 ; X86-NEXT: pushl %edi
609 ; X86-NEXT: pushl %ebx
610 ; X86-NEXT: calll __divdi3
611 ; X86-NEXT: addl $16, %esp
612 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
613 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
614 ; X86-NEXT: movl %eax, %ebx
615 ; X86-NEXT: sarl $31, %ebx
616 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
617 ; X86-NEXT: movl %ecx, %esi
618 ; X86-NEXT: shll $31, %esi
619 ; X86-NEXT: movl %ecx, %ebp
620 ; X86-NEXT: shrl $31, %ebp
621 ; X86-NEXT: shldl $31, %ecx, %ebp
622 ; X86-NEXT: pushl %ebx
623 ; X86-NEXT: pushl %eax
624 ; X86-NEXT: pushl %ebp
625 ; X86-NEXT: pushl %esi
626 ; X86-NEXT: calll __moddi3
627 ; X86-NEXT: addl $16, %esp
628 ; X86-NEXT: movl %eax, (%esp) # 4-byte Spill
629 ; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
630 ; X86-NEXT: pushl %ebx
631 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
632 ; X86-NEXT: pushl %ebp
633 ; X86-NEXT: pushl %esi
634 ; X86-NEXT: calll __divdi3
635 ; X86-NEXT: addl $16, %esp
636 ; X86-NEXT: testl %ebp, %ebp
638 ; X86-NEXT: testl %ebx, %ebx
640 ; X86-NEXT: xorb %cl, %dl
641 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
642 ; X86-NEXT: orl (%esp), %ecx # 4-byte Folded Reload
643 ; X86-NEXT: setne %cl
644 ; X86-NEXT: testb %dl, %cl
645 ; X86-NEXT: leal -1(%eax), %ecx
646 ; X86-NEXT: cmovel %eax, %ecx
647 ; X86-NEXT: movl %ecx, (%esp) # 4-byte Spill
648 ; X86-NEXT: testl %edi, %edi
650 ; X86-NEXT: cmpl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
652 ; X86-NEXT: xorb %al, %cl
653 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
654 ; X86-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload
655 ; X86-NEXT: setne %al
656 ; X86-NEXT: testb %cl, %al
657 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
658 ; X86-NEXT: leal -1(%eax), %ecx
659 ; X86-NEXT: cmovel %eax, %ecx
660 ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
661 ; X86-NEXT: cmpl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
663 ; X86-NEXT: cmpl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
665 ; X86-NEXT: xorb %al, %cl
666 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
667 ; X86-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload
668 ; X86-NEXT: setne %al
669 ; X86-NEXT: testb %cl, %al
670 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
671 ; X86-NEXT: leal -1(%eax), %ebp
672 ; X86-NEXT: cmovel %eax, %ebp
673 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
674 ; X86-NEXT: testl %edx, %edx
676 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
677 ; X86-NEXT: testl %ecx, %ecx
679 ; X86-NEXT: xorb %al, %bl
680 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
681 ; X86-NEXT: leal -1(%edi), %esi
682 ; X86-NEXT: pushl %ecx
683 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
684 ; X86-NEXT: pushl %edx
685 ; X86-NEXT: pushl {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
686 ; X86-NEXT: calll __moddi3
687 ; X86-NEXT: addl $16, %esp
688 ; X86-NEXT: orl %eax, %edx
689 ; X86-NEXT: setne %al
690 ; X86-NEXT: testb %bl, %al
691 ; X86-NEXT: cmovel %edi, %esi
692 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
693 ; X86-NEXT: movl %esi, 12(%eax)
694 ; X86-NEXT: movl %ebp, 8(%eax)
695 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
696 ; X86-NEXT: movl %ecx, 4(%eax)
697 ; X86-NEXT: movl (%esp), %ecx # 4-byte Reload
698 ; X86-NEXT: movl %ecx, (%eax)
699 ; X86-NEXT: addl $60, %esp
700 ; X86-NEXT: popl %esi
701 ; X86-NEXT: popl %edi
702 ; X86-NEXT: popl %ebx
703 ; X86-NEXT: popl %ebp
705 %tmp = call <4 x i32> @llvm.sdiv.fix.v4i32(<4 x i32> %x, <4 x i32> %y, i32 31)