1// RUN: %clang_cc1 %s -verify -cl-std=CL1.1 -triple x86_64-unknown-linux-gnu 2// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu 3// RUN: %clang_cc1 %s -verify -cl-std=CL2.0 -triple x86_64-unknown-linux-gnu 4 5#pragma OPENCL EXTENSION cl_khr_fp64 : enable 6 7typedef __attribute__((ext_vector_type(4))) float float4; 8typedef __attribute__((ext_vector_type(4))) double double4; 9typedef __attribute__((ext_vector_type(4))) int int4; 10typedef __attribute__((ext_vector_type(4))) long long4; 11 12kernel void float_ops() { 13 int flaf = 0.0f && 0.0f; 14#if __OPENCL_C_VERSION__ < 120 15// expected-error@-2{{invalid operands}} 16#endif 17 int flof = 0.0f || 0.0f; 18#if __OPENCL_C_VERSION__ < 120 19// expected-error@-2{{invalid operands}} 20#endif 21 float fbaf = 0.0f & 0.0f; // expected-error {{invalid operands}} 22 float fbof = 0.0f | 0.0f; // expected-error {{invalid operands}} 23 float fbxf = 0.0f ^ 0.0f; // expected-error {{invalid operands}} 24 int flai = 0.0f && 0; 25#if __OPENCL_C_VERSION__ < 120 26// expected-error@-2{{invalid operands}} 27#endif 28 int floi = 0.0f || 0; 29#if __OPENCL_C_VERSION__ < 120 30// expected-error@-2{{invalid operands}} 31#endif 32 float ibaf = 0 & 0.0f; // expected-error {{invalid operands to binary expression ('int' and 'float')}} 33 float ibof = 0 | 0.0f; // expected-error {{invalid operands}} 34 float bnf = ~0.0f;// expected-error {{invalid argument type}} 35 float lnf = !0.0f; 36#if __OPENCL_C_VERSION__ < 120 37// expected-error@-2{{invalid argument type}} 38#endif 39} 40 41kernel void vec_float_ops() { 42 float4 f4 = (float4)(0, 0, 0, 0); 43 int4 f4laf = f4 && 0.0f; 44#if __OPENCL_C_VERSION__ < 120 45// expected-error@-2{{invalid operands}} 46#endif 47 int4 f4lof = f4 || 0.0f; 48#if __OPENCL_C_VERSION__ < 120 49// expected-error@-2{{invalid operands}} 50#endif 51 float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}} 52 float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}} 53 float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}} 54 float bnf4 = ~f4; // expected-error {{invalid argument type}} 55 int4 lnf4 = !f4; 56#if __OPENCL_C_VERSION__ < 120 57// expected-error@-2{{invalid argument type}} 58#endif 59} 60 61kernel void double_ops() { 62 int flaf = 0.0 && 0.0; 63#if __OPENCL_C_VERSION__ < 120 64// expected-error@-2{{invalid operands}} 65#endif 66 int flof = 0.0 || 0.0; 67#if __OPENCL_C_VERSION__ < 120 68// expected-error@-2{{invalid operands}} 69#endif 70 double fbaf = 0.0 & 0.0; // expected-error {{invalid operands}} 71 double fbof = 0.0 | 0.0; // expected-error {{invalid operands}} 72 double fbxf = 0.0 ^ 0.0; // expected-error {{invalid operands}} 73 int flai = 0.0 && 0; 74#if __OPENCL_C_VERSION__ < 120 75// expected-error@-2{{invalid operands}} 76#endif 77 int floi = 0.0 || 0; 78#if __OPENCL_C_VERSION__ < 120 79// expected-error@-2{{invalid operands}} 80#endif 81 double ibaf = 0 & 0.0; // expected-error {{invalid operands}} 82 double ibof = 0 | 0.0; // expected-error {{invalid operands}} 83 double bnf = ~0.0; // expected-error {{invalid argument type}} 84 double lnf = !0.0; 85#if __OPENCL_C_VERSION__ < 120 86// expected-error@-2{{invalid argument type}} 87#endif 88} 89 90kernel void vec_double_ops() { 91 double4 f4 = (double4)(0, 0, 0, 0); 92 long4 f4laf = f4 && 0.0; 93#if __OPENCL_C_VERSION__ < 120 94// expected-error@-2{{invalid operands}} 95#endif 96 long4 f4lof = f4 || 0.0; 97#if __OPENCL_C_VERSION__ < 120 98// expected-error@-2{{invalid operands}} 99#endif 100 double4 f4baf = f4 & 0.0; // expected-error {{invalid operands}} 101 double4 f4bof = f4 | 0.0; // expected-error {{invalid operands}} 102 double4 f4bxf = f4 ^ 0.0; // expected-error {{invalid operands}} 103 double bnf4 = ~f4; // expected-error {{invalid argument type}} 104 long4 lnf4 = !f4; 105#if __OPENCL_C_VERSION__ < 120 106// expected-error@-2{{invalid argument type}} 107#endif 108} 109 110kernel void pointer_ops(){ 111 global int* p; 112 bool b = !p; 113 b = p==0; 114 int i; 115 b = !&i; 116 b = &i==(int *)1; 117} 118