1// RUN: %clang_cc1 -cl-std=CL1.2 -cl-ext=+cl_khr_fp64 -fsyntax-only -verify %s 2// RUN: %clang_cc1 -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -fsyntax-only -verify %s 3 4typedef __attribute__((ext_vector_type(2))) float float2; 5typedef __attribute__((ext_vector_type(4))) float float4; 6 7typedef __attribute__((ext_vector_type(2))) int int2; 8typedef __attribute__((ext_vector_type(4))) int int4; 9typedef __attribute__((ext_vector_type(16))) int int16; 10 11int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2))); 12 13kernel void format_v4f32(float4 arg) 14{ 15#ifdef cl_khr_fp64 16 printf("%v4f\n", arg); 17 18 // Precision modifier 19 printf("%.2v4f\n", arg); 20#else 21 // FIXME: These should not warn, and the type should be expected to be float. 22 printf("%v4f\n", arg); // expected-warning {{double __attribute__((ext_vector_type(4)))' but the argument has type 'float4' (vector of 4 'float' values)}} 23 24 // Precision modifier 25 printf("%.2v4f\n", arg); // expected-warning {{double __attribute__((ext_vector_type(4)))' but the argument has type 'float4' (vector of 4 'float' values)}} 26#endif 27} 28 29kernel void format_only_v(int arg) 30{ 31 printf("%v", arg); // expected-warning {{incomplete format specifier}} 32} 33 34kernel void format_missing_num(int arg) 35{ 36 printf("%v4", arg); // expected-warning {{incomplete format specifier}} 37} 38 39kernel void format_not_num(int arg) 40{ 41 printf("%vNd", arg); // expected-warning {{incomplete format specifier}} 42 printf("%v*d", arg); // expected-warning {{incomplete format specifier}} 43} 44 45kernel void format_v16i32(int16 arg) 46{ 47 printf("%v16d\n", arg); 48} 49 50kernel void format_v4i32_scalar(int arg) 51{ 52 printf("%v4d\n", arg); // expected-warning {{format specifies type 'int __attribute__((ext_vector_type(4)))' but the argument has type 'int'}} 53} 54 55kernel void format_v4i32_wrong_num_elts_2_to_4(int2 arg) 56{ 57 printf("%v4d\n", arg); // expected-warning {{format specifies type 'int __attribute__((ext_vector_type(4)))' but the argument has type 'int2' (vector of 2 'int' values)}} 58} 59 60kernel void format_missing_num_elts_format(int4 arg) 61{ 62 printf("%vd\n", arg); // expected-warning {{incomplete format specifier}} 63} 64 65kernel void format_v4f32_scalar(float arg) 66{ 67 printf("%v4f\n", arg); // expected-warning {{format specifies type 'double __attribute__((ext_vector_type(4)))' but the argument has type 'float'}} 68} 69 70kernel void format_v4f32_wrong_num_elts(float2 arg) 71{ 72 printf("%v4f\n", arg); // expected-warning {{format specifies type 'double __attribute__((ext_vector_type(4)))' but the argument has type 'float2' (vector of 2 'float' values)}} 73} 74 75kernel void format_missing_num_elts(float4 arg) 76{ 77 printf("%vf\n", arg); // expected-warning {{incomplete format specifier}} 78} 79 80kernel void vector_precision_modifier_v4i32_to_v4f32(int4 arg) 81{ 82 printf("%.2v4f\n", arg); // expected-warning {{format specifies type 'double __attribute__((ext_vector_type(4)))' but the argument has type 'int4' (vector of 4 'int' values)}} 83} 84 85kernel void invalid_Y(int4 arg) 86{ 87 printf("%v4Y\n", arg); // expected-warning {{invalid conversion specifier 'Y'}} 88} 89 90// FIXME: This should warn 91kernel void crash_on_s(int4 arg) 92{ 93 printf("%v4s\n", arg); 94} 95