1; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck --check-prefix=TONGA %s
2
3; On Tonga and Iceland, limited SGPR availability means care must be taken to
4; allocate scratch registers correctly. Check that this test compiles without
5; error.
6; TONGA-LABEL: test
7define void @test(<256 x i32> addrspace(1)* %out, <256 x i32> addrspace(1)* %in) {
8entry:
9  %tid = call i32 @llvm.SI.tid() nounwind readnone
10  %aptr = getelementptr <256 x i32>, <256 x i32> addrspace(1)* %in, i32 %tid
11  %a = load <256 x i32>, <256 x i32> addrspace(1)* %aptr
12  call void asm sideeffect "", "~{memory}" ()
13  %outptr = getelementptr <256 x i32>, <256 x i32> addrspace(1)* %in, i32 %tid
14  store <256 x i32> %a, <256 x i32> addrspace(1)* %outptr
15
16; mark 128-bit SGPR registers as used so they are unavailable for the
17; scratch resource descriptor
18  call void asm sideeffect "", "~{SGPR4},~{SGPR8},~{SGPR12},~{SGPR16},~{SGPR20},~{SGPR24},~{SGPR28}" ()
19  call void asm sideeffect "", "~{SGPR32},~{SGPR36},~{SGPR40},~{SGPR44},~{SGPR48},~{SGPR52},~{SGPR56}" ()
20  call void asm sideeffect "", "~{SGPR60},~{SGPR64},~{SGPR68}" ()
21  ret void
22}
23
24declare i32 @llvm.SI.tid() nounwind readnone
25