diff options
Diffstat (limited to 'test/CodeGenOpenCL')
-rw-r--r-- | test/CodeGenOpenCL/ext-vector-shuffle.cl | 17 | ||||
-rw-r--r-- | test/CodeGenOpenCL/kernel-metadata.cl | 10 | ||||
-rw-r--r-- | test/CodeGenOpenCL/single-precision-constant.cl | 7 |
3 files changed, 34 insertions, 0 deletions
diff --git a/test/CodeGenOpenCL/ext-vector-shuffle.cl b/test/CodeGenOpenCL/ext-vector-shuffle.cl new file mode 100644 index 0000000..ee88ba3 --- /dev/null +++ b/test/CodeGenOpenCL/ext-vector-shuffle.cl @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -cl-opt-disable -emit-llvm -o - | not grep 'extractelement' +// RUN: %clang_cc1 %s -cl-opt-disable -emit-llvm -o - | not grep 'insertelement' +// RUN: %clang_cc1 %s -cl-opt-disable -emit-llvm -o - | grep 'shufflevector' + +typedef __attribute__(( ext_vector_type(2) )) float float2; +typedef __attribute__(( ext_vector_type(4) )) float float4; + +float2 test1(float4 V) { + return V.xy + V.wz; +} + +float4 test2(float4 V) { + float2 W = V.ww; + return W.xyxy + W.yxyx; +} + +float4 test3(float4 V1, float4 V2) { return (float4)(V1.zw, V2.xy); } diff --git a/test/CodeGenOpenCL/kernel-metadata.cl b/test/CodeGenOpenCL/kernel-metadata.cl new file mode 100644 index 0000000..3e10a11 --- /dev/null +++ b/test/CodeGenOpenCL/kernel-metadata.cl @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +void normal_function() { +} + +__kernel void kernel_function() { +} + +// CHECK: !opencl.kernels = !{!0} +// CHECK: !0 = metadata !{void ()* @kernel_function} diff --git a/test/CodeGenOpenCL/single-precision-constant.cl b/test/CodeGenOpenCL/single-precision-constant.cl new file mode 100644 index 0000000..62b37c1 --- /dev/null +++ b/test/CodeGenOpenCL/single-precision-constant.cl @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -cl-single-precision-constant -emit-llvm -o - | FileCheck %s + +float fn(float f) { + // CHECK: fmul float + // CHECK: fadd float + return f*2. + 1.; +} |