1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
|
#include "sleef_cl.h"
_CL_OVERLOADABLE
float
_cl_log (float x)
{
#ifdef MAX_PRECISION
return Sleef_logf_u10 (x);
#else
return Sleef_logf_u35 (x);
#endif
}
_CL_OVERLOADABLE
float2
_cl_log (float2 x)
{
float lo = _cl_log (x.lo);
float hi = _cl_log (x.hi);
return (float2) (lo, hi);
}
_CL_OVERLOADABLE
float4 _cl_log (float4);
_CL_OVERLOADABLE
float3
_cl_log (float3 x)
{
float4 x_3to4 = (float4) (x, (float)0);
float4 r = _cl_log (x_3to4);
return r.xyz;
}
_CL_OVERLOADABLE
float4
_cl_log (float4 x)
{
#if defined(SLEEF_VEC_128_AVAILABLE)
#ifdef MAX_PRECISION
return Sleef_logf4_u10 (x);
#else
return Sleef_logf4_u35 (x);
#endif
#else
float2 lo = _cl_log (x.lo);
float2 hi = _cl_log (x.hi);
return (float4) (lo, hi);
#endif
}
_CL_OVERLOADABLE
float8
_cl_log (float8 x)
{
#if defined(SLEEF_VEC_256_AVAILABLE)
#ifdef MAX_PRECISION
return Sleef_logf8_u10 (x);
#else
return Sleef_logf8_u35 (x);
#endif
#else
float4 lo = _cl_log (x.lo);
float4 hi = _cl_log (x.hi);
return (float8) (lo, hi);
#endif
}
_CL_OVERLOADABLE
float16
_cl_log (float16 x)
{
#if defined(SLEEF_VEC_512_AVAILABLE)
#ifdef MAX_PRECISION
return Sleef_logf16_u10 (x);
#else
return Sleef_logf16_u35 (x);
#endif
#else
float8 lo = _cl_log (x.lo);
float8 hi = _cl_log (x.hi);
return (float16) (lo, hi);
#endif
}
#ifdef cl_khr_fp64
_CL_OVERLOADABLE
double
_cl_log (double x)
{
#ifdef MAX_PRECISION
return Sleef_log_u10 (x);
#else
return Sleef_log_u35 (x);
#endif
}
#endif /* cl_khr_fp64 */
#ifdef cl_khr_fp64
_CL_OVERLOADABLE
double2
_cl_log (double2 x)
{
#if defined(SLEEF_VEC_128_AVAILABLE) && defined(SLEEF_DOUBLE_VEC_AVAILABLE)
#ifdef MAX_PRECISION
return Sleef_logd2_u10 (x);
#else
return Sleef_logd2_u35 (x);
#endif
#else
double lo = _cl_log (x.lo);
double hi = _cl_log (x.hi);
return (double2) (lo, hi);
#endif
}
#endif /* cl_khr_fp64 */
#ifdef cl_khr_fp64
_CL_OVERLOADABLE
double4 _cl_log (double4);
_CL_OVERLOADABLE
double3
_cl_log (double3 x)
{
double4 x_3to4 = (double4) (x, (double)0);
double4 r = _cl_log (x_3to4);
return r.xyz;
}
#endif /* cl_khr_fp64 */
#ifdef cl_khr_fp64
_CL_OVERLOADABLE
double4
_cl_log (double4 x)
{
#if defined(SLEEF_VEC_256_AVAILABLE) && defined(SLEEF_DOUBLE_VEC_AVAILABLE)
#ifdef MAX_PRECISION
return Sleef_logd4_u10 (x);
#else
return Sleef_logd4_u35 (x);
#endif
#else
double2 lo = _cl_log (x.lo);
double2 hi = _cl_log (x.hi);
return (double4) (lo, hi);
#endif
}
#endif /* cl_khr_fp64 */
#ifdef cl_khr_fp64
_CL_OVERLOADABLE
double8
_cl_log (double8 x)
{
#if defined(SLEEF_VEC_512_AVAILABLE) && defined(SLEEF_DOUBLE_VEC_AVAILABLE)
#ifdef MAX_PRECISION
return Sleef_logd8_u10 (x);
#else
return Sleef_logd8_u35 (x);
#endif
#else
double4 lo = _cl_log (x.lo);
double4 hi = _cl_log (x.hi);
return (double8) (lo, hi);
#endif
}
#endif /* cl_khr_fp64 */
#ifdef cl_khr_fp64
_CL_OVERLOADABLE
double16
_cl_log (double16 x)
{
double8 lo = _cl_log (x.lo);
double8 hi = _cl_log (x.hi);
return (double16) (lo, hi);
}
#endif /* cl_khr_fp64 */
|