mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-07 12:30:44 +00:00
[X86] Prefer rotate by 1 over rotate by imm
Summary: Rotate by 1 is translated to 1 micro-op, while rotate with imm8 is translated to 2 micro-ops. Fixes pr30644. Reviewers: delena, igorb, craig.topper, spatel, RKSimon Differential Revision: https://reviews.llvm.org/D25399 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283758 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5ba17d7d92
commit
bca70faf12
@ -609,19 +609,19 @@ def ROR64ri : RIi8<0xC1, MRM1r, (outs GR64:$dst),
|
||||
// Rotate by 1
|
||||
def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
|
||||
"ror{b}\t$dst",
|
||||
[(set GR8:$dst, (rotr GR8:$src1, (i8 1)))],
|
||||
[(set GR8:$dst, (rotl GR8:$src1, (i8 7)))],
|
||||
IIC_SR>;
|
||||
def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
|
||||
"ror{w}\t$dst",
|
||||
[(set GR16:$dst, (rotr GR16:$src1, (i8 1)))],
|
||||
[(set GR16:$dst, (rotl GR16:$src1, (i8 15)))],
|
||||
IIC_SR>, OpSize16;
|
||||
def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
|
||||
"ror{l}\t$dst",
|
||||
[(set GR32:$dst, (rotr GR32:$src1, (i8 1)))],
|
||||
[(set GR32:$dst, (rotl GR32:$src1, (i8 31)))],
|
||||
IIC_SR>, OpSize32;
|
||||
def ROR64r1 : RI<0xD1, MRM1r, (outs GR64:$dst), (ins GR64:$src1),
|
||||
"ror{q}\t$dst",
|
||||
[(set GR64:$dst, (rotr GR64:$src1, (i8 1)))],
|
||||
[(set GR64:$dst, (rotl GR64:$src1, (i8 63)))],
|
||||
IIC_SR>;
|
||||
} // Constraints = "$src = $dst", SchedRW
|
||||
|
||||
|
@ -183,7 +183,7 @@ define i64 @rotr1_64(i64 %A) nounwind {
|
||||
;
|
||||
; 64-LABEL: rotr1_64:
|
||||
; 64: # BB#0:
|
||||
; 64-NEXT: rolq $63, %rdi
|
||||
; 64-NEXT: rorq %rdi
|
||||
; 64-NEXT: movq %rdi, %rax
|
||||
; 64-NEXT: retq
|
||||
%B = shl i64 %A, 63
|
||||
@ -296,12 +296,12 @@ define i32 @rotr1_32(i32 %A) nounwind {
|
||||
; 32-LABEL: rotr1_32:
|
||||
; 32: # BB#0:
|
||||
; 32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; 32-NEXT: roll $31, %eax
|
||||
; 32-NEXT: rorl %eax
|
||||
; 32-NEXT: retl
|
||||
;
|
||||
; 64-LABEL: rotr1_32:
|
||||
; 64: # BB#0:
|
||||
; 64-NEXT: roll $31, %edi
|
||||
; 64-NEXT: rorl %edi
|
||||
; 64-NEXT: movl %edi, %eax
|
||||
; 64-NEXT: retq
|
||||
%B = shl i32 %A, 31
|
||||
@ -414,12 +414,12 @@ define i16 @rotr1_16(i16 %A) nounwind {
|
||||
; 32-LABEL: rotr1_16:
|
||||
; 32: # BB#0:
|
||||
; 32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
||||
; 32-NEXT: rolw $15, %ax
|
||||
; 32-NEXT: rorw %ax
|
||||
; 32-NEXT: retl
|
||||
;
|
||||
; 64-LABEL: rotr1_16:
|
||||
; 64: # BB#0:
|
||||
; 64-NEXT: rolw $15, %di
|
||||
; 64-NEXT: rorw %di
|
||||
; 64-NEXT: movl %edi, %eax
|
||||
; 64-NEXT: retq
|
||||
%B = lshr i16 %A, 1
|
||||
@ -528,12 +528,12 @@ define i8 @rotr1_8(i8 %A) nounwind {
|
||||
; 32-LABEL: rotr1_8:
|
||||
; 32: # BB#0:
|
||||
; 32-NEXT: movb {{[0-9]+}}(%esp), %al
|
||||
; 32-NEXT: rolb $7, %al
|
||||
; 32-NEXT: rorb %al
|
||||
; 32-NEXT: retl
|
||||
;
|
||||
; 64-LABEL: rotr1_8:
|
||||
; 64: # BB#0:
|
||||
; 64-NEXT: rolb $7, %dil
|
||||
; 64-NEXT: rorb %dil
|
||||
; 64-NEXT: movl %edi, %eax
|
||||
; 64-NEXT: retq
|
||||
%B = lshr i8 %A, 1
|
||||
|
Loading…
Reference in New Issue
Block a user