1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

R600/SI: Fix off by 1 error in used register count

The register numbers start at 0, so if only 1 register
was used, this was reported as 0.

llvm-svn: 217636
This commit is contained in:
Matt Arsenault 2014-09-11 22:51:37 +00:00
parent 5eb80e92d1
commit 0d246062cd
2 changed files with 12 additions and 3 deletions

View File

@ -322,8 +322,10 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
if (VCCUsed)
MaxSGPR += 2;
ProgInfo.NumVGPR = MaxVGPR;
ProgInfo.NumSGPR = MaxSGPR;
// We found the maximum register index. They start at 0, so add one to get the
// number of registers.
ProgInfo.NumVGPR = MaxVGPR + 1;
ProgInfo.NumSGPR = MaxSGPR + 1;
// Set the value to initialize FP_ROUND and FP_DENORM parts of the mode
// register.

View File

@ -1,4 +1,4 @@
; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs -asm-verbose < %s | FileCheck -check-prefix=SI %s
declare i32 @llvm.SI.tid() nounwind readnone
@ -18,3 +18,10 @@ define void @foo(i32 addrspace(1)* noalias %out, i32 addrspace(1)* %abase, i32 a
store i32 %result, i32 addrspace(1)* %outptr, align 4
ret void
}
; SI-LABEL: @one_vgpr_used
; SI: NumVgprs: 1
define void @one_vgpr_used(i32 addrspace(1)* %out, i32 %x) nounwind {
store i32 %x, i32 addrspace(1)* %out, align 4
ret void
}