Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libclc
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-09-03 19:55:38 +0400
committerTom Stellard <thomas.stellard@amd.com>2014-09-03 19:55:38 +0400
commitd8a73abfc3f53c9c2f8dc9e97e935cf18f8f093c (patch)
treef8b107a46c2f12e8f101e04449100947c2407c5b /libclc
parent2a9b6aae9a435d31c6eefc4c2ebf7d717d0d7c2b (diff)
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@gmail.com> llvm-svn: 217045
Diffstat (limited to 'libclc')
-rw-r--r--libclc/generic/include/clc/math/copysign.h3
-rw-r--r--libclc/generic/include/clc/math/copysign.inc1
-rw-r--r--libclc/generic/lib/SOURCES1
-rw-r--r--libclc/generic/lib/math/copysign.cl12
4 files changed, 16 insertions, 1 deletions
diff --git a/libclc/generic/include/clc/math/copysign.h b/libclc/generic/include/clc/math/copysign.h
index 9d6cf76deb74..8f0742e451fd 100644
--- a/libclc/generic/include/clc/math/copysign.h
+++ b/libclc/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/libclc/generic/include/clc/math/copysign.inc b/libclc/generic/include/clc/math/copysign.inc
new file mode 100644
index 000000000000..6091abcc1fc5
--- /dev/null
+++ b/libclc/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/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES
index 5ad823dd1fdf..ddaff06d2271 100644
--- a/libclc/generic/lib/SOURCES
+++ b/libclc/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/libclc/generic/lib/math/copysign.cl b/libclc/generic/lib/math/copysign.cl
new file mode 100644
index 000000000000..4e0c51b09373
--- /dev/null
+++ b/libclc/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