[llvm] [RISCV] Use predicated FP extension when promoting VP operands (PR #79328)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 05:10:17 PST 2024


================
@@ -756,7 +764,16 @@ void VectorLegalizer::Promote(SDNode *Node, SmallVectorImpl<SDValue> &Results) {
               .getVectorElementType()
               .isFloatingPoint() &&
           NVT.isVector() && NVT.getVectorElementType().isFloatingPoint())
-        Operands[j] = DAG.getNode(ISD::FP_EXTEND, dl, NVT, Node->getOperand(j));
+        if (!ISD::isVPOpcode(Node->getOpcode()))
+          Operands[j] =
+              DAG.getNode(ISD::FP_EXTEND, dl, NVT, Node->getOperand(j));
+        else {
+          auto MaskIdx = *ISD::getVPMaskIdx(Node->getOpcode());
+          auto EVLIdx = *ISD::getVPExplicitVectorLengthIdx(Node->getOpcode());
+          Operands[j] =
+              DAG.getNode(ISD::VP_FP_EXTEND, dl, NVT, Node->getOperand(j),
+                          Node->getOperand(MaskIdx), Node->getOperand(EVLIdx));
+        }
----------------
arsenm wrote:

Seems like we need helper methods in the DAG to build VP or non-VP versions. The prospect of permutations combined with strictfp versions is also horrifying

https://github.com/llvm/llvm-project/pull/79328


More information about the llvm-commits mailing list