Fix PR1427 and test/CodeGen/X86/mmx-shuffle.ll

llvm-svn: 37141
This commit is contained in:
Chris Lattner 2007-05-17 03:29:42 +00:00
parent 5de4944f70
commit 6a5a46322f
1 changed files with 10 additions and 1 deletions

View File

@ -1614,6 +1614,13 @@ bool X86::isPSHUFLWMask(SDNode *N) {
static bool isSHUFPMask(const SDOperand *Elems, unsigned NumElems) { static bool isSHUFPMask(const SDOperand *Elems, unsigned NumElems) {
if (NumElems != 2 && NumElems != 4) return false; if (NumElems != 2 && NumElems != 4) return false;
// Ensure this is not an mmx shuffle.
if (NumElems == 4 && Elems[0].getValueType() == MVT::i16)
return false;
if (NumElems == 2 && Elems[0].getValueType() == MVT::i32)
return false;
unsigned Half = NumElems / 2; unsigned Half = NumElems / 2;
for (unsigned i = 0; i < Half; ++i) for (unsigned i = 0; i < Half; ++i)
if (!isUndefOrInRange(Elems[i], 0, NumElems)) if (!isUndefOrInRange(Elems[i], 0, NumElems))
@ -2712,7 +2719,9 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDOperand Op, SelectionDAG &DAG) {
} }
} }
if (NumElems == 4) { if (NumElems == 4 &&
// Don't do this for MMX.
MVT::getSizeInBits(VT) != 64) {
MVT::ValueType MaskVT = PermMask.getValueType(); MVT::ValueType MaskVT = PermMask.getValueType();
MVT::ValueType MaskEVT = MVT::getVectorBaseType(MaskVT); MVT::ValueType MaskEVT = MVT::getVectorBaseType(MaskVT);
SmallVector<std::pair<int, int>, 8> Locs; SmallVector<std::pair<int, int>, 8> Locs;