Teach the code generator that shrd/shld is commutable if it has an immediate.
authorChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 07:11:01 +0000 (07:11 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 07:11:01 +0000 (07:11 +0000)
commit41e431ba045eb317ebf0ec45b563a5d96c212f5c
tree4269a38badc0912d3398aa99fb717578c4316df4
parentc71d6949b91e19610f0f85f57b402b4df43019a5
Teach the code generator that shrd/shld is commutable if it has an immediate.
This allows us to generate this:

foo:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        shld %EDX, %EDX, 2
        shl %EAX, 2
        ret

instead of this:

foo:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        mov %EDX, %EAX
        shrd %EDX, %ECX, 30
        shl %EAX, 2
        ret

Note the magically transmogrifying immediate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19686 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.h
lib/Target/X86/X86InstrInfo.td