[llvm] [RISCV] Add helper method for shift-and-add extensions (PR #158638)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 15 08:52:27 PDT 2025


================
@@ -3204,9 +3204,7 @@ static bool isWorthFoldingIntoRegRegScale(const RISCVSubtarget &Subtarget,
     // If we have a SHXADD instruction, prefer that over reassociating an ADDI.
     assert(Shift.getOpcode() == ISD::SHL);
     unsigned ShiftAmt = Shift.getConstantOperandVal(1);
-    if ((ShiftAmt <= 3 &&
-         (Subtarget.hasStdExtZba() || Subtarget.hasVendorXTHeadBa())) ||
-        (ShiftAmt >= 4 && ShiftAmt <= 7 && Subtarget.hasVendorXqciac()))
+    if (ShiftAmt <= 7 && Subtarget.hasShlAdd(ShiftAmt))
----------------
topperc wrote:

I think we can remove it.

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


More information about the llvm-commits mailing list