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
This commit is contained in:
Tom Stellard 2014-09-03 15:55:38 +00:00
parent 2a9b6aae9a
commit d8a73abfc3
4 changed files with 16 additions and 1 deletions

View File

@ -1 +1,2 @@
#define copysign(x, y) __builtin_copysign(x, y) #define __CLC_BODY <clc/math/copysign.inc>
#include <clc/math/gentype.inc>

View File

@ -0,0 +1 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE copysign(__CLC_GENTYPE a, __CLC_GENTYPE b);

View File

@ -31,6 +31,7 @@ integer/sub_sat_impl.ll
integer/upsample.cl integer/upsample.cl
math/atan.cl math/atan.cl
math/atan2.cl math/atan2.cl
math/copysign.cl
math/cos.cl math/cos.cl
math/exp.cl math/exp.cl
math/exp10.cl math/exp10.cl

View File

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