brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · f3c8bff Raw
58 lines · plain
1// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s2// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=clc++ -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s3 4#pragma OPENCL EXTENSION cl_khr_fp64 : enable5 6typedef int int4 __attribute((ext_vector_type(4)));7typedef long long4 __attribute((ext_vector_type(4)));8typedef float float4 __attribute((ext_vector_type(4)));9typedef double double4 __attribute((ext_vector_type(4)));10 11// CHECK: floatops12kernel void floatops(global int4 *out, global float4 *fout) {13  // CHECK: store <4 x i32> splat (i32 -1)14  out[0] = (float4)(1, 1, 1, 1) && 1.0f;15  // CHECK: store <4 x i32> zeroinitializer16  out[1] = (float4)(0, 0, 0, 0) && (float4)(0, 0, 0, 0);17 18  // CHECK: store <4 x i32> splat (i32 -1)19  out[2] = (float4)(0, 0, 0, 0) || (float4)(1, 1, 1, 1);20  // CHECK: store <4 x i32> zeroinitializer21  out[3] = (float4)(0, 0, 0, 0) || 0.0f;22 23  // CHECK: store <4 x i32> splat (i32 -1)24  out[4] = !(float4)(0, 0, 0, 0);25  // CHECK: store <4 x i32> zeroinitializer26  out[5] = !(float4)(1, 2, 3, 4);27  // CHECK: store <4 x i32> <i32 -1, i32 0, i32 -1, i32 0>28  out[6] = !(float4)(0, 1, 0, 1);29  // CHECK: store <4 x float> splat (float 1.000000e+00)30  fout[0] = (float4)(!0.0f);31  // CHECK: store <4 x float> zeroinitializer32  fout[1] = (float4)(!1.0f);33}34 35// CHECK: doubleops36kernel void doubleops(global long4 *out, global double4 *dout) {37  // CHECK: store <4 x i64> splat (i64 -1)38  out[0] = (double4)(1, 1, 1, 1) && 1.0;39  // CHECK: store <4 x i64> zeroinitializer40  out[1] = (double4)(0, 0, 0, 0) && (double4)(0, 0, 0, 0);41 42  // CHECK: store <4 x i64> splat (i64 -1)43  out[2] = (double4)(0, 0, 0, 0) || (double4)(1, 1, 1, 1);44  // CHECK: store <4 x i64> zeroinitializer45  out[3] = (double4)(0, 0, 0, 0) || 0.0f;46 47  // CHECK: store <4 x i64> splat (i64 -1)48  out[4] = !(double4)(0, 0, 0, 0);49  // CHECK: store <4 x i64> zeroinitializer50  out[5] = !(double4)(1, 2, 3, 4);51  // CHECK: store <4 x i64> <i64 -1, i64 0, i64 -1, i64 0>52  out[6] = !(double4)(0, 1, 0, 1);53  // CHECK: store <4 x double> splat (double 1.000000e+00)54  dout[0] = (double4)(!0.0f);55  // CHECK: store <4 x double> zeroinitializer56  dout[1] = (double4)(!1.0f);57}58