OSDN Git Service

Implement Regression/CodeGen/X86/rotate.ll: emit rotate instructions (which
authorChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 08:07:05 +0000 (08:07 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 08:07:05 +0000 (08:07 +0000)
commit4053b1e30bee6bbce26b42003527cdc835de8194
treed4a1adbf160db6f5a57730c13f6f58f185a0aa70
parentb51f2e3de25b8c543961e1cb7891964b916d1f4e
Implement Regression/CodeGen/X86/rotate.ll: emit rotate instructions (which
typically cost 1 cycle) instead of shld/shrd instruction (which are typically
6 or more cycles).  This also saves code space.

For example, instead of emitting:

rotr:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %CL, BYTE PTR [%ESP + 8]
        shrd %EAX, %EAX, %CL
        ret
rotli:
        mov %EAX, DWORD PTR [%ESP + 4]
        shrd %EAX, %EAX, 27
        ret

Emit:

rotr32:
        mov %CL, BYTE PTR [%ESP + 8]
        mov %EAX, DWORD PTR [%ESP + 4]
        ror %EAX, %CL
        ret
rotli32:
        mov %EAX, DWORD PTR [%ESP + 4]
        ror %EAX, 27
        ret

We also emit byte rotate instructions which do not have a sh[lr]d counterpart
at all.

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