xref: /aosp_15_r20/external/clang/test/SemaOpenCL/invalid-kernel-attrs.cl (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -verify %s
2*67e74705SXin Li
3*67e74705SXin Likernel __attribute__((vec_type_hint)) void kernel1() {} //expected-error{{'vec_type_hint' attribute takes one argument}}
4*67e74705SXin Li
5*67e74705SXin Likernel __attribute__((vec_type_hint(not_type))) void kernel2() {} //expected-error{{unknown type name 'not_type'}}
6*67e74705SXin Li
7*67e74705SXin Likernel __attribute__((vec_type_hint(void))) void kernel3() {} //expected-error{{invalid attribute argument 'void' - expecting a vector or vectorizable scalar type}}
8*67e74705SXin Li
9*67e74705SXin Likernel __attribute__((vec_type_hint(bool))) void kernel4() {} //expected-error{{invalid attribute argument 'bool' - expecting a vector or vectorizable scalar type}}
10*67e74705SXin Li
11*67e74705SXin Likernel __attribute__((vec_type_hint(int))) __attribute__((vec_type_hint(float))) void kernel5() {} //expected-warning{{attribute 'vec_type_hint' is already applied with different parameters}}
12*67e74705SXin Li
13*67e74705SXin Likernel __attribute__((work_group_size_hint(8,16,32,4))) void kernel6() {} //expected-error{{'work_group_size_hint' attribute requires exactly 3 arguments}}
14*67e74705SXin Li
15*67e74705SXin Likernel __attribute__((work_group_size_hint(1,2,3))) __attribute__((work_group_size_hint(3,2,1))) void kernel7() {}  //expected-warning{{attribute 'work_group_size_hint' is already applied with different parameters}}
16*67e74705SXin Li
17*67e74705SXin Li__attribute__((reqd_work_group_size(8,16,32))) void kernel8(){} // expected-error {{attribute 'reqd_work_group_size' can only be applied to a kernel}}
18*67e74705SXin Li
19*67e74705SXin Li__attribute__((work_group_size_hint(8,16,32))) void kernel9(){} // expected-error {{attribute 'work_group_size_hint' can only be applied to a kernel}}
20*67e74705SXin Li
21*67e74705SXin Li__attribute__((vec_type_hint(char))) void kernel10(){} // expected-error {{attribute 'vec_type_hint' can only be applied to a kernel}}
22*67e74705SXin Li
23*67e74705SXin Liconstant int foo1 __attribute__((reqd_work_group_size(8,16,32))) = 0; // expected-error {{'reqd_work_group_size' attribute only applies to functions}}
24*67e74705SXin Li
25*67e74705SXin Liconstant int foo2 __attribute__((work_group_size_hint(8,16,32))) = 0; // expected-error {{'work_group_size_hint' attribute only applies to functions}}
26*67e74705SXin Li
27*67e74705SXin Liconstant int foo3 __attribute__((vec_type_hint(char))) = 0; // expected-error {{'vec_type_hint' attribute only applies to functions}}
28*67e74705SXin Li
29*67e74705SXin Livoid f_kernel_image2d_t( kernel image2d_t image ) { // expected-error {{'kernel' attribute only applies to functions}}
30*67e74705SXin Li  int __kernel x; // expected-error {{'__kernel' attribute only applies to functions}}
31*67e74705SXin Li}
32*67e74705SXin Li
33*67e74705SXin Likernel __attribute__((reqd_work_group_size(1,2,0))) void kernel11(){} // expected-error {{'reqd_work_group_size' attribute must be greater than 0}}
34*67e74705SXin Likernel __attribute__((reqd_work_group_size(1,0,2))) void kernel12(){} // expected-error {{'reqd_work_group_size' attribute must be greater than 0}}
35*67e74705SXin Likernel __attribute__((reqd_work_group_size(0,1,2))) void kernel13(){} // expected-error {{'reqd_work_group_size' attribute must be greater than 0}}
36