[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrSSE.td
Evan Cheng
evan.cheng at apple.com
Mon Apr 10 17:19:17 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86ISelLowering.cpp updated: 1.161 -> 1.162
X86ISelLowering.h updated: 1.53 -> 1.54
X86InstrSSE.td updated: 1.72 -> 1.73
---
Log message:
Added support for _mm_move_ss and _mm_move_sd.
---
Diffs of the changes: (+46 -2)
X86ISelLowering.cpp | 29 +++++++++++++++++++++++++++--
X86ISelLowering.h | 4 ++++
X86InstrSSE.td | 15 +++++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.161 llvm/lib/Target/X86/X86ISelLowering.cpp:1.162
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.161 Mon Apr 10 02:23:14 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Apr 10 19:19:04 2006
@@ -1684,6 +1684,26 @@
return true;
}
+/// isMOVSMask - Return true if the specified VECTOR_SHUFFLE operand
+/// specifies a shuffle of elements that is suitable for input to MOVS{S|D}.
+bool X86::isMOVSMask(SDNode *N) {
+ assert(N->getOpcode() == ISD::BUILD_VECTOR);
+
+ unsigned NumElems = N->getNumOperands();
+ if (NumElems != 2 && NumElems != 4)
+ return false;
+
+ if (!isUndefOrEqual(N->getOperand(0), NumElems))
+ return false;
+
+ for (unsigned i = 1; i < NumElems; ++i) {
+ SDOperand Arg = N->getOperand(i);
+ if (!isUndefOrEqual(Arg, i))
+ return false;
+ }
+
+ return true;
+}
/// isSplatMask - Return true if the specified VECTOR_SHUFFLE operand specifies
/// a splat of a single element.
@@ -2680,6 +2700,10 @@
if (NumElems == 2)
return Op;
+ if (X86::isMOVSMask(PermMask.Val))
+ // Leave the VECTOR_SHUFFLE alone. It matches MOVS{S|D}.
+ return Op;
+
if (X86::isUNPCKLMask(PermMask.Val) ||
X86::isUNPCKL_v_undef_Mask(PermMask.Val) ||
X86::isUNPCKHMask(PermMask.Val))
@@ -3106,10 +3130,11 @@
// Only do shuffles on 128-bit vector types for now.
if (MVT::getSizeInBits(VT) == 64) return false;
return (Mask.Val->getNumOperands() == 2 ||
- X86::isSplatMask(Mask.Val) ||
+ X86::isSplatMask(Mask.Val) ||
+ X86::isMOVSMask(Mask.Val) ||
X86::isPSHUFDMask(Mask.Val) ||
isPSHUFHW_PSHUFLWMask(Mask.Val) ||
- X86::isSHUFPMask(Mask.Val) ||
+ X86::isSHUFPMask(Mask.Val) ||
X86::isUNPCKLMask(Mask.Val) ||
X86::isUNPCKL_v_undef_Mask(Mask.Val) ||
X86::isUNPCKHMask(Mask.Val));
Index: llvm/lib/Target/X86/X86ISelLowering.h
diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.53 llvm/lib/Target/X86/X86ISelLowering.h:1.54
--- llvm/lib/Target/X86/X86ISelLowering.h:1.53 Thu Apr 6 18:23:56 2006
+++ llvm/lib/Target/X86/X86ISelLowering.h Mon Apr 10 19:19:04 2006
@@ -233,6 +233,10 @@
/// <0, 0, 1, 1>
bool isUNPCKL_v_undef_Mask(SDNode *N);
+ /// isMOVSMask - Return true if the specified VECTOR_SHUFFLE operand
+ /// specifies a shuffle of elements that is suitable for input to MOVS{S|D}.
+ bool isMOVSMask(SDNode *N);
+
/// isSplatMask - Return true if the specified VECTOR_SHUFFLE operand
/// specifies a splat of a single element.
bool isSplatMask(SDNode *N);
Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.72 llvm/lib/Target/X86/X86InstrSSE.td:1.73
--- llvm/lib/Target/X86/X86InstrSSE.td:1.72 Mon Apr 10 17:35:16 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td Mon Apr 10 19:19:04 2006
@@ -104,6 +104,10 @@
return X86::isMOVLPMask(N);
}]>;
+def MOVS_shuffle_mask : PatLeaf<(build_vector), [{
+ return X86::isMOVSMask(N);
+}]>;
+
def UNPCKL_shuffle_mask : PatLeaf<(build_vector), [{
return X86::isUNPCKLMask(N);
}]>;
@@ -1641,6 +1645,17 @@
"movsd {$src2, $dst|$dst, $src2}", []>;
def MOVLDI2PDIrr : PDI<0x6E, MRMSrcReg, (ops VR128:$dst, VR128:$src1, R32:$src2),
"movd {$src2, $dst|$dst, $src2}", []>;
+
+def MOVLPSrr : SSI<0x10, MRMSrcReg, (ops VR128:$dst, VR128:$src1, VR128:$src2),
+ "movss {$src2, $dst|$dst, $src2}",
+ [(set VR128:$dst,
+ (v4f32 (vector_shuffle VR128:$src1, VR128:$src2,
+ MOVS_shuffle_mask)))]>;
+def MOVLPDrr : SDI<0x10, MRMSrcReg, (ops VR128:$dst, VR128:$src1, VR128:$src2),
+ "movsd {$src2, $dst|$dst, $src2}",
+ [(set VR128:$dst,
+ (v2f64 (vector_shuffle VR128:$src1, VR128:$src2,
+ MOVS_shuffle_mask)))]>;
}
// Move to lower bits of a VR128 and zeroing upper bits.
More information about the llvm-commits
mailing list