• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <clc/clc.h>
2#include "../clcmacro.h"
3
4_CLC_DEFINE_BINARY_BUILTIN(float, copysign, __builtin_copysignf, float, float)
5
6#ifdef cl_khr_fp64
7
8#pragma OPENCL EXTENSION cl_khr_fp64 : enable
9
10_CLC_DEFINE_BINARY_BUILTIN(double, copysign, __builtin_copysign, double, double)
11
12#endif
13
14#ifdef cl_khr_fp16
15
16#pragma OPENCL EXTENSION cl_khr_fp16 : enable
17
18_CLC_DEF _CLC_OVERLOAD half copysign(half x, half y)
19{
20   ushort sign_x = as_ushort(x) & 0x8000u;
21   ushort unsigned_y = as_ushort(y) & 0x7ffffu;
22
23   return as_half((ushort)(sign_x | unsigned_y));
24}
25_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, copysign, half, half)
26
27#endif
28