Make isMOVDDUP mask check more strict and update comments!
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 25 Aug 2011 21:40:34 +0000 (21:40 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 25 Aug 2011 21:40:34 +0000 (21:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138587 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index eedb1ff71418600740e5827f2bf1b12f4da56e34..80f3e943b5487727d0a527319ec8d890744a9dcf 100644 (file)
@@ -3914,10 +3914,15 @@ bool X86::isMOVSLDUPMask(ShuffleVectorSDNode *N,
 }
 
 /// isMOVDDUPMask - Return true if the specified VECTOR_SHUFFLE operand
-/// specifies a shuffle of elements that is suitable for input to MOVDDUP.
+/// specifies a shuffle of elements that is suitable for input to 128-bit
+/// version of MOVDDUP.
 bool X86::isMOVDDUPMask(ShuffleVectorSDNode *N) {
-  int e = N->getValueType(0).getVectorNumElements() / 2;
+  EVT VT = N->getValueType(0);
+
+  if (VT.getSizeInBits() != 128)
+    return false;
 
+  int e = VT.getVectorNumElements() / 2;
   for (int i = 0; i < e; ++i)
     if (!isUndefOrEqual(N->getMaskElt(i), i))
       return false;