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