• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -amdgpu-spill-sgpr-to-smem=0 -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=SGPR %s
2; RUN: llc -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -amdgpu-spill-sgpr-to-smem=1 -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=SMEM %s
3
4; Make sure this doesn't crash.
5; ALL-LABEL: {{^}}test:
6; ALL: s_mov_b32 s[[LO:[0-9]+]], SCRATCH_RSRC_DWORD0
7; ALL: s_mov_b32 s[[OFF:[0-9]+]], s3
8; ALL: s_mov_b32 s[[HI:[0-9]+]], 0xe80000
9
10; Make sure we are handling hazards correctly.
11; SGPR: buffer_load_dword [[VHI:v[0-9]+]], off, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offset:16
12; SGPR-NEXT: s_waitcnt vmcnt(0)
13; SGPR-NEXT: v_readfirstlane_b32 s[[HI:[0-9]+]], [[VHI]]
14; SGPR-NEXT: s_nop 4
15; SGPR-NEXT: buffer_store_dword v0, off, s[0:[[HI]]{{\]}}, 0
16
17; Make sure scratch wave offset register is correctly incremented and
18; then restored.
19; SMEM: s_add_u32 m0, s[[OFF]], 0x100{{$}}
20; SMEM: s_buffer_store_dwordx4 s{{\[[0-9]+:[0-9]+\]}}, s{{\[}}[[LO]]:[[HI]]], m0 ; 16-byte Folded Spill
21
22; SMEM: s_add_u32 m0, s[[OFF]], 0x100{{$}}
23; SMEM: s_buffer_load_dwordx4 s{{\[[0-9]+:[0-9]+\]}}, s{{\[}}[[LO]]:[[HI]]], m0 ; 16-byte Folded Reload
24
25; SMEM: s_dcache_wb
26; ALL: s_endpgm
27define amdgpu_kernel void @test(i32 addrspace(1)* %out, i32 %in) {
28  call void asm sideeffect "", "~{s[0:7]}" ()
29  call void asm sideeffect "", "~{s[8:15]}" ()
30  call void asm sideeffect "", "~{s[16:23]}" ()
31  call void asm sideeffect "", "~{s[24:31]}" ()
32  call void asm sideeffect "", "~{s[32:39]}" ()
33  call void asm sideeffect "", "~{s[40:47]}" ()
34  call void asm sideeffect "", "~{s[48:55]}" ()
35  call void asm sideeffect "", "~{s[56:63]}" ()
36  call void asm sideeffect "", "~{s[64:71]}" ()
37  call void asm sideeffect "", "~{s[72:79]}" ()
38  call void asm sideeffect "", "~{s[80:87]}" ()
39  call void asm sideeffect "", "~{s[88:95]}" ()
40  call void asm sideeffect "", "~{v[0:7]}" ()
41  call void asm sideeffect "", "~{v[8:15]}" ()
42  call void asm sideeffect "", "~{v[16:23]}" ()
43  call void asm sideeffect "", "~{v[24:31]}" ()
44  call void asm sideeffect "", "~{v[32:39]}" ()
45  call void asm sideeffect "", "~{v[40:47]}" ()
46  call void asm sideeffect "", "~{v[48:55]}" ()
47  call void asm sideeffect "", "~{v[56:63]}" ()
48  call void asm sideeffect "", "~{v[64:71]}" ()
49  call void asm sideeffect "", "~{v[72:79]}" ()
50  call void asm sideeffect "", "~{v[80:87]}" ()
51  call void asm sideeffect "", "~{v[88:95]}" ()
52  call void asm sideeffect "", "~{v[96:103]}" ()
53  call void asm sideeffect "", "~{v[104:111]}" ()
54  call void asm sideeffect "", "~{v[112:119]}" ()
55  call void asm sideeffect "", "~{v[120:127]}" ()
56  call void asm sideeffect "", "~{v[128:135]}" ()
57  call void asm sideeffect "", "~{v[136:143]}" ()
58  call void asm sideeffect "", "~{v[144:151]}" ()
59  call void asm sideeffect "", "~{v[152:159]}" ()
60  call void asm sideeffect "", "~{v[160:167]}" ()
61  call void asm sideeffect "", "~{v[168:175]}" ()
62  call void asm sideeffect "", "~{v[176:183]}" ()
63  call void asm sideeffect "", "~{v[184:191]}" ()
64  call void asm sideeffect "", "~{v[192:199]}" ()
65  call void asm sideeffect "", "~{v[200:207]}" ()
66  call void asm sideeffect "", "~{v[208:215]}" ()
67  call void asm sideeffect "", "~{v[216:223]}" ()
68  call void asm sideeffect "", "~{v[224:231]}" ()
69  call void asm sideeffect "", "~{v[232:239]}" ()
70  call void asm sideeffect "", "~{v[240:247]}" ()
71  call void asm sideeffect "", "~{v[248:255]}" ()
72
73  store i32 %in, i32 addrspace(1)* %out
74  ret void
75}
76