AMDGPU: Remove SIPrepareScratchRegs
[oota-llvm.git] / test / CodeGen / AMDGPU / large-alloca-compute.ll
1 ; RUN: llc -march=amdgcn -mcpu=bonaire < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=ALL %s
2 ; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=ALL %s
3 ; XUN: llc -march=amdgcn -mcpu=bonaire -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck -check-prefix=GCNHSA -check-prefix=CIHSA -check-prefix=ALL %s
4 ; XUN: llc -march=amdgcn -mcpu=tonga -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck -check-prefix=GCNHSA -check-prefix=VIHSA -check-prefix=ALL %s
5
6 ; FIXME: align on alloca seems to be ignored for private_segment_alignment
7
8 ; ALL-LABEL: {{^}}large_alloca_compute_shader:
9
10 ; GCN: s_mov_b32 s12, SCRATCH_RSRC_DWORD0
11 ; GCN: s_mov_b32 s13, SCRATCH_RSRC_DWORD1
12 ; GCN: s_mov_b32 s14, -1
13 ; CI: s_mov_b32 s15, 0x80f000
14 ; VI: s_mov_b32 s15, 0x800000
15
16
17 ; GCNHSA: .amd_kernel_code_t
18 ; GCNHSA: private_segment_alignment = 4
19 ; GCNHSA: .end_amd_kernel_code_t
20
21 ; GCNHSA: s_mov_b32 s8, SCRATCH_RSRC_DWORD0
22 ; GCNHSA: s_mov_b32 s9, SCRATCH_RSRC_DWORD1
23 ; GCNHSA: s_mov_b32 s10, -1
24 ; CIHSA: s_mov_b32 s11, 0x180f000
25 ; VIHSA: s_mov_b32 s11, 0x11800000
26
27 ; GCNHSA: buffer_store_dword {{v[0-9]+}}, {{v[0-9]+}}, s[8:11], s6 offen
28 ; GCNHSA: buffer_load_dword {{v[0-9]+}}, {{v[0-9]+}}, s[8:11], s6 offen
29
30 ; Scratch size = alloca size + emergency stack slot
31 ; ALL: ; ScratchSize: 32772
32 define void @large_alloca_compute_shader(i32 %x, i32 %y) #0 {
33   %large = alloca [8192 x i32], align 4
34   %gep = getelementptr [8192 x i32], [8192 x i32]* %large, i32 0, i32 8191
35   store volatile i32 %x, i32* %gep
36   %gep1 = getelementptr [8192 x i32], [8192 x i32]* %large, i32 0, i32 %y
37   %val = load volatile i32, i32* %gep1
38   store volatile i32 %val, i32 addrspace(1)* undef
39   ret void
40 }
41
42 attributes #0 = { nounwind  }