[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrSSE.td
Evan Cheng
evan.cheng at apple.com
Tue May 30 16:34:43 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86InstrInfo.cpp updated: 1.56 -> 1.57
X86InstrSSE.td updated: 1.118 -> 1.119
---
Log message:
Commute shufps / shufpd.
---
Diffs of the changes: (+20 -1)
X86InstrInfo.cpp | 18 ++++++++++++++++++
X86InstrSSE.td | 3 ++-
2 files changed, 20 insertions(+), 1 deletion(-)
Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.56 llvm/lib/Target/X86/X86InstrInfo.cpp:1.57
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.56 Tue May 30 17:13:36 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cpp Tue May 30 18:34:30 2006
@@ -207,6 +207,24 @@
///
MachineInstr *X86InstrInfo::commuteInstruction(MachineInstr *MI) const {
switch (MI->getOpcode()) {
+ case X86::SHUFPSrri: { // A = SHUFPSrri B,C, M -> A = SHUFPSrri C,B, rotl(M,4)
+ unsigned A = MI->getOperand(0).getReg();
+ unsigned B = MI->getOperand(1).getReg();
+ unsigned C = MI->getOperand(2).getReg();
+ unsigned M = MI->getOperand(3).getImmedValue();
+ if (B == C) return 0;
+ return BuildMI(X86::SHUFPSrri, 3, A).addReg(C).addReg(B).
+ addImm(((M & 0xF) << 4) | ((M & 0xF0) >> 4));
+ }
+ case X86::SHUFPDrri: { // A = SHUFPDrri B,C, M -> A = SHUFPDrri C,B, rotl(M,1)
+ unsigned A = MI->getOperand(0).getReg();
+ unsigned B = MI->getOperand(1).getReg();
+ unsigned C = MI->getOperand(2).getReg();
+ unsigned M = MI->getOperand(3).getImmedValue();
+ if (B == C) return 0;
+ return BuildMI(X86::SHUFPDrri, 3, A).addReg(C).addReg(B).
+ addImm(((M & 0x1) << 1) | ((M & 0x2) >> 1));
+ }
case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I -> A = SHLD16rri8 C, B, (16-I)
case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I -> A = SHRD16rri8 C, B, (16-I)
case X86::SHRD32rri8: // A = SHRD32rri8 B, C, I -> A = SHLD32rri8 C, B, (32-I)
Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.118 llvm/lib/Target/X86/X86InstrSSE.td:1.119
--- llvm/lib/Target/X86/X86InstrSSE.td:1.118 Tue May 30 15:26:50 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td Tue May 30 18:34:30 2006
@@ -1218,7 +1218,7 @@
// Shuffle and unpack instructions
let isTwoAddress = 1 in {
-let isConvertibleToThreeAddress = 1 in // Convert to pshufd
+let isCommutable = 1, 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}",
@@ -1231,6 +1231,7 @@
[(set VR128:$dst, (v4f32 (vector_shuffle
VR128:$src1, (load addr:$src2),
SHUFP_shuffle_mask:$src3)))]>;
+let isCommutable = 1 in
def SHUFPDrri : PDIi8<0xC6, MRMSrcReg,
(ops VR128:$dst, VR128:$src1, VR128:$src2, i8imm:$src3),
"shufpd {$src3, $src2, $dst|$dst, $src2, $src3}",
More information about the llvm-commits
mailing list