Home | History | Annotate | Download | only in SemaOpenCL
      1 //RUN: %clang_cc1 -O0 -fsyntax-only -verify %s
      2 //RUN: %clang_cc1 -O0 -cl-std=CL2.0 -fsyntax-only -verify -DCL20 %s
      3 
      4 kernel void D (global int *x) {
      5   int i = 10;
      6 #ifndef CL20
      7   // expected-error@+2 {{'opencl_unroll_hint' attribute requires OpenCL version 2.0 or above}}
      8 #endif
      9   __attribute__((opencl_unroll_hint))
     10   do {
     11   } while(i--);
     12 }
     13 
     14 #ifdef CL20
     15 kernel void C (global int *x) {
     16   int I = 3;
     17   __attribute__((opencl_unroll_hint(I))) // expected-error {{'opencl_unroll_hint' attribute requires an integer constant}}
     18   while (I--);
     19 }
     20 
     21 kernel void E() {
     22   __attribute__((opencl_unroll_hint(2,4))) // expected-error {{'opencl_unroll_hint' attribute takes no more than 1 argument}}
     23   for(int i=0; i<100; i++);
     24 }
     25 
     26 kernel void F() {
     27   __attribute__((opencl_unroll_hint(-1))) // expected-error {{'opencl_unroll_hint' attribute requires a positive integral compile time constant expression}}
     28   for(int i=0; i<100; i++);
     29 }
     30 #endif
     31