[llvm] [X86] Lower i512 ADD/SUB using Kogge-Stone on AVX512 (PR #174761)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 4 05:02:15 PST 2026


================
@@ -2915,8 +2917,12 @@ static bool mayFoldIntoVector(SDValue Op, const X86Subtarget &Subtarget,
   if (isa<ConstantSDNode>(Op) || isa<ConstantFPSDNode>(Op))
     return true;
   EVT VT = Op.getValueType();
-  if (ISD::isBitwiseLogicOp(Op.getOpcode()) &&
-      (VT == MVT::i128 || VT == MVT::i256 || VT == MVT::i512))
+  // TODO : might have better handling by using
+  // `TargetLowering::LegalizeAction::Custom`
+  bool BitwiseCase = (ISD::isBitwiseLogicOp(Op.getOpcode()) &&
+                      (VT == MVT::i128 || VT == MVT::i256 || VT == MVT::i512));
+  bool AddSubCase = (ISD::isAddSubOp(Op.getOpcode()) && (VT == MVT::i512));
----------------
RKSimon wrote:

Don't add isAddSubOp to ISDOpcodes and just do this instead:
```suggestion
  bool AddSubCase = (Op.getOpcode() == ISD::ADD || Op.getOpcode() == ISD::SUB) && (VT == MVT::i512));
```

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


More information about the llvm-commits mailing list