62 lines · plain
1// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 1002// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100 -cl-std=CL1.23// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100 -cl-std=CL3.0 -cl-ext=-__opencl_c_device_enqueue,-__opencl_c_generic_address_space,-__opencl_c_pipes4 5// Confirm CL2.0 Clang builtins are not available in earlier versions and in OpenCL C 3.0 without required features.6 7kernel void dse_builtins(void) {8 int tmp;9 enqueue_kernel(tmp, tmp, tmp, ^(void) { // expected-error{{use of undeclared identifier 'enqueue_kernel'}}10 return;11 });12 unsigned size = get_kernel_work_group_size(^(void) { // expected-error{{use of undeclared identifier 'get_kernel_work_group_size'}}13 return;14 });15 size = get_kernel_preferred_work_group_size_multiple(^(void) { // expected-error{{use of undeclared identifier 'get_kernel_preferred_work_group_size_multiple'}}16 return;17 });18#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0) && !defined(__opencl_c_device_enqueue)19// expected-error@-10{{support disabled - compile with -fblocks or for OpenCL C 2.0 or OpenCL C 3.0 with __opencl_c_device_enqueue feature}}20// expected-error@-8 {{support disabled - compile with -fblocks or for OpenCL C 2.0 or OpenCL C 3.0 with __opencl_c_device_enqueue feature}}21// expected-error@-6 {{support disabled - compile with -fblocks or for OpenCL C 2.0 or OpenCL C 3.0 with __opencl_c_device_enqueue feature}}22#endif23}24 25void pipe_builtins(void) {26 int tmp;27 28 // FIXME: the typo correction for this case goes off the rails and tries to29 // convert this mistake into a for loop instead of a local function30 // declaration.31 foo(void); // expected-error{{use of undeclared identifier 'foo'; did you mean 'for'?}}32 // expected-error@-1{{expected identifier or '('}}33 // expected-note@-2{{to match this '('}}34 boo(); // expected-error{{use of undeclared identifier 'boo'}}35 // expected-error@-1{{expected ';' in 'for' statement specifier}}36 37 read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'read_pipe'}}38 // expected-error@-1{{expected ')'}}39 write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'write_pipe'}}40 41 reserve_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'reserve_read_pipe'}}42 reserve_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'reserve_write_pipe'}}43 44 work_group_reserve_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_reserve_read_pipe'}}45 work_group_reserve_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_reserve_write_pipe'}}46 47 sub_group_reserve_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_reserve_write_pipe'}}48 sub_group_reserve_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_reserve_read_pipe'}}49 50 commit_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'commit_read_pipe'}}51 commit_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'commit_write_pipe'}}52 53 work_group_commit_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_commit_read_pipe'}}54 work_group_commit_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_commit_write_pipe'}}55 56 sub_group_commit_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_commit_write_pipe'}}57 sub_group_commit_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_commit_read_pipe'}}58 59 get_pipe_num_packets(tmp); // expected-error{{use of undeclared identifier 'get_pipe_num_packets'}}60 get_pipe_max_packets(tmp); // expected-error{{use of undeclared identifier 'get_pipe_max_packets'}}61}62