[llvm] r229670 - [x86] Tighten the assertions to document that canonicalization has

Chandler Carruth chandlerc at gmail.com
Wed Feb 18 03:46:29 PST 2015


Author: chandlerc
Date: Wed Feb 18 05:46:29 2015
New Revision: 229670

URL: http://llvm.org/viewvc/llvm-project?rev=229670&view=rev
Log:
[x86] Tighten the assertions to document that canonicalization has
actually removed all but a *very* small number of choices for v2i64.
Also remove dead code handling cases that simply cannot arise.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=229670&r1=229669&r2=229670&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 18 05:46:29 2015
@@ -8618,8 +8618,10 @@ static SDValue lowerV2I64VectorShuffle(S
         DAG.getNode(X86ISD::PSHUFD, SDLoc(Op), MVT::v4i32, V1,
                     getV4X86ShuffleImm8ForMask(WidenedMask, DAG)));
   }
-  assert((Mask[0] >= 2) + (Mask[1] >= 2) == 1 &&
-         "Canonicalization ensures we only see shuffles with two inputs.");
+  assert(Mask[0] != -1 && "No undef lanes in multi-input v2 shuffles!");
+  assert(Mask[1] != -1 && "No undef lanes in multi-input v2 shuffles!");
+  assert(Mask[0] < 2 && "We sort V1 to be the first input.");
+  assert(Mask[1] >= 2 && "We sort V2 to be the second input.");
 
   // Try to use shift instructions.
   if (SDValue Shift =
@@ -8633,8 +8635,7 @@ static SDValue lowerV2I64VectorShuffle(S
     return Insertion;
   // Try inverting the insertion since for v2 masks it is easy to do and we
   // can't reliably sort the mask one way or the other.
-  int InverseMask[2] = {Mask[0] < 0 ? -1 : (Mask[0] ^ 2),
-                        Mask[1] < 0 ? -1 : (Mask[1] ^ 2)};
+  int InverseMask[2] = {Mask[0] ^ 2, Mask[1] ^ 2};
   if (SDValue Insertion = lowerVectorShuffleAsElementInsertion(
           MVT::v2i64, DL, V2, V1, InverseMask, Subtarget, DAG))
     return Insertion;





More information about the llvm-commits mailing list