[libclc] 183/291: Fix implementation of copysign

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:47 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 c5564bc7bd82e59d76751715afc9a5cf5a5f4b93
Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Wed Sep 3 15:55:38 2014 +0000

    Fix implementation of copysign
    
    This was previously implemented with a macro and we were using
    __builtin_copysign(), which takes double inputs for the float
    version of copysign().
    
    Reviewed-and-Tested-by: Aaron Watry <awatry at gmail.com>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@217045 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/math/copysign.h   |  3 ++-
 generic/include/clc/math/copysign.inc |  1 +
 generic/lib/SOURCES                   |  1 +
 generic/lib/math/copysign.cl          | 12 ++++++++++++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/generic/include/clc/math/copysign.h b/generic/include/clc/math/copysign.h
index 9d6cf76..8f0742e 100644
--- a/generic/include/clc/math/copysign.h
+++ b/generic/include/clc/math/copysign.h
@@ -1 +1,2 @@
-#define copysign(x, y) __builtin_copysign(x, y)
+#define __CLC_BODY <clc/math/copysign.inc>
+#include <clc/math/gentype.inc>
diff --git a/generic/include/clc/math/copysign.inc b/generic/include/clc/math/copysign.inc
new file mode 100644
index 0000000..6091abc
--- /dev/null
+++ b/generic/include/clc/math/copysign.inc
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE copysign(__CLC_GENTYPE a, __CLC_GENTYPE b);
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index 5ad823d..ddaff06 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -31,6 +31,7 @@ integer/sub_sat_impl.ll
 integer/upsample.cl
 math/atan.cl
 math/atan2.cl
+math/copysign.cl
 math/cos.cl
 math/exp.cl
 math/exp10.cl
diff --git a/generic/lib/math/copysign.cl b/generic/lib/math/copysign.cl
new file mode 100644
index 0000000..4e0c51b
--- /dev/null
+++ b/generic/lib/math/copysign.cl
@@ -0,0 +1,12 @@
+#include <clc/clc.h>
+#include "../clcmacro.h"
+
+_CLC_DEFINE_BINARY_BUILTIN(float, copysign, __builtin_copysignf, float, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_DEFINE_BINARY_BUILTIN(double, copysign, __builtin_copysign, double, double)
+
+#endif

-- 
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