diff --git a/llvm/include/llvm/Target/TargetLowering.h b/llvm/include/llvm/Target/TargetLowering.h index 5083e86046d1..0615531a21ba 100644 --- a/llvm/include/llvm/Target/TargetLowering.h +++ b/llvm/include/llvm/Target/TargetLowering.h @@ -202,7 +202,7 @@ public: /// support and the code generator is tasked with not creating illegal masks. bool isShuffleLegal(MVT::ValueType VT, SDOperand Mask) const { return isOperationLegal(ISD::VECTOR_SHUFFLE, VT) && - isShuffleMaskLegal(Mask); + isShuffleMaskLegal(Mask, VT); } /// getTypeToPromoteTo - If the action for this operation is to promote, this @@ -489,7 +489,7 @@ protected: /// support *some* VECTOR_SHUFFLE operations, those with specific masks. /// By default, if a target supports the VECTOR_SHUFFLE node, all mask values /// are assumed to be legal. - virtual bool isShuffleMaskLegal(SDOperand Mask) const { + virtual bool isShuffleMaskLegal(SDOperand Mask, MVT::ValueType VT) const { return true; } diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 73225b62d0da..ea3832f70c18 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -2371,7 +2371,10 @@ bool X86TargetLowering::isLegalAddressImmediate(GlobalValue *GV) const { /// support *some* VECTOR_SHUFFLE operations, those with specific masks. /// By default, if a target supports the VECTOR_SHUFFLE node, all mask values /// are assumed to be legal. -bool X86TargetLowering::isShuffleMaskLegal(SDOperand Mask) const { +bool +X86TargetLowering::isShuffleMaskLegal(SDOperand Mask, MVT::ValueType VT) const { + // Only do shuffles on 128-bit vector types for now. + if (MVT::getSizeInBits(VT) == 64) return false; return (X86::isSplatMask(Mask.Val) || (Subtarget->hasSSE2() && X86::isPSHUFDMask(Mask.Val))); } diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h index e9ff015b5af5..4a3f7a65cb25 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -267,7 +267,7 @@ namespace llvm { /// support *some* VECTOR_SHUFFLE operations, those with specific masks. /// By default, if a target supports the VECTOR_SHUFFLE node, all mask values /// are assumed to be legal. - virtual bool isShuffleMaskLegal(SDOperand Mask) const; + virtual bool isShuffleMaskLegal(SDOperand Mask, MVT::ValueType VT) const; private: // C Calling Convention implementation. std::vector LowerCCCArguments(Function &F, SelectionDAG &DAG);