Matt Arsenault | 08906a3 | 2016-10-28 19:43:31 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck --check-prefix=TONGA %s |
Nicolai Haehnle | 6035504 | 2016-01-05 20:42:49 +0000 | [diff] [blame] | 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 |
Matt Arsenault | 3dbeefa | 2017-03-21 21:39:51 +0000 | [diff] [blame] | 7 | define amdgpu_kernel void @test(<256 x i32> addrspace(1)* %out, <256 x i32> addrspace(1)* %in) { |
Nicolai Haehnle | 6035504 | 2016-01-05 20:42:49 +0000 | [diff] [blame] | 8 | entry: |
Matt Arsenault | 8885910 | 2016-06-17 21:18:41 +0000 | [diff] [blame] | 9 | %mbcnt.lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0) |
| 10 | %tid = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %mbcnt.lo) |
Nicolai Haehnle | 6035504 | 2016-01-05 20:42:49 +0000 | [diff] [blame] | 11 | %aptr = getelementptr <256 x i32>, <256 x i32> addrspace(1)* %in, i32 %tid |
| 12 | %a = load <256 x i32>, <256 x i32> addrspace(1)* %aptr |
| 13 | call void asm sideeffect "", "~{memory}" () |
| 14 | %outptr = getelementptr <256 x i32>, <256 x i32> addrspace(1)* %in, i32 %tid |
| 15 | store <256 x i32> %a, <256 x i32> addrspace(1)* %outptr |
| 16 | |
| 17 | ; mark 128-bit SGPR registers as used so they are unavailable for the |
| 18 | ; scratch resource descriptor |
| 19 | call void asm sideeffect "", "~{SGPR4},~{SGPR8},~{SGPR12},~{SGPR16},~{SGPR20},~{SGPR24},~{SGPR28}" () |
| 20 | call void asm sideeffect "", "~{SGPR32},~{SGPR36},~{SGPR40},~{SGPR44},~{SGPR48},~{SGPR52},~{SGPR56}" () |
| 21 | call void asm sideeffect "", "~{SGPR60},~{SGPR64},~{SGPR68}" () |
| 22 | ret void |
| 23 | } |
| 24 | |
Matt Arsenault | 8885910 | 2016-06-17 21:18:41 +0000 | [diff] [blame] | 25 | declare i32 @llvm.amdgcn.mbcnt.lo(i32, i32) #0 |
| 26 | declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #0 |
| 27 | |
| 28 | attributes #0 = { nounwind readnone } |