diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-12-04 20:38:18 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-12-04 20:38:18 +0000 |
commit | 501dbb269dd6ec400bb03513e3f0ddf2f061f4de (patch) | |
tree | b12c9980f56f7b8a6d34fe233c57e37c04e84460 /test/SemaOpenCL | |
parent | 614136357f2854a600e2b358becd615a9671929e (diff) |
Add attributes for AMDGPU register limits.
This is a performance hint that can be applied to kernels
to attempt to limit the number of used registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r-- | test/SemaOpenCL/amdgpu-num-register-attrs.cl | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/SemaOpenCL/amdgpu-num-register-attrs.cl b/test/SemaOpenCL/amdgpu-num-register-attrs.cl new file mode 100644 index 0000000000..0967700d10 --- /dev/null +++ b/test/SemaOpenCL/amdgpu-num-register-attrs.cl @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple r600-- -verify -fsyntax-only %s + +typedef __attribute__((amdgpu_num_vgpr(128))) struct FooStruct { // expected-error {{'amdgpu_num_vgpr' attribute only applies to kernel functions}} + int x; + float y; +} FooStruct; + + +__attribute__((amdgpu_num_vgpr("ABC"))) kernel void foo2() {} // expected-error {{'amdgpu_num_vgpr' attribute requires an integer constant}} +__attribute__((amdgpu_num_sgpr("ABC"))) kernel void foo3() {} // expected-error {{'amdgpu_num_sgpr' attribute requires an integer constant}} + + +__attribute__((amdgpu_num_vgpr(40))) void foo4() {} // expected-error {{'amdgpu_num_vgpr' attribute only applies to kernel functions}} +__attribute__((amdgpu_num_sgpr(64))) void foo5() {} // expected-error {{'amdgpu_num_sgpr' attribute only applies to kernel functions}} + +__attribute__((amdgpu_num_vgpr(40))) kernel void foo7() {} +__attribute__((amdgpu_num_sgpr(64))) kernel void foo8() {} +__attribute__((amdgpu_num_vgpr(40), amdgpu_num_sgpr(64))) kernel void foo9() {} + +// Check 0 VGPR is accepted. +__attribute__((amdgpu_num_vgpr(0))) kernel void foo10() {} + +// Check 0 SGPR is accepted. +__attribute__((amdgpu_num_sgpr(0))) kernel void foo11() {} + +// Check both 0 SGPR and VGPR is accepted. +__attribute__((amdgpu_num_vgpr(0), amdgpu_num_sgpr(0))) kernel void foo12() {} + +// Too large VGPR value. +__attribute__((amdgpu_num_vgpr(4294967296))) kernel void foo13() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} + +__attribute__((amdgpu_num_sgpr(4294967296))) kernel void foo14() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} + +__attribute__((amdgpu_num_sgpr(4294967296), amdgpu_num_vgpr(4294967296))) kernel void foo15() {} // expected-error 2 {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} |