1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

AMDGPU/SI: Reserve appropriate number of sgprs for flat scratch init.

Reviewers: tstellarAMD

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D15583

Patch by: Changpeng Fang

llvm-svn: 255908
This commit is contained in:
Tom Stellard 2015-12-17 17:05:09 +00:00
parent 5b0b47c0c0
commit 1082b7a8c0
2 changed files with 42 additions and 2 deletions

View File

@ -417,11 +417,15 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
} }
} }
if (VCCUsed) if (VCCUsed || FlatUsed)
MaxSGPR += 2; MaxSGPR += 2;
if (FlatUsed) if (FlatUsed) {
MaxSGPR += 2; MaxSGPR += 2;
// 2 additional for VI+.
if (STM.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS)
MaxSGPR += 2;
}
// We found the maximum register index. They start at 0, so add one to get the // We found the maximum register index. They start at 0, so add one to get the
// number of registers. // number of registers.

View File

@ -0,0 +1,36 @@
; RUN: llc < %s -march=amdgcn -mcpu=kaveri -verify-machineinstrs | FileCheck %s --check-prefix=GCN --check-prefix=CI
; RUN: llc < %s -march=amdgcn -mcpu=fiji -verify-machineinstrs | FileCheck %s --check-prefix=GCN --check-prefix=VI
; GCN-LABEL: {{^}}no_vcc_no_flat:
; GCN: ; NumSgprs: 8
define void @no_vcc_no_flat() {
entry:
call void asm sideeffect "", "~{SGPR7}"()
ret void
}
; GCN-LABEL: {{^}}vcc_no_flat:
; GCN: ; NumSgprs: 10
define void @vcc_no_flat() {
entry:
call void asm sideeffect "", "~{SGPR7},~{VCC}"()
ret void
}
; GCN-LABEL: {{^}}no_vcc_flat:
; CI: ; NumSgprs: 12
; VI: ; NumSgprs: 14
define void @no_vcc_flat() {
entry:
call void asm sideeffect "", "~{SGPR7},~{FLAT_SCR}"()
ret void
}
; GCN-LABEL: {{^}}vcc_flat:
; CI: ; NumSgprs: 12
; VI: ; NumSgprs: 14
define void @vcc_flat() {
entry:
call void asm sideeffect "", "~{SGPR7},~{VCC},~{FLAT_SCR}"()
ret void
}