Home | History | Annotate | Download | only in SemaOpenCL
      1 // RUN: %clang_cc1 -triple r600-- -verify -fsyntax-only %s
      2 
      3 typedef __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.
     38 kernel __attribute__((amdgpu_num_vgpr(40))) void foo16() {}
     39 
     40 kernel __attribute__((amdgpu_num_sgpr(40))) void foo17() {}
     41