[X86] Add a check for SSE2 to the top of combineReductionToHorizontal.
authorCraig Topper <craig.topper@intel.com>
Fri, 25 Oct 2019 00:41:05 +0000 (17:41 -0700)
committerCraig Topper <craig.topper@intel.com>
Fri, 25 Oct 2019 18:11:32 +0000 (11:11 -0700)
Without this, we can create a PSADBW node that isn't legal.

llvm/lib/Target/X86/X86ISelLowering.cpp

index 9e62858..6fb870a 100644 (file)
@@ -36266,6 +36266,10 @@ static SDValue combineReductionToHorizontal(SDNode *ExtElt, SelectionDAG &DAG,
                                             const X86Subtarget &Subtarget) {
   assert(ExtElt->getOpcode() == ISD::EXTRACT_VECTOR_ELT && "Unexpected caller");
 
+  // We need at least SSE2 to anything here.
+  if (!Subtarget.hasSSE2())
+    return SDValue();
+
   ISD::NodeType Opc;
   SDValue Rdx =
       DAG.matchBinOpReduction(ExtElt, Opc, {ISD::ADD, ISD::FADD}, true);