[PATCH] D57639: [CodeGen] Handle vector UADDO, SADDO, USUBO, SSUBO

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 11:17:19 PST 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:260-266
+    EVT ScalarVT = ResVT.getVectorElementType();
+    SDValue Zero = DAG.getConstant(
+        0, DL, TLI.getVectorIdxTy(DAG.getDataLayout()));
+    ScalarLHS = DAG.getNode(
+        ISD::EXTRACT_VECTOR_ELT, DL, ScalarVT, N->getOperand(0), Zero);
+    ScalarRHS = DAG.getNode(
+        ISD::EXTRACT_VECTOR_ELT, DL, ScalarVT, N->getOperand(1), Zero);
----------------
arsenm wrote:
> You can use DAG.ExtractVectorELements here
Something like this?

    SmallVector<SDValue, 1> ElemsLHS, ElemsRHS;
    DAG.ExtractVectorElements(N->getOperand(0), ElemsLHS);
    DAG.ExtractVectorElements(N->getOperand(1), ElemsRHS);
    ScalarLHS = ElemsLHS[0];
    ScalarRHS = ElemsRHS[0];

It seems a bit odd to go through a vector if only one element is extracted.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57639/new/

https://reviews.llvm.org/D57639





More information about the llvm-commits mailing list