Skip to content

Commit 2c1f9f3

Browse files
committed
[NFC][X86] Precommit another testcase for D101944
1 parent dfc1e31 commit 2c1f9f3

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

llvm/test/CodeGen/X86/64-bit-shift-by-32-minus-y.ll

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,78 @@ define i64 @t5_cse(i64 %val, i64 %shamt, i64*%dst) nounwind {
365365
%shifted = shl i64 %val, %negshamt
366366
ret i64 %shifted
367367
}
368+
369+
define i64 @t6_cse2(i64 %val, i64 %shamt, i64*%dst) nounwind {
370+
; X64-NOBMI2-LABEL: t6_cse2:
371+
; X64-NOBMI2: # %bb.0:
372+
; X64-NOBMI2-NEXT: movq %rdi, %rax
373+
; X64-NOBMI2-NEXT: movl $32, %ecx
374+
; X64-NOBMI2-NEXT: subq %rsi, %rcx
375+
; X64-NOBMI2-NEXT: movq %rcx, (%rdx)
376+
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
377+
; X64-NOBMI2-NEXT: shlq %cl, %rax
378+
; X64-NOBMI2-NEXT: retq
379+
;
380+
; X64-BMI2-LABEL: t6_cse2:
381+
; X64-BMI2: # %bb.0:
382+
; X64-BMI2-NEXT: movl $32, %eax
383+
; X64-BMI2-NEXT: subq %rsi, %rax
384+
; X64-BMI2-NEXT: movq %rax, (%rdx)
385+
; X64-BMI2-NEXT: shlxq %rax, %rdi, %rax
386+
; X64-BMI2-NEXT: retq
387+
;
388+
; X32-NOBMI2-LABEL: t6_cse2:
389+
; X32-NOBMI2: # %bb.0:
390+
; X32-NOBMI2-NEXT: pushl %edi
391+
; X32-NOBMI2-NEXT: pushl %esi
392+
; X32-NOBMI2-NEXT: movl {{[0-9]+}}(%esp), %esi
393+
; X32-NOBMI2-NEXT: movl {{[0-9]+}}(%esp), %edx
394+
; X32-NOBMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
395+
; X32-NOBMI2-NEXT: xorl %edi, %edi
396+
; X32-NOBMI2-NEXT: movl $32, %ecx
397+
; X32-NOBMI2-NEXT: subl {{[0-9]+}}(%esp), %ecx
398+
; X32-NOBMI2-NEXT: sbbl {{[0-9]+}}(%esp), %edi
399+
; X32-NOBMI2-NEXT: movl %ecx, (%eax)
400+
; X32-NOBMI2-NEXT: movl %edi, 4(%eax)
401+
; X32-NOBMI2-NEXT: movl %esi, %eax
402+
; X32-NOBMI2-NEXT: shll %cl, %eax
403+
; X32-NOBMI2-NEXT: shldl %cl, %esi, %edx
404+
; X32-NOBMI2-NEXT: testb $32, %cl
405+
; X32-NOBMI2-NEXT: je .LBB6_2
406+
; X32-NOBMI2-NEXT: # %bb.1:
407+
; X32-NOBMI2-NEXT: movl %eax, %edx
408+
; X32-NOBMI2-NEXT: xorl %eax, %eax
409+
; X32-NOBMI2-NEXT: .LBB6_2:
410+
; X32-NOBMI2-NEXT: popl %esi
411+
; X32-NOBMI2-NEXT: popl %edi
412+
; X32-NOBMI2-NEXT: retl
413+
;
414+
; X32-BMI2-LABEL: t6_cse2:
415+
; X32-BMI2: # %bb.0:
416+
; X32-BMI2-NEXT: pushl %edi
417+
; X32-BMI2-NEXT: pushl %esi
418+
; X32-BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
419+
; X32-BMI2-NEXT: movl {{[0-9]+}}(%esp), %edx
420+
; X32-BMI2-NEXT: movl {{[0-9]+}}(%esp), %esi
421+
; X32-BMI2-NEXT: xorl %edi, %edi
422+
; X32-BMI2-NEXT: movl $32, %ecx
423+
; X32-BMI2-NEXT: subl {{[0-9]+}}(%esp), %ecx
424+
; X32-BMI2-NEXT: sbbl {{[0-9]+}}(%esp), %edi
425+
; X32-BMI2-NEXT: movl %ecx, (%esi)
426+
; X32-BMI2-NEXT: movl %edi, 4(%esi)
427+
; X32-BMI2-NEXT: shldl %cl, %eax, %edx
428+
; X32-BMI2-NEXT: shlxl %ecx, %eax, %eax
429+
; X32-BMI2-NEXT: testb $32, %cl
430+
; X32-BMI2-NEXT: je .LBB6_2
431+
; X32-BMI2-NEXT: # %bb.1:
432+
; X32-BMI2-NEXT: movl %eax, %edx
433+
; X32-BMI2-NEXT: xorl %eax, %eax
434+
; X32-BMI2-NEXT: .LBB6_2:
435+
; X32-BMI2-NEXT: popl %esi
436+
; X32-BMI2-NEXT: popl %edi
437+
; X32-BMI2-NEXT: retl
438+
%negshamt = sub i64 32, %shamt
439+
store i64 %negshamt, i64* %dst
440+
%shifted = shl i64 %val, %negshamt
441+
ret i64 %shifted
442+
}

0 commit comments

Comments
 (0)