mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-04 01:42:09 +00:00
Allow shufps x, x, mask to be converted to pshufd x, mask to save a move.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eaf1e31775
commit
ccba76bb25
@ -102,7 +102,6 @@ unsigned X86InstrInfo::isStoreToStackSlot(MachineInstr *MI,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// convertToThreeAddress - This method must be implemented by targets that
|
||||
/// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target
|
||||
/// may be able to convert a two-address instruction into a true
|
||||
@ -118,6 +117,18 @@ MachineInstr *X86InstrInfo::convertToThreeAddress(MachineInstr *MI) const {
|
||||
unsigned Dest = MI->getOperand(0).getReg();
|
||||
unsigned Src = MI->getOperand(1).getReg();
|
||||
|
||||
switch (MI->getOpcode()) {
|
||||
default: break;
|
||||
case X86::SHUFPSrri: {
|
||||
assert(MI->getNumOperands() == 4 && "Unknown shufps instruction!");
|
||||
unsigned A = MI->getOperand(0).getReg();
|
||||
unsigned B = MI->getOperand(1).getReg();
|
||||
unsigned C = MI->getOperand(2).getReg();
|
||||
unsigned M = MI->getOperand(3).getImmedValue();
|
||||
return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: None of these instructions are promotable to LEAs without
|
||||
// additional information. In particular, LEA doesn't set the flags that
|
||||
// add and inc do. :(
|
||||
|
@ -1218,6 +1218,7 @@ def CMPPDrmi : PDIi8<0xC2, MRMSrcMem,
|
||||
|
||||
// Shuffle and unpack instructions
|
||||
let isTwoAddress = 1 in {
|
||||
let isConvertibleToThreeAddress = 1 in // Convert to pshufd
|
||||
def SHUFPSrri : PSIi8<0xC6, MRMSrcReg,
|
||||
(ops VR128:$dst, VR128:$src1, VR128:$src2, i32i8imm:$src3),
|
||||
"shufps {$src3, $src2, $dst|$dst, $src2, $src3}",
|
||||
|
Loading…
Reference in New Issue
Block a user