[PATCH] D19918: AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels.
Nikolay Haustov via cfe-commits
cfe-commits at lists.llvm.org
Fri May 6 02:21:24 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268718: AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels. (authored by nhaustov).
Changed prior to commit:
http://reviews.llvm.org/D19918?vs=56141&id=56389#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19918
Files:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
===================================================================
--- cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
@@ -0,0 +1,12 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel()
+kernel void calling_conv_amdgpu_kernel()
+{
+}
+
+// CHECK: define void @calling_conv_none()
+void calling_conv_none()
+{
+}
Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
===================================================================
--- cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
@@ -5,23 +5,23 @@
__attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics
kernel void test_num_vgpr64() {
-// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]]
}
__attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics
kernel void test_num_sgpr32() {
-// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]]
}
__attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics
kernel void test_num_vgpr64_sgpr32() {
-// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]]
}
__attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics
kernel void test_num_sgpr20_vgpr40() {
-// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]]
}
__attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics
Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -6826,6 +6826,14 @@
if (!FD)
return;
+ if (M.getLangOpts().OpenCL) {
+ if (FD->hasAttr<OpenCLKernelAttr>()) {
+ // Set amdgpu_kernel calling convention for OpenCL kernels.
+ llvm::Function *Fn = cast<llvm::Function>(GV);
+ Fn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
+ }
+ }
+
if (const auto Attr = FD->getAttr<AMDGPUNumVGPRAttr>()) {
llvm::Function *F = cast<llvm::Function>(GV);
uint32_t NumVGPR = Attr->getNumVGPR();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19918.56389.patch
Type: text/x-patch
Size: 2684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160506/b20ef9ea/attachment-0001.bin>
More information about the cfe-commits
mailing list