mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[X86] Fix the pattern changes from r356121 so that the ROR*r1/ROR*m1 pattern use the rotr opcode.
These instructions used to use rotl with a bitwidth-1 immediate. I changed the immediate to 1, but failed to change the opcode. Thankfully this seems to have not caused a functional issue because we now had two rotl by 1 patterns, but the correct ones were earlier and took priority. So we just missed some optimization. llvm-svn: 356164
This commit is contained in:
parent
b0792379ed
commit
29ffc6485f
@ -585,16 +585,16 @@ 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, (rotl GR8:$src1, (i8 1)))]>;
|
||||
[(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
|
||||
def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
|
||||
"ror{w}\t$dst",
|
||||
[(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize16;
|
||||
[(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize16;
|
||||
def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
|
||||
"ror{l}\t$dst",
|
||||
[(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>, OpSize32;
|
||||
[(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>, OpSize32;
|
||||
def ROR64r1 : RI<0xD1, MRM1r, (outs GR64:$dst), (ins GR64:$src1),
|
||||
"ror{q}\t$dst",
|
||||
[(set GR64:$dst, (rotl GR64:$src1, (i8 1)))]>;
|
||||
[(set GR64:$dst, (rotr GR64:$src1, (i8 1)))]>;
|
||||
} // Constraints = "$src = $dst", SchedRW
|
||||
|
||||
let Uses = [CL], SchedRW = [WriteRotateCLLd, WriteRMW] in {
|
||||
@ -633,18 +633,18 @@ def ROR64mi : RIi8<0xC1, MRM1m, (outs), (ins i64mem:$dst, u8imm:$src),
|
||||
// Rotate by 1
|
||||
def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
|
||||
"ror{b}\t$dst",
|
||||
[(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
|
||||
[(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
|
||||
def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
|
||||
"ror{w}\t$dst",
|
||||
[(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
|
||||
[(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
|
||||
OpSize16;
|
||||
def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
|
||||
"ror{l}\t$dst",
|
||||
[(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>,
|
||||
[(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>,
|
||||
OpSize32;
|
||||
def ROR64m1 : RI<0xD1, MRM1m, (outs), (ins i64mem:$dst),
|
||||
"ror{q}\t$dst",
|
||||
[(store (rotl (loadi64 addr:$dst), (i8 1)), addr:$dst)]>,
|
||||
[(store (rotr (loadi64 addr:$dst), (i8 1)), addr:$dst)]>,
|
||||
Requires<[In64BitMode]>;
|
||||
} // SchedRW
|
||||
|
||||
|
@ -205,13 +205,13 @@ define i8 @rotr_i8_const_shift1(i8 %x) nounwind {
|
||||
; X32-SSE2-LABEL: rotr_i8_const_shift1:
|
||||
; X32-SSE2: # %bb.0:
|
||||
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %al
|
||||
; X32-SSE2-NEXT: rorb $1, %al
|
||||
; X32-SSE2-NEXT: rorb %al
|
||||
; X32-SSE2-NEXT: retl
|
||||
;
|
||||
; X64-AVX2-LABEL: rotr_i8_const_shift1:
|
||||
; X64-AVX2: # %bb.0:
|
||||
; X64-AVX2-NEXT: movl %edi, %eax
|
||||
; X64-AVX2-NEXT: rorb $1, %al
|
||||
; X64-AVX2-NEXT: rorb %al
|
||||
; X64-AVX2-NEXT: # kill: def $al killed $al killed $eax
|
||||
; X64-AVX2-NEXT: retq
|
||||
%f = call i8 @llvm.fshr.i8(i8 %x, i8 %x, i8 1)
|
||||
|
@ -514,7 +514,7 @@ define i32 @fshr1(i32 %x) nounwind {
|
||||
; X86-LABEL: fshr1:
|
||||
; X86: # %bb.0:
|
||||
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X86-NEXT: rorl $1, %eax
|
||||
; X86-NEXT: rorl %eax
|
||||
; X86-NEXT: retl
|
||||
;
|
||||
; SHLD-LABEL: fshr1:
|
||||
@ -531,7 +531,7 @@ define i32 @fshr1(i32 %x) nounwind {
|
||||
; X64-LABEL: fshr1:
|
||||
; X64: # %bb.0:
|
||||
; X64-NEXT: movl %edi, %eax
|
||||
; X64-NEXT: rorl $1, %eax
|
||||
; X64-NEXT: rorl %eax
|
||||
; X64-NEXT: retq
|
||||
;
|
||||
; SHLD64-LABEL: fshr1:
|
||||
|
@ -303,7 +303,7 @@ define i64 @fshr1(i64 %x) nounwind {
|
||||
; X64-LABEL: fshr1:
|
||||
; X64: # %bb.0:
|
||||
; X64-NEXT: movq %rdi, %rax
|
||||
; X64-NEXT: rorq $1, %rax
|
||||
; X64-NEXT: rorq %rax
|
||||
; X64-NEXT: retq
|
||||
;
|
||||
; SHLD-LABEL: fshr1:
|
||||
|
Loading…
x
Reference in New Issue
Block a user