[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrSSE.td
Evan Cheng
evan.cheng at apple.com
Tue May 30 13:27:03 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86InstrInfo.cpp updated: 1.52 -> 1.53
X86InstrSSE.td updated: 1.117 -> 1.118
---
Log message:
Allow shufps x, x, mask to be converted to pshufd x, mask to save a move.
---
Diffs of the changes: (+13 -1)
X86InstrInfo.cpp | 13 ++++++++++++-
X86InstrSSE.td | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.52 llvm/lib/Target/X86/X86InstrInfo.cpp:1.53
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.52 Fri May 19 13:43:41 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cpp Tue May 30 15:26:50 2006
@@ -102,7 +102,6 @@
}
-
/// 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 @@
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. :(
Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.117 llvm/lib/Target/X86/X86InstrSSE.td:1.118
--- llvm/lib/Target/X86/X86InstrSSE.td:1.117 Tue May 16 02:21:53 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td Tue May 30 15:26:50 2006
@@ -1218,6 +1218,7 @@
// 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}",
More information about the llvm-commits
mailing list