1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -filetype=obj -o - < %s | llvm-readelf --notes - | FileCheck --check-prefix=CHECK %s
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -filetype=obj -o - < %s | llvm-readelf --notes - | FileCheck --check-prefix=CHECK %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readelf --notes - | FileCheck --check-prefixes=CHECK,GFX9 %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 < %s | FileCheck --check-prefix=CHECK %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 < %s | FileCheck --check-prefix=CHECK %s
7 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck --check-prefixes=CHECK,GFX9 %s
10 ; On gfx8, the queue ptr is required for this addrspacecast.
12 ; PRE-GFX9: hidden_queue_ptr
13 ; GFX9-NOT: hidden_queue_ptr
14 ; CHECK-LABEL: .name: addrspacecast_requires_queue_ptr
15 define amdgpu_kernel void @addrspacecast_requires_queue_ptr(ptr addrspace(5) %ptr.private, ptr addrspace(3) %ptr.local) {
16 %flat.private = addrspacecast ptr addrspace(5) %ptr.private to ptr
17 %flat.local = addrspacecast ptr addrspace(3) %ptr.local to ptr
18 store volatile i32 1, ptr %flat.private
19 store volatile i32 2, ptr %flat.local
24 ; PRE-GFX9: hidden_shared_base
25 ; GFX9-NOT: hidden_shared_base
26 ; CHECK-LABEL: .name: is_shared_requires_queue_ptr
27 define amdgpu_kernel void @is_shared_requires_queue_ptr(ptr %ptr) {
28 %is.shared = call i1 @llvm.amdgcn.is.shared(ptr %ptr)
29 %zext = zext i1 %is.shared to i32
30 store volatile i32 %zext, ptr addrspace(1) undef
35 ; PRE-GFX9: hidden_private_base
36 ; GFX9-NOT: hidden_private_base
37 ; CHECK-LABEL: .name: is_private_requires_queue_ptr
38 define amdgpu_kernel void @is_private_requires_queue_ptr(ptr %ptr) {
39 %is.private = call i1 @llvm.amdgcn.is.private(ptr %ptr)
40 %zext = zext i1 %is.private to i32
41 store volatile i32 %zext, ptr addrspace(1) undef
47 ; PRE-GFX9: hidden_queue_ptr
48 ; GFX9-NOT: hidden_queue_ptr
49 ; CHECK-LABEL: .name: trap_requires_queue_ptr
50 define amdgpu_kernel void @trap_requires_queue_ptr() {
51 call void @llvm.trap()
56 ; CHECK: hidden_queue_ptr
57 ; CHECK-LABEL: .name: amdgcn_queue_ptr_requires_queue_ptr
58 define amdgpu_kernel void @amdgcn_queue_ptr_requires_queue_ptr(ptr addrspace(1) %ptr) {
59 %queue.ptr = call ptr addrspace(4) @llvm.amdgcn.queue.ptr()
60 %implicitarg.ptr = call ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr()
61 %dispatch.ptr = call ptr addrspace(4) @llvm.amdgcn.dispatch.ptr()
62 %dispatch.id = call i64 @llvm.amdgcn.dispatch.id()
63 %queue.load = load volatile i8, ptr addrspace(4) %queue.ptr
64 %implicitarg.load = load volatile i8, ptr addrspace(4) %implicitarg.ptr
65 %dispatch.load = load volatile i8, ptr addrspace(4) %dispatch.ptr
66 store volatile i64 %dispatch.id, ptr addrspace(1) %ptr
71 declare noalias ptr addrspace(4) @llvm.amdgcn.queue.ptr()
72 declare noalias ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr()
73 declare i64 @llvm.amdgcn.dispatch.id()
74 declare noalias ptr addrspace(4) @llvm.amdgcn.dispatch.ptr()
75 declare i1 @llvm.amdgcn.is.shared(ptr)
76 declare i1 @llvm.amdgcn.is.private(ptr)
77 declare void @llvm.trap()
78 declare void @llvm.debugtrap()
80 !llvm.module.flags = !{!0}
81 !0 = !{i32 1, !"amdgpu_code_object_version", i32 500}