[libclc] r204477 - Add cross for double3 and double4
Tom Stellard
thomas.stellard at amd.com
Fri Mar 21 09:21:58 PDT 2014
Author: tstellar
Date: Fri Mar 21 11:21:58 2014
New Revision: 204477
URL: http://llvm.org/viewvc/llvm-project?rev=204477&view=rev
Log:
Add cross for double3 and double4
Patch by: Jeroen Ketema
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
Modified:
libclc/trunk/generic/include/clc/geometric/cross.h
libclc/trunk/generic/lib/geometric/cross.cl
Modified: libclc/trunk/generic/include/clc/geometric/cross.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/geometric/cross.h?rev=204477&r1=204476&r2=204477&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/geometric/cross.h (original)
+++ libclc/trunk/generic/include/clc/geometric/cross.h Fri Mar 21 11:21:58 2014
@@ -1,2 +1,7 @@
_CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1);
_CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1);
+
+#ifdef cl_khr_fp64
+_CLC_OVERLOAD _CLC_DECL double3 cross(double3 p0, double3 p1);
+_CLC_OVERLOAD _CLC_DECL double4 cross(double4 p0, double4 p1);
+#endif
Modified: libclc/trunk/generic/lib/geometric/cross.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/geometric/cross.cl?rev=204477&r1=204476&r2=204477&view=diff
==============================================================================
--- libclc/trunk/generic/lib/geometric/cross.cl (original)
+++ libclc/trunk/generic/lib/geometric/cross.cl Fri Mar 21 11:21:58 2014
@@ -9,3 +9,17 @@ _CLC_OVERLOAD _CLC_DEF float4 cross(floa
return (float4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
p0.x*p1.y - p0.y*p1.x, 0.f);
}
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_OVERLOAD _CLC_DEF double3 cross(double3 p0, double3 p1) {
+ return (double3)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
+ p0.x*p1.y - p0.y*p1.x);
+}
+
+_CLC_OVERLOAD _CLC_DEF double4 cross(double4 p0, double4 p1) {
+ return (double4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
+ p0.x*p1.y - p0.y*p1.x, 0.f);
+}
+#endif
More information about the cfe-commits
mailing list