From 0144669d998f6925de08f45fedea25985284f2b7 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 29 May 2012 13:35:45 +0000 Subject: [PATCH] Add missing dot.h include. llvm-svn: 157615 --- libclc/generic/include/clc/clc.h | 1 + libclc/generic/include/clc/geometric/dot.inc | 1 + libclc/generic/lib/geometric/dot.cl | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 libclc/generic/include/clc/geometric/dot.inc diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h index 65e4090..2833871 100644 --- a/libclc/generic/include/clc/clc.h +++ b/libclc/generic/include/clc/clc.h @@ -59,6 +59,7 @@ /* 6.11.5 Geometric Functions */ #include +#include #include #include diff --git a/libclc/generic/include/clc/geometric/dot.inc b/libclc/generic/include/clc/geometric/dot.inc new file mode 100644 index 0000000..69c53a9 --- /dev/null +++ b/libclc/generic/include/clc/geometric/dot.inc @@ -0,0 +1 @@ +_CLC_OVERLOAD _CLC_DECL FLOAT dot(FLOATN p0, FLOATN p1); diff --git a/libclc/generic/lib/geometric/dot.cl b/libclc/generic/lib/geometric/dot.cl index 76cc1d2..0d6fe6c 100644 --- a/libclc/generic/lib/geometric/dot.cl +++ b/libclc/generic/lib/geometric/dot.cl @@ -15,3 +15,25 @@ _CLC_OVERLOAD _CLC_DEF float dot(float3 p0, float3 p1) { _CLC_OVERLOAD _CLC_DEF float dot(float4 p0, float4 p1) { return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z + p0.w*p1.w; } + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +_CLC_OVERLOAD _CLC_DEF double dot(double p0, double p1) { + return p0*p1; +} + +_CLC_OVERLOAD _CLC_DEF double dot(double2 p0, double2 p1) { + return p0.x*p1.x + p0.y*p1.y; +} + +_CLC_OVERLOAD _CLC_DEF double dot(double3 p0, double3 p1) { + return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z; +} + +_CLC_OVERLOAD _CLC_DEF double dot(double4 p0, double4 p1) { + return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z + p0.w*p1.w; +} + +#endif -- 2.7.4