[llvm] [RISCV][GlobalISel] Legalize and select G_ATOMICRMW_ADD instruction (PR #153791)
Kane Wang via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 20 18:56:36 PDT 2025
ReVe1uv wrote:
> Please add end to end IR tests.
While working on the end-to-end IR tests, I found that with `-mattr=+a`, `atomicrmw add` operations with a width smaller than i32 are expanded during the atomic-expand phase into intrinsics (as determined by `shouldExpandAtomicRMWInIR`), e.g. `call i64 @llvm.riscv.masked.atomicrmw.add.i64.p0`. Currently, GlobalISel cannot lower these intrinsics. To handle this, I changed the legalization rule from `.legalFor(ST.hasStdExtA(), {{sXLen, p0}})` to `.legalFor(ST.hasStdExtA() && ST.hasStdExtZabha(), {{sXLen, p0}})`, so that we first cover the cases that do not generate intrinsics. The end-to-end IR test has been added at `llvm/test/CodeGen/RISCV/GlobalISel/atomicrmw-add.ll`.
https://github.com/llvm/llvm-project/pull/153791
More information about the llvm-commits
mailing list