Home | History | Annotate | Download | only in SemaOpenCL
      1 // RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu
      2 
      3 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
      4 
      5 typedef __attribute__((ext_vector_type(4))) float float4;
      6 typedef __attribute__((ext_vector_type(4))) double double4;
      7 typedef __attribute__((ext_vector_type(4))) int int4;
      8 typedef __attribute__((ext_vector_type(4))) long long4;
      9 
     10 kernel void float_ops() {
     11   int flaf = 0.0f && 0.0f;
     12   int flof = 0.0f || 0.0f;
     13   float fbaf = 0.0f & 0.0f; // expected-error {{invalid operands}}
     14   float fbof = 0.0f | 0.0f; // expected-error {{invalid operands}}
     15   float fbxf = 0.0f ^ 0.0f; // expected-error {{invalid operands}}
     16   int flai = 0.0f && 0;
     17   int floi = 0.0f || 0;
     18   float ibaf = 0 & 0.0f; // expected-error {{invalid operands}}
     19   float ibof = 0 | 0.0f; // expected-error {{invalid operands}}
     20   float bnf = ~0.0f;// expected-error {{invalid argument type}}
     21   float lnf = !0.0f;
     22 }
     23 
     24 kernel void vec_float_ops() {
     25   float4 f4 = (float4)(0, 0, 0, 0);
     26   int4 f4laf = f4 && 0.0f;
     27   int4 f4lof = f4 || 0.0f;
     28   float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}}
     29   float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}}
     30   float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}}
     31   float bnf4 = ~f4; // expected-error {{invalid argument type}}
     32   int4 lnf4 = !f4;
     33 }
     34 
     35 kernel void double_ops() {
     36   int flaf = 0.0 && 0.0;
     37   int flof = 0.0 || 0.0;
     38   double fbaf = 0.0 & 0.0; // expected-error {{invalid operands}}
     39   double fbof = 0.0 | 0.0; // expected-error {{invalid operands}}
     40   double fbxf = 0.0 ^ 0.0; // expected-error {{invalid operands}}
     41   int flai = 0.0 && 0;
     42   int floi = 0.0 || 0;
     43   double ibaf = 0 & 0.0; // expected-error {{invalid operands}}
     44   double ibof = 0 | 0.0; // expected-error {{invalid operands}}
     45   double bnf = ~0.0; // expected-error {{invalid argument type}}
     46   double lnf = !0.0;
     47 }
     48 
     49 kernel void vec_double_ops() {
     50   double4 f4 = (double4)(0, 0, 0, 0);
     51   long4 f4laf = f4 && 0.0;
     52   long4 f4lof = f4 || 0.0;
     53   double4 f4baf = f4 & 0.0; // expected-error {{invalid operands}}
     54   double4 f4bof = f4 | 0.0; // expected-error {{invalid operands}}
     55   double4 f4bxf = f4 ^ 0.0; // expected-error {{invalid operands}}
     56   double bnf4 = ~f4; // expected-error {{invalid argument type}}
     57   long4 lnf4 = !f4;
     58 }
     59