[PATCH] D15583: For CI, reserve enough sgprs for flat scratch init if VCC is not used

Changpeng Fang via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 12:10:03 PST 2015


cfang created this revision.
cfang added a subscriber: llvm-commits.
Herald added a reviewer: tstellarAMD.
Herald added a subscriber: arsenm.

For CI, if VCC is not used, we have to reserve 4 sgprs for flat scratch init.  

http://reviews.llvm.org/D15583

Files:
  lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  test/CodeGen/AMDGPU/ci-reserve-sgpr-for-flat-scratch-init.ll

Index: test/CodeGen/AMDGPU/ci-reserve-sgpr-for-flat-scratch-init.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AMDGPU/ci-reserve-sgpr-for-flat-scratch-init.ll
@@ -0,0 +1,14 @@
+; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri | FileCheck %s
+
+; CHECK: wavefront_sgpr_count = 10
+; CHECK-NOT: wavefront_sgpr_count = 8
+define spir_kernel void @test(i64 addrspace(1)* nocapture %arg, i32 %arg1, i32 %arg2) #0  {
+bb:
+  %tmp = add nsw i32 %arg1, 10
+  %tmp8 = add nsw i32 %tmp, %arg2
+  %tmp9 = sext i32 %tmp8 to i64
+  %tmp10 = add nsw i64 %tmp9, 22
+  %tmp11 = getelementptr inbounds i64, i64 addrspace(1)* %arg, i64 %tmp10
+  store i64 13, i64 addrspace(1)* %tmp11, align 8
+  ret void
+}
Index: lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -414,7 +414,7 @@
     }
   }
 
-  if (VCCUsed)
+  if (VCCUsed || FlatUsed)
     MaxSGPR += 2;
 
   if (FlatUsed)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15583.43047.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151216/224488a1/attachment.bin>


More information about the llvm-commits mailing list