2017-02-08 00:09:41 +08:00
|
|
|
// RUN: %clang_cc1 %s -verify -cl-std=CL1.1 -triple x86_64-unknown-linux-gnu
|
2013-02-21 21:42:33 +08:00
|
|
|
// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu
|
2017-02-08 00:09:41 +08:00
|
|
|
// RUN: %clang_cc1 %s -verify -cl-std=CL2.0 -triple x86_64-unknown-linux-gnu
|
2013-02-21 19:49:56 +08:00
|
|
|
|
2016-06-02 02:04:53 +08:00
|
|
|
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
2016-05-17 01:06:34 +08:00
|
|
|
|
2013-02-21 19:49:56 +08:00
|
|
|
typedef __attribute__((ext_vector_type(4))) float float4;
|
|
|
|
typedef __attribute__((ext_vector_type(4))) double double4;
|
|
|
|
typedef __attribute__((ext_vector_type(4))) int int4;
|
|
|
|
typedef __attribute__((ext_vector_type(4))) long long4;
|
|
|
|
|
|
|
|
kernel void float_ops() {
|
|
|
|
int flaf = 0.0f && 0.0f;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
int flof = 0.0f || 0.0f;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
float fbaf = 0.0f & 0.0f; // expected-error {{invalid operands}}
|
|
|
|
float fbof = 0.0f | 0.0f; // expected-error {{invalid operands}}
|
|
|
|
float fbxf = 0.0f ^ 0.0f; // expected-error {{invalid operands}}
|
|
|
|
int flai = 0.0f && 0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
int floi = 0.0f || 0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2018-06-28 04:30:34 +08:00
|
|
|
float ibaf = 0 & 0.0f; // expected-error {{invalid operands to binary expression ('int' and 'float')}}
|
2013-02-21 19:49:56 +08:00
|
|
|
float ibof = 0 | 0.0f; // expected-error {{invalid operands}}
|
|
|
|
float bnf = ~0.0f;// expected-error {{invalid argument type}}
|
|
|
|
float lnf = !0.0f;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid argument type}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
kernel void vec_float_ops() {
|
|
|
|
float4 f4 = (float4)(0, 0, 0, 0);
|
|
|
|
int4 f4laf = f4 && 0.0f;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
int4 f4lof = f4 || 0.0f;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}}
|
|
|
|
float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}}
|
|
|
|
float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}}
|
|
|
|
float bnf4 = ~f4; // expected-error {{invalid argument type}}
|
|
|
|
int4 lnf4 = !f4;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid argument type}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
kernel void double_ops() {
|
|
|
|
int flaf = 0.0 && 0.0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
int flof = 0.0 || 0.0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
double fbaf = 0.0 & 0.0; // expected-error {{invalid operands}}
|
|
|
|
double fbof = 0.0 | 0.0; // expected-error {{invalid operands}}
|
|
|
|
double fbxf = 0.0 ^ 0.0; // expected-error {{invalid operands}}
|
|
|
|
int flai = 0.0 && 0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
int floi = 0.0 || 0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
double ibaf = 0 & 0.0; // expected-error {{invalid operands}}
|
|
|
|
double ibof = 0 | 0.0; // expected-error {{invalid operands}}
|
|
|
|
double bnf = ~0.0; // expected-error {{invalid argument type}}
|
|
|
|
double lnf = !0.0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid argument type}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
kernel void vec_double_ops() {
|
|
|
|
double4 f4 = (double4)(0, 0, 0, 0);
|
|
|
|
long4 f4laf = f4 && 0.0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
long4 f4lof = f4 || 0.0;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid operands}}
|
|
|
|
#endif
|
2013-02-21 19:49:56 +08:00
|
|
|
double4 f4baf = f4 & 0.0; // expected-error {{invalid operands}}
|
|
|
|
double4 f4bof = f4 | 0.0; // expected-error {{invalid operands}}
|
|
|
|
double4 f4bxf = f4 ^ 0.0; // expected-error {{invalid operands}}
|
|
|
|
double bnf4 = ~f4; // expected-error {{invalid argument type}}
|
|
|
|
long4 lnf4 = !f4;
|
2017-02-08 00:09:41 +08:00
|
|
|
#if __OPENCL_C_VERSION__ < 120
|
|
|
|
// expected-error@-2{{invalid argument type}}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
kernel void pointer_ops(){
|
|
|
|
global int* p;
|
|
|
|
bool b = !p;
|
|
|
|
b = p==0;
|
|
|
|
int i;
|
|
|
|
b = !&i;
|
|
|
|
b = &i==(int *)1;
|
2013-02-21 19:49:56 +08:00
|
|
|
}
|