[llvm] [AMDGPU] Add legalization rules for atomic ops (PR #175253)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 12 06:53:36 PST 2026


================
@@ -664,6 +664,17 @@ RegBankLegalizeRules::RegBankLegalizeRules(const GCNSubtarget &_ST,
       .Uni(S64, {{Sgpr64}, {Sgpr64, Imm}})
       .Div(S64, {{Vgpr64}, {Vgpr64, Imm}});
 
+  // Atomic read-modify-write operations: result and value are always VGPR,
+  // pointer varies by address space.
+  addRulesForGOpcs({G_ATOMICRMW_ADD, G_ATOMICRMW_SUB, G_ATOMICRMW_XCHG,
----------------
petar-avramovic wrote:

can you add some ll tests for remaining opcodes (there are some for add and sub)

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


More information about the llvm-commits mailing list