[llvm] [X86] Fold vpmadd52h/l for pattern X * 0 + Y --> Y (PR #156086)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 30 04:21:24 PDT 2025


================
@@ -44967,6 +44968,11 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
     if (SimplifyDemandedBits(Op1, Low52Bits, OriginalDemandedElts, KnownOp1,
                              TLO, Depth + 1))
       return true;
+
+    // X * 0 + Y --> Y
+    if (KnownOp0.trunc(52).isZero() || KnownOp1.trunc(52).isZero())
+      return TLO.CombineTo(Op, Op2);
+
----------------
RKSimon wrote:

Add a TODO to handle the lo/hi mul 52/104 == 0 case as well.

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


More information about the llvm-commits mailing list