1; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -mattr=+flat-for-global < %s | FileCheck -check-prefix=HSA -check-prefix=HSA-DEFAULT -check-prefix=ALL %s
2; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -mattr=-flat-for-global < %s | FileCheck -check-prefix=HSA -check-prefix=HSA-NODEFAULT -check-prefix=ALL %s
3; RUN: llc -mtriple=amdgcn-- -mcpu=kaveri -mattr=-flat-for-global < %s | FileCheck -check-prefix=NOHSA-DEFAULT -check-prefix=ALL %s
4; RUN: llc -mtriple=amdgcn-- -mcpu=kaveri -mattr=+flat-for-global < %s | FileCheck -check-prefix=NOHSA-NODEFAULT -check-prefix=ALL %s
5
6
7; There are no stack objects even though flat is used by default, so
8; flat_scratch_init should be disabled.
9
10; ALL-LABEL: {{^}}test:
11; HSA: .amd_kernel_code_t
12; HSA: enable_sgpr_flat_scratch_init = 0
13; HSA: .end_amd_kernel_code_t
14
15; ALL-NOT: flat_scr
16
17; HSA-DEFAULT: flat_store_dword
18; HSA-NODEFAULT: buffer_store_dword
19
20; NOHSA-DEFAULT: buffer_store_dword
21; NOHSA-NODEFAULT: flat_store_dword
22define void @test(i32 addrspace(1)* %out) {
23entry:
24  store i32 0, i32 addrspace(1)* %out
25  ret void
26}
27