OSDN Git Service

Codegen long >> 2 to this:
authorChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 06:18:43 +0000 (06:18 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 06:18:43 +0000 (06:18 +0000)
commit8571637ee9f94d042b09b368c94725f3bf8a5133
tree8dd6ee329bed377cb0cc7cd8cd52df264076c1f8
parent8e1971bda288ec7944499330dc32a2f43c21bd08
Codegen long >> 2 to this:

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

instead of this:

test1:
        mov %ECX, DWORD PTR [%ESP + 4]
        shr %ECX, 2
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %EAX, %EDX
        shl %EAX, 30
        or %EAX, %ECX
        sar %EDX, 2
        ret

and long << 2 to 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

instead of this:

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

The extra copy (marked ***) can be eliminated when I teach the code generator
that shrd32rri8 is really commutative.

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