[llvm] [AArch64] Keep floating-point conversion in SIMD (PR #147707)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 25 04:40:39 PDT 2025


================
@@ -24026,6 +24026,63 @@ static SDValue combineBoolVectorAndTruncateStore(SelectionDAG &DAG,
                       Store->getMemOperand());
 }
 
+// Combine store (fp_to_int X) with optional extensions/trunctions to use vector
+// semantics when NEON is available.
+static void combineFPToIntStore(StoreSDNode *ST,
+                                TargetLowering::DAGCombinerInfo &DCI,
+                                SelectionDAG &DAG,
+                                const AArch64Subtarget *Subtarget) {
+  if (!Subtarget->isNeonAvailable())
+    return;
+
+  SDValue Value = ST->getValue();
+  // Peel extensions, truncations and assertions.
+  for (;;) {
+    if (!Value->hasOneUse())
+      break;
+    if (!ISD::isExtOpcode(Value.getOpcode()) &&
+        Value.getOpcode() != ISD::TRUNCATE && !Value->isAssert())
+      break;
+    Value = Value.getOperand(0);
+  }
+
+  if (Value.getOpcode() != ISD::FP_TO_UINT &&
+      Value.getOpcode() != ISD::FP_TO_SINT)
+    return;
+  if (!Value.hasOneUse())
+    return;
+
+  SDValue FPSrc = Value.getOperand(0);
+  EVT SrcVT = FPSrc.getValueType();
+  if (SrcVT.isVector())
+    return;
----------------
paulwalker-arm wrote:

Can this bailout be applied to the initial `Value`? so we bail before walking the DAG.

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


More information about the llvm-commits mailing list