[llvm] [RISCV][GlobalISel] Legalize and select G_ATOMICRMW_ADD instruction (PR #153791)

Kane Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 18:57:53 PDT 2025


================
@@ -692,6 +692,11 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
       .customIf(all(typeIsLegalIntOrFPVec(0, IntOrFPVecTys, ST),
                     typeIsLegalIntOrFPVec(1, IntOrFPVecTys, ST)));
 
+  getActionDefinitionsBuilder(G_ATOMICRMW_ADD)
+      .legalFor(ST.hasStdExtA(), {{s32, p0}, {sXLen, p0}})
+      .libcallFor(!ST.hasStdExtA(), {{s8, p0}, {s16, p0}, {s32, p0}, {s64, p0}})
+      .clampScalar(0, s32, sXLen);
----------------
ReVe1uv wrote:

Thanks for the guidance! I confirmed the SelectionDAG patterns in `RISCVISelLowering.cpp` and have updated the code accordingly, along with refining the test cases.

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


More information about the llvm-commits mailing list