brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 76a7692 Raw
124 lines · plain
1// RUN: %clang_cc1 %s -verify -cl-std=CL1.1 -triple x86_64-unknown-linux-gnu2// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu3// RUN: %clang_cc1 %s -verify -cl-std=CL2.0 -triple x86_64-unknown-linux-gnu4 5#pragma OPENCL EXTENSION cl_khr_fp64 : enable6 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__ < 12015// expected-error@-2{{invalid operands}}16#endif17  int flof = 0.0f || 0.0f;18#if __OPENCL_C_VERSION__ < 12019// expected-error@-2{{invalid operands}}20#endif21  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__ < 12026// expected-error@-2{{invalid operands}}27#endif28  int floi = 0.0f || 0;29#if __OPENCL_C_VERSION__ < 12030// expected-error@-2{{invalid operands}}31#endif32  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__ < 12037// expected-error@-2{{invalid argument type}}38#endif39  float fcst = 5.5f;40  float fremainder = fcst % 2.0f; // expected-error {{invalid operands to binary expression}}41}42 43kernel void vec_float_ops() {44  float4 f4 = (float4)(0, 0, 0, 0);45  int4 f4laf = f4 && 0.0f;46#if __OPENCL_C_VERSION__ < 12047// expected-error@-2{{invalid operands}}48#endif49  int4 f4lof = f4 || 0.0f;50#if __OPENCL_C_VERSION__ < 12051// expected-error@-2{{invalid operands}}52#endif53  float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}}54  float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}}55  float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}}56  float bnf4 = ~f4; // expected-error {{invalid argument type}}57  int4 lnf4 = !f4;58#if __OPENCL_C_VERSION__ < 12059// expected-error@-2{{invalid argument type}}60#endif61  float4 f4cst = (float4)(5.5f, 5.5f, 5.5f, 5.5f);62  float4 f4remainder = f4cst % (float4)(2.0f, 2.0f, 2.0f, 2.0f); // expected-error {{invalid operands to binary expression}}63}64 65kernel void double_ops() {66  int flaf = 0.0 && 0.0;67#if __OPENCL_C_VERSION__ < 12068// expected-error@-2{{invalid operands}}69#endif70  int flof = 0.0 || 0.0;71#if __OPENCL_C_VERSION__ < 12072// expected-error@-2{{invalid operands}}73#endif74  double fbaf = 0.0 & 0.0; // expected-error {{invalid operands}}75  double fbof = 0.0 | 0.0; // expected-error {{invalid operands}}76  double fbxf = 0.0 ^ 0.0; // expected-error {{invalid operands}}77  int flai = 0.0 && 0;78#if __OPENCL_C_VERSION__ < 12079// expected-error@-2{{invalid operands}}80#endif81  int floi = 0.0 || 0;82#if __OPENCL_C_VERSION__ < 12083// expected-error@-2{{invalid operands}}84#endif85  double ibaf = 0 & 0.0; // expected-error {{invalid operands}}86  double ibof = 0 | 0.0; // expected-error {{invalid operands}}87  double bnf = ~0.0; // expected-error {{invalid argument type}}88  double lnf = !0.0;89#if __OPENCL_C_VERSION__ < 12090// expected-error@-2{{invalid argument type}}91#endif92  double dcst = 5.5;93  double dremainder = dcst % 2.0; // expected-error {{invalid operands to binary expression}}94}95 96kernel void vec_double_ops() {97  double4 f4 = (double4)(0, 0, 0, 0);98  long4 f4laf = f4 && 0.0;99#if __OPENCL_C_VERSION__ < 120100// expected-error@-2{{invalid operands}}101#endif102  long4 f4lof = f4 || 0.0;103#if __OPENCL_C_VERSION__ < 120104// expected-error@-2{{invalid operands}}105#endif106  double4 f4baf = f4 & 0.0; // expected-error {{invalid operands}}107  double4 f4bof = f4 | 0.0; // expected-error {{invalid operands}}108  double4 f4bxf = f4 ^ 0.0; // expected-error {{invalid operands}}109  double bnf4 = ~f4; // expected-error {{invalid argument type}}110  long4 lnf4 = !f4;111#if __OPENCL_C_VERSION__ < 120112// expected-error@-2{{invalid argument type}}113#endif114}115 116kernel void pointer_ops(){117  global int* p;118  bool b = !p;119  b = p==0;120  int i;121  b = !&i; // expected-warning {{address of 'i' will always evaluate to 'true'}}122  b = &i==(int *)1;123}124