diff options
Diffstat (limited to 'llvm/test/CodeGen/X86/funnel-shift.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/funnel-shift.ll | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/llvm/test/CodeGen/X86/funnel-shift.ll b/llvm/test/CodeGen/X86/funnel-shift.ll index 65b6709db5f..0969d6d190c 100644 --- a/llvm/test/CodeGen/X86/funnel-shift.ll +++ b/llvm/test/CodeGen/X86/funnel-shift.ll @@ -14,31 +14,23 @@ declare i32 @llvm.fshr.i32(i32, i32, i32) declare i64 @llvm.fshr.i64(i64, i64, i64) declare <4 x i32> @llvm.fshr.v4i32(<4 x i32>, <4 x i32>, <4 x i32>) -; General case - all operands can be variables - x86 has shld, but the mask and cmov are not needed? +; General case - all operands can be variables define i32 @fshl_i32(i32 %x, i32 %y, i32 %z) nounwind { ; X32-SSE2-LABEL: fshl_i32: ; X32-SSE2: # %bb.0: -; X32-SSE2-NEXT: pushl %esi +; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl ; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %esi -; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-SSE2-NEXT: andl $31, %ecx -; X32-SSE2-NEXT: movl %esi, %eax +; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax ; X32-SSE2-NEXT: shldl %cl, %edx, %eax -; X32-SSE2-NEXT: testl %ecx, %ecx -; X32-SSE2-NEXT: cmovel %esi, %eax -; X32-SSE2-NEXT: popl %esi ; X32-SSE2-NEXT: retl ; ; X64-AVX2-LABEL: fshl_i32: ; X64-AVX2: # %bb.0: ; X64-AVX2-NEXT: movl %edx, %ecx -; X64-AVX2-NEXT: andl $31, %ecx ; X64-AVX2-NEXT: movl %edi, %eax +; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx ; X64-AVX2-NEXT: shldl %cl, %esi, %eax -; X64-AVX2-NEXT: testl %ecx, %ecx -; X64-AVX2-NEXT: cmovel %edi, %eax ; X64-AVX2-NEXT: retq %f = call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 %z) ret i32 %f @@ -212,31 +204,23 @@ define i8 @fshl_i8_const_fold() nounwind { ; Repeat everything for funnel shift right. -; General case - all operands can be variables - x86 has 'shrd', but the mask and cmov are not needed? +; General case - all operands can be variables define i32 @fshr_i32(i32 %x, i32 %y, i32 %z) nounwind { ; X32-SSE2-LABEL: fshr_i32: ; X32-SSE2: # %bb.0: -; X32-SSE2-NEXT: pushl %esi +; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl ; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %esi -; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-SSE2-NEXT: andl $31, %ecx -; X32-SSE2-NEXT: movl %esi, %eax +; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax ; X32-SSE2-NEXT: shrdl %cl, %edx, %eax -; X32-SSE2-NEXT: testl %ecx, %ecx -; X32-SSE2-NEXT: cmovel %esi, %eax -; X32-SSE2-NEXT: popl %esi ; X32-SSE2-NEXT: retl ; ; X64-AVX2-LABEL: fshr_i32: ; X64-AVX2: # %bb.0: ; X64-AVX2-NEXT: movl %edx, %ecx -; X64-AVX2-NEXT: andl $31, %ecx ; X64-AVX2-NEXT: movl %esi, %eax +; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx ; X64-AVX2-NEXT: shrdl %cl, %edi, %eax -; X64-AVX2-NEXT: testl %ecx, %ecx -; X64-AVX2-NEXT: cmovel %esi, %eax ; X64-AVX2-NEXT: retq %f = call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 %z) ret i32 %f @@ -341,7 +325,7 @@ define i32 @fshr_i32_const_shift(i32 %x, i32 %y) nounwind { ; X32-SSE2: # %bb.0: ; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx ; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X32-SSE2-NEXT: shldl $23, %ecx, %eax +; X32-SSE2-NEXT: shrdl $9, %ecx, %eax ; X32-SSE2-NEXT: retl ; ; X64-AVX2-LABEL: fshr_i32_const_shift: @@ -353,14 +337,14 @@ define i32 @fshr_i32_const_shift(i32 %x, i32 %y) nounwind { ret i32 %f } -; Check modulo math on shift amount. 41-32=9, but right-shift became left, so 32-9=23. +; Check modulo math on shift amount. 41-32=9, but right-shift may became left, so 32-9=23. define i32 @fshr_i32_const_overshift(i32 %x, i32 %y) nounwind { ; X32-SSE2-LABEL: fshr_i32_const_overshift: ; X32-SSE2: # %bb.0: ; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx ; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X32-SSE2-NEXT: shldl $23, %ecx, %eax +; X32-SSE2-NEXT: shrdl $9, %ecx, %eax ; X32-SSE2-NEXT: retl ; ; X64-AVX2-LABEL: fshr_i32_const_overshift: |