[llvm] [AMDGPU] Avoid setting GLC for image atomics when result is unused (PR #150742)
Harrison Hao via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 04:38:17 PDT 2025
harrisonGPU wrote:
> > I think we may need a new intrinsic? For example, I’ve already implemented a draft that lowers:
>
> No, do not add a new intrinsic. Rely purely on use_empty of the result
Thanks, Matt. So I need to create new MachineInstrs for image atomics if the result is unused? For example:
```llvm
define amdgpu_ps void @atomic_cmpswap_i32_1d_no_return(<8 x i32> inreg %rsrc, i32 %cmp, i32 %swap, i32 %s) {
%v = call i32 @llvm.amdgcn.image.atomic.cmpswap.1d.i32.i32(i32 %cmp, i32 %swap, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
ret void
}
```
should be lowered to:
```
image_atomic_cmpswap off, v[1:2], v0, s[0:7] dmask:0x3 dim:SQ_RSRC_IMG_1D unorm
```
Is that right?
https://github.com/llvm/llvm-project/pull/150742
More information about the llvm-commits
mailing list