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