From 0554410830371a08af3d889e68df33d69afe8ad5 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 1 Oct 2024 13:57:04 +0400 Subject: [PATCH] AMDGPU: Mark ds append/consume intrinsics with align 4 (#110533) Manual says the low 2 bits of the pointer are ignored. --- llvm/include/llvm/IR/IntrinsicsAMDGPU.td | 3 ++- .../Assembler/amdgcn-intrinsic-attributes.ll | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 llvm/test/Assembler/amdgcn-intrinsic-attributes.ll diff --git a/llvm/include/llvm/IR/IntrinsicsAMDGPU.td b/llvm/include/llvm/IR/IntrinsicsAMDGPU.td index a03a92b5a97f78b..50179c1ceddb474 100644 --- a/llvm/include/llvm/IR/IntrinsicsAMDGPU.td +++ b/llvm/include/llvm/IR/IntrinsicsAMDGPU.td @@ -558,7 +558,8 @@ class AMDGPUDSAppendConsumedIntrinsic : Intrinsic< [llvm_anyptr_ty, // LDS or GDS ptr llvm_i1_ty], // isVolatile [IntrConvergent, IntrWillReturn, IntrArgMemOnly, - NoCapture>, ImmArg>, IntrNoCallback, IntrNoFree], + Align, 4>, NoCapture>, + ImmArg>, IntrNoCallback, IntrNoFree], "", [SDNPMemOperand] >; diff --git a/llvm/test/Assembler/amdgcn-intrinsic-attributes.ll b/llvm/test/Assembler/amdgcn-intrinsic-attributes.ll new file mode 100644 index 000000000000000..3652f6a4a27e37d --- /dev/null +++ b/llvm/test/Assembler/amdgcn-intrinsic-attributes.ll @@ -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) }