[llvm] [AArch64] Fix #94909: Optimize vector fmul(sitofp(x), 0.5) -> scvtf(x, 2) (PR #141480)

David Green via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 29 13:55:40 PDT 2025


================
@@ -3952,6 +3960,125 @@ static bool checkCVTFixedPointOperandWithFBits(SelectionDAG *CurDAG, SDValue N,
   return true;
 }
 
+static bool checkCVTFixedPointOperandWithFBitsForVectors(SelectionDAG *CurDAG,
+                                                         SDValue N,
+                                                         SDValue &FixedPos,
+                                                         unsigned FloatWidth,
+                                                         bool IsReciprocal) {
+
+  if (N->getNumOperands() < 1)
+    return false;
+
+  SDValue ImmediateNode = N.getOperand(0);
+  if (N.getOpcode() == ISD::BITCAST || N.getOpcode() == AArch64ISD::NVCAST) {
+    // This could have been a bitcast to a scalar
+    if (!ImmediateNode.getValueType().isVector())
+      return false;
+  }
+
+  if (ImmediateNode.getOpcode() == AArch64ISD::DUP ||
+      ImmediateNode.getOpcode() == AArch64ISD::MOVIshift ||
+      ImmediateNode.getOpcode() == AArch64ISD::FMOV ||
----------------
davemgreen wrote:

I don't think this can be FMOV now.

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


More information about the llvm-commits mailing list