geometric: Limit fast_{distance,length} functions to single precision
authorJan Vesely <jan.vesely@rutgers.edu>
Sat, 9 May 2015 22:31:01 +0000 (22:31 +0000)
committerJan Vesely <jan.vesely@rutgers.edu>
Sat, 9 May 2015 22:31:01 +0000 (22:31 +0000)
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 236940

libclc/generic/include/clc/geometric/fast_distance.h
libclc/generic/include/clc/geometric/fast_length.h
libclc/generic/lib/geometric/fast_distance.cl
libclc/generic/lib/geometric/fast_length.cl

index 91b3fe5..a84f70b 100644 (file)
@@ -21,4 +21,6 @@
  */
 
 #define __CLC_BODY <clc/geometric/fast_distance.inc>
+#define __FLOAT_ONLY
 #include <clc/geometric/floatn.inc>
+#undef __FLOAT_ONLY
index 2c7b80a..1d894b6 100644 (file)
@@ -21,4 +21,6 @@
  */
 
 #define __CLC_BODY <clc/geometric/fast_length.inc>
+#define __FLOAT_ONLY
 #include <clc/geometric/floatn.inc>
+#undef __FLOAT_ONLY
index 47c9d7a..0a4f82c 100644 (file)
@@ -22,9 +22,7 @@
 
 #include <clc/clc.h>
 
-#ifdef cl_khr_fp64
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-#endif
-
 #define __CLC_BODY <fast_distance.inc>
+#define __FLOAT_ONLY
 #include <clc/geometric/floatn.inc>
+#undef __FLOAT_ONLY
index 425dcf7..8f6ffc6 100644 (file)
@@ -37,24 +37,3 @@ _CLC_OVERLOAD _CLC_DEF float fast_length(float3 p) {
 _CLC_OVERLOAD _CLC_DEF float fast_length(float4 p) {
   return half_sqrt(dot(p, p));
 }
-
-#ifdef cl_khr_fp64
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-_CLC_OVERLOAD _CLC_DEF double fast_length(double p) {
-  return fabs(p);
-}
-
-_CLC_OVERLOAD _CLC_DEF double fast_length(double2 p) {
-  return half_sqrt(dot(p, p));
-}
-
-_CLC_OVERLOAD _CLC_DEF double fast_length(double3 p) {
-  return half_sqrt(dot(p, p));
-}
-
-_CLC_OVERLOAD _CLC_DEF double fast_length(double4 p) {
-  return half_sqrt(dot(p, p));
-}
-
-#endif