[llvm] r255908 - AMDGPU/SI: Reserve appropriate number of sgprs for flat scratch init.
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 17 09:05:09 PST 2015
Author: tstellar
Date: Thu Dec 17 11:05:09 2015
New Revision: 255908
URL: http://llvm.org/viewvc/llvm-project?rev=255908&view=rev
Log:
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
Added:
llvm/trunk/test/CodeGen/AMDGPU/flat-scratch-reg.ll
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp?rev=255908&r1=255907&r2=255908&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp Thu Dec 17 11:05:09 2015
@@ -417,11 +417,15 @@ void AMDGPUAsmPrinter::getSIProgramInfo(
}
}
- if (VCCUsed)
+ if (VCCUsed || FlatUsed)
MaxSGPR += 2;
- if (FlatUsed)
+ if (FlatUsed) {
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
// number of registers.
Added: llvm/trunk/test/CodeGen/AMDGPU/flat-scratch-reg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/flat-scratch-reg.ll?rev=255908&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/flat-scratch-reg.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/flat-scratch-reg.ll Thu Dec 17 11:05:09 2015
@@ -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
+}
More information about the llvm-commits
mailing list