1 ; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri -mattr=+flat-for-global | FileCheck -check-prefix=HSA -check-prefix=HSA-DEFAULT -check-prefix=ALL %s
2 ; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri -mattr=-flat-for-global | FileCheck -check-prefix=HSA -check-prefix=HSA-NODEFAULT -check-prefix=ALL %s
3 ; RUN: llc < %s -mtriple=amdgcn-- -mcpu=tonga | FileCheck -check-prefix=HSA-NOADDR64 -check-prefix=ALL %s
4 ; RUN: llc < %s -mtriple=amdgcn-- -mcpu=kaveri -mattr=-flat-for-global | FileCheck -check-prefix=NOHSA-DEFAULT -check-prefix=ALL %s
5 ; RUN: llc < %s -mtriple=amdgcn-- -mcpu=kaveri -mattr=+flat-for-global | FileCheck -check-prefix=NOHSA-NODEFAULT -check-prefix=ALL %s
6 ; RUN: llc < %s -mtriple=amdgcn-- -mcpu=tonga | FileCheck -check-prefix=NOHSA-NOADDR64 -check-prefix=ALL %s
9 ; There are no stack objects even though flat is used by default, so
10 ; flat_scratch_init should be disabled.
12 ; ALL-LABEL: {{^}}test:
16 ; HSA-DEFAULT: flat_store_dword
17 ; HSA-NODEFAULT: buffer_store_dword
18 ; HSA-NOADDR64: flat_store_dword
20 ; HSA: .amdhsa_user_sgpr_flat_scratch_init 0
22 ; NOHSA-DEFAULT: buffer_store_dword
23 ; NOHSA-NODEFAULT: flat_store_dword
24 ; NOHSA-NOADDR64: flat_store_dword
25 define amdgpu_kernel void @test(ptr addrspace(1) %out) {
27 store i32 0, ptr addrspace(1) %out
31 ; HSA-DEFAULT: flat_store_dword
32 ; HSA-NODEFAULT: buffer_store_dword
33 ; HSA-NOADDR64: flat_store_dword
35 ; NOHSA-DEFAULT: buffer_store_dword
36 ; NOHSA-NODEFAULT: flat_store_dword
37 ; NOHSA-NOADDR64: flat_store_dword
38 define amdgpu_kernel void @test_addr64(ptr addrspace(1) %out) {
40 %out.addr = alloca ptr addrspace(1), align 4, addrspace(5)
42 store ptr addrspace(1) %out, ptr addrspace(5) %out.addr, align 4
43 %ld0 = load ptr addrspace(1), ptr addrspace(5) %out.addr, align 4
45 store i32 1, ptr addrspace(1) %ld0, align 4
47 %ld1 = load ptr addrspace(1), ptr addrspace(5) %out.addr, align 4
48 %arrayidx1 = getelementptr inbounds i32, ptr addrspace(1) %ld1, i32 1
49 store i32 2, ptr addrspace(1) %arrayidx1, align 4
54 !llvm.module.flags = !{!0}
55 !0 = !{i32 1, !"amdhsa_code_object_version", i32 400}