• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4typedef __attribute__((ext_vector_type(4))) float float4;
5typedef __attribute__((ext_vector_type(4))) double double4;
6typedef __attribute__((ext_vector_type(4))) int int4;
7typedef __attribute__((ext_vector_type(4))) long long4;
8
9kernel void float_ops() {
10  int flaf = 0.0f && 0.0f;
11  int flof = 0.0f || 0.0f;
12  float fbaf = 0.0f & 0.0f; // expected-error {{invalid operands}}
13  float fbof = 0.0f | 0.0f; // expected-error {{invalid operands}}
14  float fbxf = 0.0f ^ 0.0f; // expected-error {{invalid operands}}
15  int flai = 0.0f && 0;
16  int floi = 0.0f || 0;
17  float ibaf = 0 & 0.0f; // expected-error {{invalid operands}}
18  float ibof = 0 | 0.0f; // expected-error {{invalid operands}}
19  float bnf = ~0.0f;// expected-error {{invalid argument type}}
20  float lnf = !0.0f;
21}
22
23kernel void vec_float_ops() {
24  float4 f4 = (float4)(0, 0, 0, 0);
25  int4 f4laf = f4 && 0.0f;
26  int4 f4lof = f4 || 0.0f;
27  float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}}
28  float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}}
29  float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}}
30  float bnf4 = ~f4; // expected-error {{invalid argument type}}
31  int4 lnf4 = !f4;
32}
33
34kernel void double_ops() {
35  int flaf = 0.0 && 0.0;
36  int flof = 0.0 || 0.0;
37  double fbaf = 0.0 & 0.0; // expected-error {{invalid operands}}
38  double fbof = 0.0 | 0.0; // expected-error {{invalid operands}}
39  double fbxf = 0.0 ^ 0.0; // expected-error {{invalid operands}}
40  int flai = 0.0 && 0;
41  int floi = 0.0 || 0;
42  double ibaf = 0 & 0.0; // expected-error {{invalid operands}}
43  double ibof = 0 | 0.0; // expected-error {{invalid operands}}
44  double bnf = ~0.0; // expected-error {{invalid argument type}}
45  double lnf = !0.0;
46}
47
48kernel void vec_double_ops() {
49  double4 f4 = (double4)(0, 0, 0, 0);
50  long4 f4laf = f4 && 0.0;
51  long4 f4lof = f4 || 0.0;
52  double4 f4baf = f4 & 0.0; // expected-error {{invalid operands}}
53  double4 f4bof = f4 | 0.0; // expected-error {{invalid operands}}
54  double4 f4bxf = f4 ^ 0.0; // expected-error {{invalid operands}}
55  double bnf4 = ~f4; // expected-error {{invalid argument type}}
56  long4 lnf4 = !f4;
57}
58