[libclc] 252/291: Fix compilation warnings without cl_khr_fp64

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository libclc.

commit fb4cee5174bb39553dc3bbc9ee3748c2d641ba91
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date:   Fri Apr 24 19:54:17 2015 +0000

    Fix compilation warnings without cl_khr_fp64
    
    Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
    Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@235762 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/lib/math/acos.inc | 14 +++++++++++---
 generic/lib/math/asin.inc | 13 +++++++++++--
 generic/lib/math/tan.inc  | 11 ++++++++++-
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/generic/lib/math/acos.inc b/generic/lib/math/acos.inc
index 8612415..cac9499 100644
--- a/generic/lib/math/acos.inc
+++ b/generic/lib/math/acos.inc
@@ -11,11 +11,19 @@
  * precision of #4 may be better.
  */
 
+#if __CLC_FPSIZE == 32
+#define __CLC_CONST(x) x ## f
+#else
+#define __CLC_CONST(x) x
+#endif
+
 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE acos(__CLC_GENTYPE x) {
   return (
-    (__CLC_GENTYPE) 2.0 * atan2(
-      sqrt((__CLC_GENTYPE) 1.0 - x),
-      sqrt((__CLC_GENTYPE) 1.0 + x)
+    (__CLC_GENTYPE) __CLC_CONST(2.0) * atan2(
+      sqrt((__CLC_GENTYPE) __CLC_CONST(1.0) - x),
+      sqrt((__CLC_GENTYPE) __CLC_CONST(1.0) + x)
     )
   );
 }
+
+#undef __CLC_CONST
diff --git a/generic/lib/math/asin.inc b/generic/lib/math/asin.inc
index a109c36..4643cf8 100644
--- a/generic/lib/math/asin.inc
+++ b/generic/lib/math/asin.inc
@@ -1,3 +1,12 @@
+
+#if __CLC_FPSIZE == 32
+#define __CLC_CONST(x) x ## f
+#else
+#define __CLC_CONST(x) x
+#endif
+
 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE asin(__CLC_GENTYPE x) {
-  return atan2(x, sqrt( (__CLC_GENTYPE)1.0 -(x*x) ));
-}
\ No newline at end of file
+  return atan2(x, sqrt( (__CLC_GENTYPE)__CLC_CONST(1.0) -(x*x) ));
+}
+
+#undef __CLC_CONST
diff --git a/generic/lib/math/tan.inc b/generic/lib/math/tan.inc
index 8d9d9fe..b9ce33e 100644
--- a/generic/lib/math/tan.inc
+++ b/generic/lib/math/tan.inc
@@ -2,7 +2,16 @@
  * Note: tan(x) = sin(x)/cos(x) also, but the final assembly ends up being
  *       twice as long for R600 (maybe for others as well).
  */
+
+#if __CLC_FPSIZE == 32
+#define __CLC_CONST(x) x ## f
+#else
+#define __CLC_CONST(x) x
+#endif
+
 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE tan(__CLC_GENTYPE x) {
   __CLC_GENTYPE sinx = sin(x);
-  return sinx / sqrt( (__CLC_GENTYPE) 1.0 - (sinx*sinx) );
+  return sinx / sqrt( (__CLC_GENTYPE) __CLC_CONST(1.0) - (sinx*sinx) );
 }
+
+#undef __CLC_CONST

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list