• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=tonga < %s | FileCheck -check-prefix=HSA-NOADDR64 -check-prefix=ALL %s
4; RUN: llc -mtriple=amdgcn-- -mcpu=kaveri -mattr=-flat-for-global < %s | FileCheck -check-prefix=NOHSA-DEFAULT -check-prefix=ALL %s
5; RUN: llc -mtriple=amdgcn-- -mcpu=kaveri -mattr=+flat-for-global < %s | FileCheck -check-prefix=NOHSA-NODEFAULT -check-prefix=ALL %s
6; RUN: llc -mtriple=amdgcn-- -mcpu=tonga < %s | FileCheck -check-prefix=NOHSA-NOADDR64 -check-prefix=ALL %s
7
8
9; There are no stack objects even though flat is used by default, so
10; flat_scratch_init should be disabled.
11
12; ALL-LABEL: {{^}}test:
13; HSA: .amd_kernel_code_t
14; HSA: enable_sgpr_flat_scratch_init = 0
15; HSA: .end_amd_kernel_code_t
16
17; ALL-NOT: flat_scr
18
19; HSA-DEFAULT: flat_store_dword
20; HSA-NODEFAULT: buffer_store_dword
21; HSA-NOADDR64: flat_store_dword
22
23; NOHSA-DEFAULT: buffer_store_dword
24; NOHSA-NODEFAULT: flat_store_dword
25; NOHSA-NOADDR64: flat_store_dword
26define amdgpu_kernel void @test(i32 addrspace(1)* %out) {
27entry:
28  store i32 0, i32 addrspace(1)* %out
29  ret void
30}
31
32; HSA-DEFAULT: flat_store_dword
33; HSA-NODEFAULT: buffer_store_dword
34; HSA-NOADDR64: flat_store_dword
35
36; NOHSA-DEFAULT: buffer_store_dword
37; NOHSA-NODEFAULT: flat_store_dword
38; NOHSA-NOADDR64: flat_store_dword
39define amdgpu_kernel void @test_addr64(i32 addrspace(1)* %out) {
40entry:
41  %out.addr = alloca i32 addrspace(1)*, align 4, addrspace(5)
42
43  store i32 addrspace(1)* %out, i32 addrspace(1)* addrspace(5)* %out.addr, align 4
44  %ld0 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %out.addr, align 4
45
46  %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %ld0, i32 0
47  store i32 1, i32 addrspace(1)* %arrayidx, align 4
48
49  %ld1 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %out.addr, align 4
50  %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %ld1, i32 1
51  store i32 2, i32 addrspace(1)* %arrayidx1, align 4
52
53  ret void
54}
55