]> granicus.if.org Git - llvm/commitdiff
[X86] shouldScalarizeBinop - never scalarize target opcodes.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 26 Jun 2019 14:21:29 +0000 (14:21 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 26 Jun 2019 14:21:29 +0000 (14:21 +0000)
We have (almost) no target opcodes that have scalar/vector equivalents - for now assume we can't scalarize them (we can add exceptions if we need to).

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

lib/Target/X86/X86ISelLowering.cpp

index 5e77a28ecfe6931cca632d4050f800df32a43ab9..6bf249ceb0264e77bbbfed655e6c41b1d921171c 100644 (file)
@@ -4899,15 +4899,22 @@ bool X86TargetLowering::isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,
 }
 
 bool X86TargetLowering::shouldScalarizeBinop(SDValue VecOp) const {
+  unsigned Opc = VecOp.getOpcode();
+
+  // Assume target opcodes can't be scalarized.
+  // TODO - do we have any exceptions?
+  if (Opc >= ISD::BUILTIN_OP_END)
+    return false;
+
   // If the vector op is not supported, try to convert to scalar.
   EVT VecVT = VecOp.getValueType();
-  if (!isOperationLegalOrCustomOrPromote(VecOp.getOpcode(), VecVT))
+  if (!isOperationLegalOrCustomOrPromote(Opc, VecVT))
     return true;
 
   // If the vector op is supported, but the scalar op is not, the transform may
   // not be worthwhile.
   EVT ScalarVT = VecVT.getScalarType();
-  return isOperationLegalOrCustomOrPromote(VecOp.getOpcode(), ScalarVT);
+  return isOperationLegalOrCustomOrPromote(Opc, ScalarVT);
 }
 
 bool X86TargetLowering::shouldFormOverflowOp(unsigned Opcode, EVT VT) const {