[mips][msa] Fix corner case for integer constant splats with undef values.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 22 Nov 2013 13:14:06 +0000 (13:14 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 22 Nov 2013 13:14:06 +0000 (13:14 +0000)
lowerBUILD_VECTOR() was treating integer constant splats as being legal
regardless of whether they had undef values. This caused instruction
selection failures when the undefs were legalized to zero, making the
constant non-splat.

Fixed this by requiring HasAnyUndef to be false for a integer constant
splat to be legal. If it is true, a new node is generated with the undefs
replaced with the necessary values to remain a splat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195455 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsSEISelLowering.cpp

index c02c235eb7dc697c9c86f86ac08c2738c04b38a6..0c9cecb733524f11bb3e2f5bf1f832b5043e4334 100644 (file)
@@ -2211,8 +2211,9 @@ SDValue MipsSETargetLowering::lowerBUILD_VECTOR(SDValue Op,
 
     // If the value fits into a simm10 then we can use ldi.[bhwd]
     // However, if it isn't an integer type we will have to bitcast from an
-    // integer type first.
-    if (ResTy.isInteger() && SplatValue.isSignedIntN(10))
+    // integer type first. Also, it there are any undefs, we must lower them
+    // to defined values first.
+    if (ResTy.isInteger() && !HasAnyUndefs && SplatValue.isSignedIntN(10))
       return Op;
 
     EVT ViaVecTy;