2017-07-31 23:50:27 +08:00
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
2016-01-26 12:03:48 +08:00
2017-07-31 23:15:59 +08:00
# pragma OPENCL EXTENSION cl_khr_subgroups : enable
2016-01-26 12:03:48 +08:00
void test1 ( read_only pipe int p, global int* ptr ) {
int tmp ;
reserve_id_t rid ;
// read/write_pipe
2016-03-30 12:46:32 +08:00
read_pipe ( p, &tmp ) ;
read_pipe ( p, ptr ) ;
2016-03-04 15:11:16 +08:00
read_pipe ( tmp, p ) ; // expected-error {{first argument to 'read_pipe' must be a pipe type}}
read_pipe ( p ) ; // expected-error {{invalid number of arguments to function: 'read_pipe'}}
2016-03-30 12:46:32 +08:00
read_pipe ( p, rid, tmp, ptr ) ;
read_pipe ( p, tmp, tmp, ptr ) ; // expected-error {{invalid argument type to function 'read_pipe' (expecting 'reserve_id_t' having 'int')}}
read_pipe ( p, rid, rid, ptr ) ; // expected-error {{invalid argument type to function 'read_pipe' (expecting 'unsigned int' having 'reserve_id_t')}}
read_pipe ( p, tmp ) ; // expected-error {{invalid argument type to function 'read_pipe' (expecting 'int *' having 'int')}}
2016-01-26 12:03:48 +08:00
write_pipe ( p, ptr ) ; // expected-error {{invalid pipe access modifier (expecting write_only)}}
write_pipe ( p, rid, tmp, ptr ) ; // expected-error {{invalid pipe access modifier (expecting write_only)}}
// reserve_read/write_pipe
2016-03-30 12:46:32 +08:00
reserve_read_pipe ( p, tmp ) ;
reserve_read_pipe ( p, ptr ) ; // expected-error{{invalid argument type to function 'reserve_read_pipe' (expecting 'unsigned int' having '__global int *')}}
2016-03-04 15:11:16 +08:00
work_group_reserve_read_pipe ( tmp, tmp ) ; // expected-error{{first argument to 'work_group_reserve_read_pipe' must be a pipe type}}
2016-01-26 12:03:48 +08:00
sub_group_reserve_write_pipe ( p, tmp ) ; // expected-error{{invalid pipe access modifier (expecting write_only)}}
// commit_read/write_pipe
2016-03-30 12:46:32 +08:00
commit_read_pipe ( p, rid ) ;
2016-03-04 15:11:16 +08:00
commit_read_pipe ( tmp, rid ) ; // expected-error{{first argument to 'commit_read_pipe' must be a pipe type}}
2016-03-30 12:46:32 +08:00
work_group_commit_read_pipe ( p, tmp ) ; // expected-error{{invalid argument type to function 'work_group_commit_read_pipe' (expecting 'reserve_id_t' having 'int')}}
2016-02-26 11:13:03 +08:00
sub_group_commit_write_pipe ( p, tmp ) ; // expected-error{{invalid pipe access modifier (expecting write_only)}}
2016-01-26 12:03:48 +08:00
}
void test2 ( write_only pipe int p, global int* ptr ) {
int tmp ;
reserve_id_t rid ;
// read/write_pipe
2016-03-30 12:46:32 +08:00
write_pipe ( p, &tmp ) ;
write_pipe ( p, ptr ) ;
2016-03-04 15:11:16 +08:00
write_pipe ( tmp, p ) ; // expected-error {{first argument to 'write_pipe' must be a pipe type}}
write_pipe ( p ) ; // expected-error {{invalid number of arguments to function: 'write_pipe'}}
2016-03-30 12:46:32 +08:00
write_pipe ( p, rid, tmp, ptr ) ;
write_pipe ( p, tmp, tmp, ptr ) ; // expected-error {{invalid argument type to function 'write_pipe' (expecting 'reserve_id_t' having 'int')}}
write_pipe ( p, rid, rid, ptr ) ; // expected-error {{invalid argument type to function 'write_pipe' (expecting 'unsigned int' having 'reserve_id_t')}}
write_pipe ( p, tmp ) ; // expected-error {{invalid argument type to function 'write_pipe' (expecting 'int *' having 'int')}}
2016-01-26 12:03:48 +08:00
read_pipe ( p, ptr ) ; // expected-error {{invalid pipe access modifier (expecting read_only)}}
read_pipe ( p, rid, tmp, ptr ) ; // expected-error {{invalid pipe access modifier (expecting read_only)}}
// reserve_read/write_pipe
2016-03-30 12:46:32 +08:00
reserve_write_pipe ( p, tmp ) ;
reserve_write_pipe ( p, ptr ) ; // expected-error{{invalid argument type to function 'reserve_write_pipe' (expecting 'unsigned int' having '__global int *')}}
2016-03-04 15:11:16 +08:00
work_group_reserve_write_pipe ( tmp, tmp ) ; // expected-error{{first argument to 'work_group_reserve_write_pipe' must be a pipe type}}
2016-01-26 12:03:48 +08:00
sub_group_reserve_read_pipe ( p, tmp ) ; // expected-error{{invalid pipe access modifier (expecting read_only)}}
// commit_read/write_pipe
2016-03-30 12:46:32 +08:00
commit_write_pipe ( p, rid ) ;
2016-03-04 15:11:16 +08:00
commit_write_pipe ( tmp, rid ) ; // expected-error{{first argument to 'commit_write_pipe' must be a pipe type}}
2016-03-30 12:46:32 +08:00
work_group_commit_write_pipe ( p, tmp ) ; // expected-error{{invalid argument type to function 'work_group_commit_write_pipe' (expecting 'reserve_id_t' having 'int')}}
2016-02-26 11:13:03 +08:00
sub_group_commit_read_pipe ( p, tmp ) ; // expected-error{{invalid pipe access modifier (expecting read_only)}}
2016-01-26 12:03:48 +08:00
}
void test3 ( ) {
int tmp ;
2016-03-04 15:11:16 +08:00
get_pipe_num_packets ( tmp ) ; // expected-error {{first argument to 'get_pipe_num_packets' must be a pipe type}}
get_pipe_max_packets ( tmp ) ; // expected-error {{first argument to 'get_pipe_max_packets' must be a pipe type}}
2016-01-26 12:03:48 +08:00
}