[llvm] [AArch64] missed fold vector fptoui(fdiv(uitofp(x), uitofp(y))) or fptosi(fdiv(sitofp(x), sitofp(y))) into udiv(x, y) or sdiv(x, y) for sve (PR #215146)

Guy David via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 13:56:05 PDT 2026


================
@@ -31167,14 +31167,46 @@ static SDValue performPredicateLoadCombine(SDNode *N,
   DAG.makeEquivalentMemoryOrdering(Load, LoadPred);
   return LoadPred;
 }
+static SDValue performFPToIntToDivCombine(SDNode *N, SelectionDAG &DAG) {
+  unsigned Opc = N->getOpcode();
+  bool IsSigned = (Opc == ISD::FP_TO_SINT);
+
+  SDValue FDiv = N->getOperand(0);
+  if (FDiv.getOpcode() != ISD::FDIV)
+    return SDValue();
+
+  EVT IntVT = N->getValueType(0);
+  EVT FPVT = FDiv.getValueType();
+
+  if (IntVT.getVectorElementType() != MVT::i32 ||
----------------
guy-david wrote:

That assumes that the type is a vector. Why is that important anyway?

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


More information about the llvm-commits mailing list