[llvm] [SLP] Support FAdd/FSub as interchangeable instructions (PR #208002)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 07:24:48 PDT 2026


================
@@ -1059,34 +1060,41 @@ class BinOpSameOpcodeHelper {
     AndBIT = 1 << 5,
     OrBIT = 1 << 6,
     XorBIT = 1 << 7,
-    MainOpBIT = 1 << 8,
+    FAddBIT = 1 << 8,
+    FSubBIT = 1 << 9,
+    MainOpBIT = 1 << 10,
     LLVM_MARK_AS_BITMASK_ENUM(MainOpBIT)
   };
-  /// Return a non-nullptr if either operand of I is a ConstantInt.
+  /// Return a non-nullptr if either operand of I is a ConstantInt (for the
+  /// integer opcodes) or a ConstantFP (for FAdd/FSub).
   /// The second return value represents the operand position. We check the
-  /// right-hand side first (1). If the right hand side is not a ConstantInt and
-  /// the instruction is neither Sub, Shl, nor AShr, we then check the left hand
-  /// side (0).
-  static std::pair<ConstantInt *, unsigned>
+  /// right-hand side first (1). If the right hand side is not a constant and
+  /// the instruction is neither Sub, FSub, Shl, nor AShr, we then check the
+  /// left hand side (0).
+  static std::pair<Constant *, unsigned>
   isBinOpWithConstantInt(const Instruction *I) {
----------------
RKSimon wrote:

rename?

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


More information about the llvm-commits mailing list