diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-05-30 20:26:50 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-05-30 20:26:50 +0000 |
commit | ccba76bb254e653646b01cf5b8304b14092d372b (patch) | |
tree | d4cdae6e597b45a503583ac3cdeb121152d18397 /lib/Target/X86 | |
parent | eaf1e3177518d2eaaf636b0e4ace8c60c794c72c (diff) | |
download | external_llvm-ccba76bb254e653646b01cf5b8304b14092d372b.zip external_llvm-ccba76bb254e653646b01cf5b8304b14092d372b.tar.gz external_llvm-ccba76bb254e653646b01cf5b8304b14092d372b.tar.bz2 |
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
Diffstat (limited to 'lib/Target/X86')
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 13 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrSSE.td | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index e397163..3c84ef5 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -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. :( diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index e777f30..ca6ed88 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -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}", |