[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / libclc / generic / lib / common / sign.cl
blob25832e0b4f8b929e0f3be55249b391b59f439b3e
1 #include <clc/clc.h>
2 #include "../clcmacro.h"
4 #define SIGN(TYPE, F) \
5 _CLC_DEF _CLC_OVERLOAD TYPE sign(TYPE x) { \
6 if (isnan(x)) { \
7 return 0.0F; \
8 } \
9 if (x > 0.0F) { \
10 return 1.0F; \
11 } \
12 if (x < 0.0F) { \
13 return -1.0F; \
14 } \
15 return x; /* -0.0 or +0.0 */ \
18 SIGN(float, f)
19 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, sign, float)
21 #ifdef cl_khr_fp64
23 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
25 SIGN(double, )
26 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, sign, double)
28 #endif