[llvm] [AMDGPU] Add legalization rules for G_ATOMICRMW_FADD (PR #175257)

Anshil Gandhi via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 29 04:51:48 PST 2026


================
@@ -932,6 +932,17 @@ RegBankLegalizeRules::RegBankLegalizeRules(const GCNSubtarget &_ST,
       .Any({{B64, Ptr32}, {{}, {VgprB64, VgprPtr32}}})
       .Any({{B96, Ptr32}, {{}, {VgprB96, VgprPtr32}}})
       .Any({{B128, Ptr32}, {{}, {VgprB128, VgprPtr32}}});
+
+  // Atomics always operate per-lane; keep both the pointer and the value/result
+  // in VGPRs regardless of uniformity. Use Ptr32/Ptr64 to cover all addrspaces
+  // (e.g. local/region/private for Ptr32, global/flat for Ptr64).
+  addRulesForGOpcs({G_ATOMICRMW_FADD})
+      .Any({{B32, Ptr32, B32}, {{VgprB32}, {VgprPtr32, VgprB32}}})
----------------
gandhi56 wrote:

* Uniformity analysis marks the result of atomic ops as divergent.
* I will replace the use of B types with S types.

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


More information about the llvm-commits mailing list