diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-02-09 20:34:59 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-02-09 20:34:59 +0000 |
| commit | 6bf7b30b10f5c75c26617d183ade28558b4e3ffc (patch) | |
| tree | f5234f0b698ade4d313a13163fedd26bc0646da2 /llvm/test/CodeGen/X86 | |
| parent | 586ad01fb68c793a766f10257fe2b2ddc2fba5dd (diff) | |
| download | bcm5719-llvm-6bf7b30b10f5c75c26617d183ade28558b4e3ffc.tar.gz bcm5719-llvm-6bf7b30b10f5c75c26617d183ade28558b4e3ffc.zip | |
[X86] CombineOr - fold to generic funnel shifts
As discussed on D57389, this is a first step towards moving the SHLD/SHRD matching code to DAGCombiner using FSHL/FSHR instead.
There's a bit of work to do before I can do that, so this just folds to FSHL/FSHR in the existing code (handling the different SHRD/FSHR argument ordering), which fixes the issue we had with i16 shift amounts not being correctly masked.
llvm-svn: 353626
Diffstat (limited to 'llvm/test/CodeGen/X86')
| -rw-r--r-- | llvm/test/CodeGen/X86/rot16.ll | 8 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/shift-double.ll | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/X86/rot16.ll b/llvm/test/CodeGen/X86/rot16.ll index 69ea7013cc7..b0221c48532 100644 --- a/llvm/test/CodeGen/X86/rot16.ll +++ b/llvm/test/CodeGen/X86/rot16.ll @@ -28,9 +28,10 @@ define i16 @foo(i16 %x, i16 %y, i16 %z) nounwind { define i16 @bar(i16 %x, i16 %y, i16 %z) nounwind { ; X32-LABEL: bar: ; X32: # %bb.0: -; X32-NEXT: movb {{[0-9]+}}(%esp), %cl ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movb {{[0-9]+}}(%esp), %cl +; X32-NEXT: andb $15, %cl ; X32-NEXT: shldw %cl, %dx, %ax ; X32-NEXT: retl ; @@ -38,6 +39,7 @@ define i16 @bar(i16 %x, i16 %y, i16 %z) nounwind { ; X64: # %bb.0: ; X64-NEXT: movl %edx, %ecx ; X64-NEXT: movl %esi, %eax +; X64-NEXT: andb $15, %cl ; X64-NEXT: # kill: def $cl killed $cl killed $ecx ; X64-NEXT: shldw %cl, %di, %ax ; X64-NEXT: # kill: def $ax killed $ax killed $eax @@ -75,9 +77,10 @@ define i16 @un(i16 %x, i16 %y, i16 %z) nounwind { define i16 @bu(i16 %x, i16 %y, i16 %z) nounwind { ; X32-LABEL: bu: ; X32: # %bb.0: -; X32-NEXT: movb {{[0-9]+}}(%esp), %cl ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movb {{[0-9]+}}(%esp), %cl +; X32-NEXT: andb $15, %cl ; X32-NEXT: shrdw %cl, %dx, %ax ; X32-NEXT: retl ; @@ -85,6 +88,7 @@ define i16 @bu(i16 %x, i16 %y, i16 %z) nounwind { ; X64: # %bb.0: ; X64-NEXT: movl %edx, %ecx ; X64-NEXT: movl %esi, %eax +; X64-NEXT: andb $15, %cl ; X64-NEXT: # kill: def $cl killed $cl killed $ecx ; X64-NEXT: shrdw %cl, %di, %ax ; X64-NEXT: # kill: def $ax killed $ax killed $eax diff --git a/llvm/test/CodeGen/X86/shift-double.ll b/llvm/test/CodeGen/X86/shift-double.ll index fd555c4aaac..5e8efa7b9f0 100644 --- a/llvm/test/CodeGen/X86/shift-double.ll +++ b/llvm/test/CodeGen/X86/shift-double.ll @@ -128,9 +128,10 @@ define i32 @test4(i32 %A, i32 %B, i8 %C) nounwind { define i16 @test5(i16 %A, i16 %B, i8 %C) nounwind { ; X86-LABEL: test5: ; X86: # %bb.0: -; X86-NEXT: movb {{[0-9]+}}(%esp), %cl ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movb {{[0-9]+}}(%esp), %cl +; X86-NEXT: andb $15, %cl ; X86-NEXT: shldw %cl, %dx, %ax ; X86-NEXT: retl ; @@ -138,6 +139,7 @@ define i16 @test5(i16 %A, i16 %B, i8 %C) nounwind { ; X64: # %bb.0: ; X64-NEXT: movl %edx, %ecx ; X64-NEXT: movl %edi, %eax +; X64-NEXT: andb $15, %cl ; X64-NEXT: # kill: def $cl killed $cl killed $ecx ; X64-NEXT: shldw %cl, %si, %ax ; X64-NEXT: # kill: def $ax killed $ax killed $eax @@ -181,9 +183,10 @@ define i32 @test6(i32 %A, i32 %B, i8 %C) nounwind { define i16 @test7(i16 %A, i16 %B, i8 %C) nounwind { ; X86-LABEL: test7: ; X86: # %bb.0: -; X86-NEXT: movb {{[0-9]+}}(%esp), %cl ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movb {{[0-9]+}}(%esp), %cl +; X86-NEXT: andb $15, %cl ; X86-NEXT: shrdw %cl, %dx, %ax ; X86-NEXT: retl ; @@ -191,6 +194,7 @@ define i16 @test7(i16 %A, i16 %B, i8 %C) nounwind { ; X64: # %bb.0: ; X64-NEXT: movl %edx, %ecx ; X64-NEXT: movl %edi, %eax +; X64-NEXT: andb $15, %cl ; X64-NEXT: # kill: def $cl killed $cl killed $ecx ; X64-NEXT: shrdw %cl, %si, %ax ; X64-NEXT: # kill: def $ax killed $ax killed $eax |

