diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2014-09-03 15:55:38 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2014-09-03 15:55:38 +0000 |
commit | d8a73abfc3f53c9c2f8dc9e97e935cf18f8f093c (patch) | |
tree | f8b107a46c2f12e8f101e04449100947c2407c5b /libclc/generic | |
parent | 2a9b6aae9a435d31c6eefc4c2ebf7d717d0d7c2b (diff) | |
download | bcm5719-llvm-d8a73abfc3f53c9c2f8dc9e97e935cf18f8f093c.tar.gz bcm5719-llvm-d8a73abfc3f53c9c2f8dc9e97e935cf18f8f093c.zip |
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/generic')
-rw-r--r-- | libclc/generic/include/clc/math/copysign.h | 3 | ||||
-rw-r--r-- | libclc/generic/include/clc/math/copysign.inc | 1 | ||||
-rw-r--r-- | libclc/generic/lib/SOURCES | 1 | ||||
-rw-r--r-- | libclc/generic/lib/math/copysign.cl | 12 |
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 9d6cf76deb7..8f0742e451f 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 00000000000..6091abcc1fc --- /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 5ad823dd1fd..ddaff06d227 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 00000000000..4e0c51b0937 --- /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 |