1// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
2
3#pragma OPENCL EXTENSION cl_khr_fp64 : enable
4
5typedef int int4 __attribute((ext_vector_type(4)));
6typedef long long4 __attribute((ext_vector_type(4)));
7typedef float float4 __attribute((ext_vector_type(4)));
8typedef double double4 __attribute((ext_vector_type(4)));
9
10// CHECK: floatops
11kernel void floatops(global int4 *out, global float4 *fout) {
12  // CHECK: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
13  out[0] = (float4)(1, 1, 1, 1) && 1.0f;
14  // CHECK: store <4 x i32> zeroinitializer
15  out[1] = (float4)(0, 0, 0, 0) && (float4)(0, 0, 0, 0);
16
17  // CHECK: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
18  out[2] = (float4)(0, 0, 0, 0) || (float4)(1, 1, 1, 1);
19  // CHECK: store <4 x i32> zeroinitializer
20  out[3] = (float4)(0, 0, 0, 0) || 0.0f;
21
22  // CHECK: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
23  out[4] = !(float4)(0, 0, 0, 0);
24  // CHECK: store <4 x i32> zeroinitializer
25  out[5] = !(float4)(1, 2, 3, 4);
26  // CHECK: store <4 x i32> <i32 -1, i32 0, i32 -1, i32 0>
27  out[6] = !(float4)(0, 1, 0, 1);
28  // CHECK: store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
29  fout[0] = (float4)(!0.0f);
30  // CHECK: store <4 x float> zeroinitializer
31  fout[1] = (float4)(!1.0f);
32}
33
34// CHECK: doubleops
35kernel void doubleops(global long4 *out, global double4 *dout) {
36  // CHECK: store <4 x i64> <i64 -1, i64 -1, i64 -1, i64 -1>
37  out[0] = (double4)(1, 1, 1, 1) && 1.0;
38  // CHECK: store <4 x i64> zeroinitializer
39  out[1] = (double4)(0, 0, 0, 0) && (double4)(0, 0, 0, 0);
40
41  // CHECK: store <4 x i64> <i64 -1, i64 -1, i64 -1, i64 -1>
42  out[2] = (double4)(0, 0, 0, 0) || (double4)(1, 1, 1, 1);
43  // CHECK: store <4 x i64> zeroinitializer
44  out[3] = (double4)(0, 0, 0, 0) || 0.0f;
45
46  // CHECK: store <4 x i64> <i64 -1, i64 -1, i64 -1, i64 -1>
47  out[4] = !(double4)(0, 0, 0, 0);
48  // CHECK: store <4 x i64> zeroinitializer
49  out[5] = !(double4)(1, 2, 3, 4);
50  // CHECK: store <4 x i64> <i64 -1, i64 0, i64 -1, i64 0>
51  out[6] = !(double4)(0, 1, 0, 1);
52  // CHECK: store <4 x double> <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
53  dout[0] = (double4)(!0.0f);
54  // CHECK: store <4 x double> zeroinitializer
55  dout[1] = (double4)(!1.0f);
56}
57