| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals all --version 6 |
| ; RUN: opt -mtriple=amdgpu8.03-unknown-amdhsa -S -passes=amdgpu-attributor < %s | FileCheck -check-prefix=GFX8 %s |
| ; RUN: opt -mtriple=amdgpu9.00-unknown-amdhsa -S -passes=amdgpu-attributor < %s | FileCheck -check-prefix=GFX9 %s |
| |
| ; A group-to-flat addrspacecast needs the aperture, which on gfx8 |
| ; requires the implicit argument pointer. gfx9 does not need to load |
| ; the aperture, so can infer "amdgpu-no-implicitarg-ptr" |
| |
| declare ptr addrspace(4) @llvm.amdgcn.queue.ptr() #0 |
| |
| define void @use_queue_ptr() #0 { |
| ; GFX8: Function Attrs: nounwind |
| ; GFX8-LABEL: define void @use_queue_ptr( |
| ; GFX8-SAME: ) #[[ATTR1:[0-9]+]] { |
| ; GFX8-NEXT: [[QUEUE_PTR:%.*]] = call ptr addrspace(4) @llvm.amdgcn.queue.ptr() |
| ; GFX8-NEXT: store volatile ptr addrspace(4) [[QUEUE_PTR]], ptr addrspace(1) poison, align 8 |
| ; GFX8-NEXT: ret void |
| ; |
| ; GFX9: Function Attrs: nounwind |
| ; GFX9-LABEL: define void @use_queue_ptr( |
| ; GFX9-SAME: ) #[[ATTR1:[0-9]+]] { |
| ; GFX9-NEXT: [[QUEUE_PTR:%.*]] = call ptr addrspace(4) @llvm.amdgcn.queue.ptr() |
| ; GFX9-NEXT: store volatile ptr addrspace(4) [[QUEUE_PTR]], ptr addrspace(1) poison, align 8 |
| ; GFX9-NEXT: ret void |
| ; |
| %queue.ptr = call ptr addrspace(4) @llvm.amdgcn.queue.ptr() |
| store volatile ptr addrspace(4) %queue.ptr, ptr addrspace(1) poison |
| ret void |
| } |
| |
| define void @func_indirect_use_queue_ptr() #0 { |
| ; GFX8: Function Attrs: nounwind |
| ; GFX8-LABEL: define void @func_indirect_use_queue_ptr( |
| ; GFX8-SAME: ) #[[ATTR1]] { |
| ; GFX8-NEXT: call void @use_queue_ptr() |
| ; GFX8-NEXT: ret void |
| ; |
| ; GFX9: Function Attrs: nounwind |
| ; GFX9-LABEL: define void @func_indirect_use_queue_ptr( |
| ; GFX9-SAME: ) #[[ATTR1]] { |
| ; GFX9-NEXT: call void @use_queue_ptr() |
| ; GFX9-NEXT: ret void |
| ; |
| call void @use_queue_ptr() |
| ret void |
| } |
| |
| define void @use_group_to_flat_addrspacecast(ptr addrspace(3) %ptr) #0 { |
| ; GFX8: Function Attrs: nounwind |
| ; GFX8-LABEL: define void @use_group_to_flat_addrspacecast( |
| ; GFX8-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR2:[0-9]+]] { |
| ; GFX8-NEXT: [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr addrspace(4) |
| ; GFX8-NEXT: store volatile i32 0, ptr addrspace(4) [[STOF]], align 4 |
| ; GFX8-NEXT: ret void |
| ; |
| ; GFX9: Function Attrs: nounwind |
| ; GFX9-LABEL: define void @use_group_to_flat_addrspacecast( |
| ; GFX9-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR2:[0-9]+]] { |
| ; GFX9-NEXT: [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr addrspace(4) |
| ; GFX9-NEXT: store volatile i32 0, ptr addrspace(4) [[STOF]], align 4 |
| ; GFX9-NEXT: ret void |
| ; |
| %stof = addrspacecast ptr addrspace(3) %ptr to ptr addrspace(4) |
| store volatile i32 0, ptr addrspace(4) %stof |
| ret void |
| } |
| |
| define void @use_group_to_flat_addrspacecast_queue_ptr(ptr addrspace(3) %ptr) #0 { |
| ; GFX8: Function Attrs: nounwind |
| ; GFX8-LABEL: define void @use_group_to_flat_addrspacecast_queue_ptr( |
| ; GFX8-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR1]] { |
| ; GFX8-NEXT: [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr addrspace(4) |
| ; GFX8-NEXT: store volatile i32 0, ptr addrspace(4) [[STOF]], align 4 |
| ; GFX8-NEXT: call void @func_indirect_use_queue_ptr() |
| ; GFX8-NEXT: ret void |
| ; |
| ; GFX9: Function Attrs: nounwind |
| ; GFX9-LABEL: define void @use_group_to_flat_addrspacecast_queue_ptr( |
| ; GFX9-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR1]] { |
| ; GFX9-NEXT: [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr addrspace(4) |
| ; GFX9-NEXT: store volatile i32 0, ptr addrspace(4) [[STOF]], align 4 |
| ; GFX9-NEXT: call void @func_indirect_use_queue_ptr() |
| ; GFX9-NEXT: ret void |
| ; |
| %stof = addrspacecast ptr addrspace(3) %ptr to ptr addrspace(4) |
| store volatile i32 0, ptr addrspace(4) %stof |
| call void @func_indirect_use_queue_ptr() |
| ret void |
| } |
| |
| define void @indirect_use_group_to_flat_addrspacecast() #0 { |
| ; GFX8: Function Attrs: nounwind |
| ; GFX8-LABEL: define void @indirect_use_group_to_flat_addrspacecast( |
| ; GFX8-SAME: ) #[[ATTR2]] { |
| ; GFX8-NEXT: call void @use_group_to_flat_addrspacecast(ptr addrspace(3) null) |
| ; GFX8-NEXT: ret void |
| ; |
| ; GFX9: Function Attrs: nounwind |
| ; GFX9-LABEL: define void @indirect_use_group_to_flat_addrspacecast( |
| ; GFX9-SAME: ) #[[ATTR2]] { |
| ; GFX9-NEXT: call void @use_group_to_flat_addrspacecast(ptr addrspace(3) null) |
| ; GFX9-NEXT: ret void |
| ; |
| call void @use_group_to_flat_addrspacecast(ptr addrspace(3) zeroinitializer) |
| ret void |
| } |
| |
| define void @indirect_use_group_to_flat_addrspacecast_queue_ptr() #0 { |
| ; GFX8: Function Attrs: nounwind |
| ; GFX8-LABEL: define void @indirect_use_group_to_flat_addrspacecast_queue_ptr( |
| ; GFX8-SAME: ) #[[ATTR1]] { |
| ; GFX8-NEXT: call void @use_group_to_flat_addrspacecast_queue_ptr(ptr addrspace(3) null) |
| ; GFX8-NEXT: ret void |
| ; |
| ; GFX9: Function Attrs: nounwind |
| ; GFX9-LABEL: define void @indirect_use_group_to_flat_addrspacecast_queue_ptr( |
| ; GFX9-SAME: ) #[[ATTR1]] { |
| ; GFX9-NEXT: call void @use_group_to_flat_addrspacecast_queue_ptr(ptr addrspace(3) null) |
| ; GFX9-NEXT: ret void |
| ; |
| call void @use_group_to_flat_addrspacecast_queue_ptr(ptr addrspace(3) zeroinitializer) |
| ret void |
| } |
| |
| attributes #0 = { nounwind } |
| ;. |
| ; GFX8: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } |
| ; GFX8: attributes #[[ATTR1]] = { nounwind "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "amdgpu-no-wwm" } |
| ; GFX8: attributes #[[ATTR2]] = { nounwind "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "amdgpu-no-wwm" } |
| ;. |
| ; GFX9: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } |
| ; GFX9: attributes #[[ATTR1]] = { nounwind "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "amdgpu-no-wwm" } |
| ; GFX9: attributes #[[ATTR2]] = { nounwind "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "amdgpu-no-wwm" } |
| ;. |