• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -triple r600-- -verify -fsyntax-only %s
2
3typedef __attribute__((amdgpu_num_vgpr(128))) struct FooStruct { // expected-error {{'amdgpu_num_vgpr' attribute only applies to kernel functions}}
4  int x;
5  float y;
6} FooStruct;
7
8
9__attribute__((amdgpu_num_vgpr("ABC"))) kernel void foo2() {} // expected-error {{'amdgpu_num_vgpr' attribute requires an integer constant}}
10__attribute__((amdgpu_num_sgpr("ABC"))) kernel void foo3() {} // expected-error {{'amdgpu_num_sgpr' attribute requires an integer constant}}
11
12
13__attribute__((amdgpu_num_vgpr(40))) void foo4() {} // expected-error {{'amdgpu_num_vgpr' attribute only applies to kernel functions}}
14__attribute__((amdgpu_num_sgpr(64))) void foo5() {} // expected-error {{'amdgpu_num_sgpr' attribute only applies to kernel functions}}
15
16__attribute__((amdgpu_num_vgpr(40))) kernel void foo7() {}
17__attribute__((amdgpu_num_sgpr(64))) kernel void foo8() {}
18__attribute__((amdgpu_num_vgpr(40), amdgpu_num_sgpr(64))) kernel void foo9() {}
19
20// Check 0 VGPR is accepted.
21__attribute__((amdgpu_num_vgpr(0))) kernel void foo10() {}
22
23// Check 0 SGPR is accepted.
24__attribute__((amdgpu_num_sgpr(0))) kernel void foo11() {}
25
26// Check both 0 SGPR and VGPR is accepted.
27__attribute__((amdgpu_num_vgpr(0), amdgpu_num_sgpr(0))) kernel void foo12() {}
28
29// Too large VGPR value.
30__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}}
31
32__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}}
33
34__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}}
35
36
37// Make sure it is accepted with kernel keyword before the attribute.
38kernel __attribute__((amdgpu_num_vgpr(40))) void foo16() {}
39
40kernel __attribute__((amdgpu_num_sgpr(40))) void foo17() {}
41