| 1 |
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups |
| 2 |
|
| 3 |
#pragma OPENCL EXTENSION cl_khr_subgroups : enable |
| 4 |
|
| 5 |
void test1(read_only pipe int p, global int* ptr){ |
| 6 |
int tmp; |
| 7 |
reserve_id_t rid; |
| 8 |
|
| 9 |
// read/write_pipe |
| 10 |
read_pipe(p, &tmp); |
| 11 |
read_pipe(p, ptr); |
| 12 |
read_pipe(tmp, p); // expected-error {{first argument to 'read_pipe' must be a pipe type}} |
| 13 |
read_pipe(p); // expected-error {{invalid number of arguments to function: 'read_pipe'}} |
| 14 |
read_pipe(p, rid, tmp, ptr); |
| 15 |
read_pipe(p, tmp, tmp, ptr); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'reserve_id_t' having '__private int')}} |
| 16 |
read_pipe(p, rid, rid, ptr); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}} |
| 17 |
read_pipe(p, tmp); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'int *' having '__private int')}} |
| 18 |
write_pipe(p, ptr); // expected-error {{invalid pipe access modifier (expecting write_only)}} |
| 19 |
write_pipe(p, rid, tmp, ptr); // expected-error {{invalid pipe access modifier (expecting write_only)}} |
| 20 |
|
| 21 |
// reserve_read/write_pipe |
| 22 |
reserve_read_pipe(p, tmp); |
| 23 |
reserve_read_pipe(p, ptr); // expected-error{{invalid argument type to function 'reserve_read_pipe' (expecting 'unsigned int' having '__global int *__private')}} |
| 24 |
work_group_reserve_read_pipe(tmp, tmp); // expected-error{{first argument to 'work_group_reserve_read_pipe' must be a pipe type}} |
| 25 |
sub_group_reserve_write_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting write_only)}} |
| 26 |
|
| 27 |
// commit_read/write_pipe |
| 28 |
commit_read_pipe(p, rid); |
| 29 |
commit_read_pipe(tmp, rid); // expected-error{{first argument to 'commit_read_pipe' must be a pipe type}} |
| 30 |
work_group_commit_read_pipe(p, tmp); // expected-error{{invalid argument type to function 'work_group_commit_read_pipe' (expecting 'reserve_id_t' having '__private int')}} |
| 31 |
sub_group_commit_write_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting write_only)}} |
| 32 |
} |
| 33 |
|
| 34 |
void test2(write_only pipe int p, global int* ptr){ |
| 35 |
int tmp; |
| 36 |
reserve_id_t rid; |
| 37 |
|
| 38 |
// read/write_pipe |
| 39 |
write_pipe(p, &tmp); |
| 40 |
write_pipe(p, ptr); |
| 41 |
write_pipe(tmp, p); // expected-error {{first argument to 'write_pipe' must be a pipe type}} |
| 42 |
write_pipe(p); // expected-error {{invalid number of arguments to function: 'write_pipe'}} |
| 43 |
write_pipe(p, rid, tmp, ptr); |
| 44 |
write_pipe(p, tmp, tmp, ptr); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'reserve_id_t' having '__private int')}} |
| 45 |
write_pipe(p, rid, rid, ptr); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}} |
| 46 |
write_pipe(p, tmp); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'int *' having '__private int')}} |
| 47 |
read_pipe(p, ptr); // expected-error {{invalid pipe access modifier (expecting read_only)}} |
| 48 |
read_pipe(p, rid, tmp, ptr); // expected-error {{invalid pipe access modifier (expecting read_only)}} |
| 49 |
|
| 50 |
// reserve_read/write_pipe |
| 51 |
reserve_write_pipe(p, tmp); |
| 52 |
reserve_write_pipe(p, ptr); // expected-error{{invalid argument type to function 'reserve_write_pipe' (expecting 'unsigned int' having '__global int *__private')}} |
| 53 |
work_group_reserve_write_pipe(tmp, tmp); // expected-error{{first argument to 'work_group_reserve_write_pipe' must be a pipe type}} |
| 54 |
sub_group_reserve_read_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting read_only)}} |
| 55 |
|
| 56 |
// commit_read/write_pipe |
| 57 |
commit_write_pipe(p, rid); |
| 58 |
commit_write_pipe(tmp, rid); // expected-error{{first argument to 'commit_write_pipe' must be a pipe type}} |
| 59 |
work_group_commit_write_pipe(p, tmp); // expected-error{{invalid argument type to function 'work_group_commit_write_pipe' (expecting 'reserve_id_t' having '__private int')}} |
| 60 |
sub_group_commit_read_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting read_only)}} |
| 61 |
} |
| 62 |
|
| 63 |
void test3(void){ |
| 64 |
int tmp; |
| 65 |
get_pipe_num_packets(tmp); // expected-error {{first argument to 'get_pipe_num_packets' must be a pipe type}} |
| 66 |
get_pipe_max_packets(tmp); // expected-error {{first argument to 'get_pipe_max_packets' must be a pipe type}} |
| 67 |
} |