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