Merging r260427:
[oota-llvm.git] / test / CodeGen / AMDGPU / spill-scavenge-offset.ll
1 ; RUN: llc -march=amdgcn -mcpu=verde < %s | FileCheck %s
2 ; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck %s
3
4 ; When the offset of VGPR spills into scratch space gets too large, an additional SGPR
5 ; is used to calculate the scratch load/store address. Make sure that this
6 ; mechanism works even when many spills happen.
7
8 ; Just test that it compiles successfully.
9 ; CHECK-LABEL: test
10 define void @test(<1280 x i32> addrspace(1)* %out, <1280 x i32> addrspace(1)* %in,
11                   <96 x i32> addrspace(1)* %sdata_out, <96 x i32> %sdata_in) {
12 entry:
13   %tid = call i32 @llvm.SI.tid() nounwind readnone
14
15   %aptr = getelementptr <1280 x i32>, <1280 x i32> addrspace(1)* %in, i32 %tid
16   %a = load <1280 x i32>, <1280 x i32> addrspace(1)* %aptr
17
18 ; mark most VGPR registers as used to increase register pressure
19   call void asm sideeffect "", "~{VGPR4},~{VGPR8},~{VGPR12},~{VGPR16},~{VGPR20},~{VGPR24},~{VGPR28},~{VGPR32}" ()
20   call void asm sideeffect "", "~{VGPR36},~{VGPR40},~{VGPR44},~{VGPR48},~{VGPR52},~{VGPR56},~{VGPR60},~{VGPR64}" ()
21   call void asm sideeffect "", "~{VGPR68},~{VGPR72},~{VGPR76},~{VGPR80},~{VGPR84},~{VGPR88},~{VGPR92},~{VGPR96}" ()
22   call void asm sideeffect "", "~{VGPR100},~{VGPR104},~{VGPR108},~{VGPR112},~{VGPR116},~{VGPR120},~{VGPR124},~{VGPR128}" ()
23   call void asm sideeffect "", "~{VGPR132},~{VGPR136},~{VGPR140},~{VGPR144},~{VGPR148},~{VGPR152},~{VGPR156},~{VGPR160}" ()
24   call void asm sideeffect "", "~{VGPR164},~{VGPR168},~{VGPR172},~{VGPR176},~{VGPR180},~{VGPR184},~{VGPR188},~{VGPR192}" ()
25   call void asm sideeffect "", "~{VGPR196},~{VGPR200},~{VGPR204},~{VGPR208},~{VGPR212},~{VGPR216},~{VGPR220},~{VGPR224}" ()
26
27   %outptr = getelementptr <1280 x i32>, <1280 x i32> addrspace(1)* %in, i32 %tid
28   store <1280 x i32> %a, <1280 x i32> addrspace(1)* %outptr
29
30   ret void
31 }
32
33 declare i32 @llvm.SI.tid() nounwind readnone