Skip to content

Commit

Permalink
AMDGPU: Mark ds append/consume intrinsics with align 4 (llvm#110533)
Browse files Browse the repository at this point in the history
Manual says the low 2 bits of the pointer are ignored.
  • Loading branch information
arsenm authored and VitaNuo committed Oct 2, 2024
1 parent 2898a08 commit 0554410
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/include/llvm/IR/IntrinsicsAMDGPU.td
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,8 @@ class AMDGPUDSAppendConsumedIntrinsic : Intrinsic<
[llvm_anyptr_ty, // LDS or GDS ptr
llvm_i1_ty], // isVolatile
[IntrConvergent, IntrWillReturn, IntrArgMemOnly,
NoCapture<ArgIndex<0>>, ImmArg<ArgIndex<1>>, IntrNoCallback, IntrNoFree],
Align<ArgIndex<0>, 4>, NoCapture<ArgIndex<0>>,
ImmArg<ArgIndex<1>>, IntrNoCallback, IntrNoFree],
"",
[SDNPMemOperand]
>;
Expand Down
21 changes: 21 additions & 0 deletions llvm/test/Assembler/amdgcn-intrinsic-attributes.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; REQUIRES: amdgpu-registered-target

; RUN: llvm-as < %s | llvm-dis | FileCheck %s

; Test assumed alignment parameter

; CHECK: declare i32 @llvm.amdgcn.ds.append.p3(ptr addrspace(3) nocapture align 4, i1 immarg) #0

define i32 @ds_append(ptr addrspace(3) %ptr) {
%ret = call i32 @llvm.amdgcn.ds.append.p3(ptr addrspace(3) %ptr, i1 false)
ret i32 %ret
}

; Test assumed alignment parameter
; CHECK: declare i32 @llvm.amdgcn.ds.consume.p3(ptr addrspace(3) nocapture align 4, i1 immarg) #0
define i32 @ds_consume(ptr addrspace(3) %ptr) {
%ret = call i32 @llvm.amdgcn.ds.consume.p3(ptr addrspace(3) %ptr, i1 false)
ret i32 %ret
}

; CHECK: attributes #0 = { convergent nocallback nofree nounwind willreturn memory(argmem: readwrite) }

0 comments on commit 0554410

Please sign in to comment.