libm_amd.h
1 /* 2 * Copyright (C) 2008-2020 Advanced Micro Devices, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 1. Redistributions of source code must retain the above copyright notice, 7 * this list of conditions and the following disclaimer. 8 * 2. Redistributions in binary form must reproduce the above copyright notice, 9 * this list of conditions and the following disclaimer in the documentation 10 * and/or other materials provided with the distribution. 11 * 3. Neither the name of the copyright holder nor the names of its contributors 12 * may be used to endorse or promote products derived from this software without 13 * specific prior written permission. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 21 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * POSSIBILITY OF SUCH DAMAGE. 25 * 26 */ 27 28 #ifndef LIBM_AMD_H_INCLUDED 29 #define LIBM_AMD_H_INCLUDED 1 30 31 #include "libm_macros.h" 32 #ifdef WIN64 33 #include <intrin.h> 34 #else 35 #include <immintrin.h> 36 #endif 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 43 double FN_PROTOTYPE(cbrt)(double x); 44 float FN_PROTOTYPE(cbrtf)(float x); 45 46 double FN_PROTOTYPE(fabs)(double x); 47 float FN_PROTOTYPE(fabsf)(float x); 48 49 double FN_PROTOTYPE(acos)(double x); 50 float FN_PROTOTYPE(acosf)(float x); 51 52 double FN_PROTOTYPE(acosh)(double x); 53 float FN_PROTOTYPE(acoshf)(float x); 54 55 double FN_PROTOTYPE(asin)(double x); 56 float FN_PROTOTYPE(asinf)(float x); 57 58 double FN_PROTOTYPE( asinh)(double x); 59 float FN_PROTOTYPE(asinhf)(float x); 60 61 double FN_PROTOTYPE( atan)(double x); 62 float FN_PROTOTYPE(atanf)(float x); 63 64 double FN_PROTOTYPE( atanh)(double x); 65 float FN_PROTOTYPE(atanhf)(float x); 66 67 double FN_PROTOTYPE( atan2)(double x, double y); 68 float FN_PROTOTYPE(atan2f)(float x, float y); 69 70 double FN_PROTOTYPE( ceil)(double x); 71 float FN_PROTOTYPE(ceilf)(float x); 72 73 74 double FN_PROTOTYPE( cos)(double x); 75 float FN_PROTOTYPE(cosf)(float x); 76 77 78 double FN_PROTOTYPE( exp)(double x); 79 float FN_PROTOTYPE(expf)(float x); 80 81 double FN_PROTOTYPE( expm1)(double x); 82 float FN_PROTOTYPE(expm1f)(float x); 83 84 double FN_PROTOTYPE( exp2)(double x); 85 float FN_PROTOTYPE(exp2f)(float x); 86 87 double FN_PROTOTYPE( exp10)(double x); 88 float FN_PROTOTYPE(exp10f)(float x); 89 90 91 double FN_PROTOTYPE( fdim)(double x, double y); 92 float FN_PROTOTYPE(fdimf)(float x, float y); 93 94 #ifdef WINDOWS 95 int FN_PROTOTYPE(finite)(double x); 96 int FN_PROTOTYPE(finitef)(float x); 97 #else 98 int FN_PROTOTYPE(finite)(double x); 99 int FN_PROTOTYPE(finitef)(float x); 100 #endif 101 102 double FN_PROTOTYPE( floor)(double x); 103 float FN_PROTOTYPE(floorf)(float x); 104 105 double FN_PROTOTYPE( fma)(double x, double y, double z); 106 float FN_PROTOTYPE(fmaf)(float x, float y, float z); 107 108 double FN_PROTOTYPE( fmax)(double x, double y); 109 float FN_PROTOTYPE(fmaxf)(float x, float y); 110 111 double FN_PROTOTYPE( fmin)(double x, double y); 112 float FN_PROTOTYPE(fminf)(float x, float y); 113 114 double FN_PROTOTYPE( fmod)(double x, double y); 115 float FN_PROTOTYPE(fmodf)(float x, float y); 116 117 #ifdef WINDOWS 118 double FN_PROTOTYPE( hypot)(double x, double y); 119 float FN_PROTOTYPE(hypotf)(float x, float y); 120 #else 121 double FN_PROTOTYPE( hypot)(double x, double y); 122 float FN_PROTOTYPE(hypotf)(float x, float y); 123 #endif 124 125 float FN_PROTOTYPE(ldexpf)(float x, int exp); 126 127 double FN_PROTOTYPE(ldexp)(double x, int exp); 128 129 double FN_PROTOTYPE( log)(double x); 130 float FN_PROTOTYPE(logf)(float x); 131 132 133 float FN_PROTOTYPE(log2f)(float x); 134 135 double FN_PROTOTYPE( log10)(double x); 136 float FN_PROTOTYPE(log10f)(float x); 137 138 139 float FN_PROTOTYPE(log1pf)(float x); 140 141 #ifdef WINDOWS 142 double FN_PROTOTYPE( logb)(double x); 143 float FN_PROTOTYPE(logbf)(float x); 144 #else 145 double FN_PROTOTYPE( logb)(double x); 146 float FN_PROTOTYPE(logbf)(float x); 147 #endif 148 149 double FN_PROTOTYPE( modf)(double x, double *iptr); 150 float FN_PROTOTYPE(modff)(float x, float *iptr); 151 152 double FN_PROTOTYPE( pow)(double x, double y); 153 float FN_PROTOTYPE(powf)(float x, float y); 154 double FN_PROTOTYPE(fastpow)(double x, double y); 155 156 double FN_PROTOTYPE(zen_pow)(double x, double y); // VK New "pow" function added. 157 158 double FN_PROTOTYPE( remainder)(double x, double y); 159 float FN_PROTOTYPE(remainderf)(float x, float y); 160 161 double FN_PROTOTYPE(sin)(double x); 162 float FN_PROTOTYPE(sinf)(float x); 163 164 double FN_PROTOTYPE(sinpi)(double x); 165 float FN_PROTOTYPE(sinpif)(float x); 166 167 double FN_PROTOTYPE(cospi)(double x); 168 float FN_PROTOTYPE(cospif)(float x); 169 170 void FN_PROTOTYPE(sincos)(double x, double *s, double *c); 171 void FN_PROTOTYPE(sincosf)(float x, float *s, float *c); 172 173 double FN_PROTOTYPE( sinh)(double x); 174 float FN_PROTOTYPE(sinhf)(float x); 175 176 double FN_PROTOTYPE( sqrt)(double x); 177 float FN_PROTOTYPE(sqrtf)(float x); 178 179 double FN_PROTOTYPE( tan)(double x); 180 float FN_PROTOTYPE(tanf)(float x); 181 182 183 double FN_PROTOTYPE(tanpi)(double x); 184 float FN_PROTOTYPE(tanpif)(float x); 185 186 double FN_PROTOTYPE( tanh)(double x); 187 float FN_PROTOTYPE(tanhf)(float x); 188 189 double FN_PROTOTYPE( trunc)(double x); 190 float FN_PROTOTYPE(truncf)(float x); 191 192 double FN_PROTOTYPE( log1p)(double x); 193 double FN_PROTOTYPE( log2)(double x); 194 195 double FN_PROTOTYPE(cosh)(double x); 196 float FN_PROTOTYPE(coshf)(float fx); 197 198 double FN_PROTOTYPE(frexp)(double value, int *exp); 199 float FN_PROTOTYPE(frexpf)(float value, int *exp); 200 int FN_PROTOTYPE(ilogb)(double x); 201 int FN_PROTOTYPE(ilogbf)(float x); 202 203 long long int FN_PROTOTYPE(llrint)(double x); 204 long long int FN_PROTOTYPE(llrintf)(float x); 205 long int FN_PROTOTYPE(lrint)(double x); 206 long int FN_PROTOTYPE(lrintf)(float x); 207 long int FN_PROTOTYPE(lround)(double d); 208 long int FN_PROTOTYPE(lroundf)(float f); 209 double FN_PROTOTYPE(nan)(const char *tagp); 210 float FN_PROTOTYPE(nanf)(const char *tagp); 211 float FN_PROTOTYPE(nearbyintf)(float x); 212 double FN_PROTOTYPE(nearbyint)(double x); 213 double FN_PROTOTYPE(nextafter)(double x, double y); 214 float FN_PROTOTYPE(nextafterf)(float x, float y); 215 double FN_PROTOTYPE(nexttoward)(double x, long double y); 216 float FN_PROTOTYPE(nexttowardf)(float x, long double y); 217 double FN_PROTOTYPE(rint)(double x); 218 float FN_PROTOTYPE(rintf)(float x); 219 float FN_PROTOTYPE(roundf)(float f); 220 double FN_PROTOTYPE(round)(double f); 221 double FN_PROTOTYPE(scalbln)(double x, long int n); 222 float FN_PROTOTYPE(scalblnf)(float x, long int n); 223 double FN_PROTOTYPE(scalbn)(double x, int n); 224 float FN_PROTOTYPE(scalbnf)(float x, int n); 225 long long int FN_PROTOTYPE(llroundf)(float f); 226 long long int FN_PROTOTYPE(llround)(double d); 227 float FN_PROTOTYPE(remquof) (float x, float y, int *quo); 228 double FN_PROTOTYPE(remquo) (double x, double y, int *quo); 229 230 #ifdef WINDOWS 231 double FN_PROTOTYPE(copysign)(double x, double y); 232 float FN_PROTOTYPE(copysignf)(float x, float y); 233 #else 234 double FN_PROTOTYPE(copysign)(double x, double y); 235 float FN_PROTOTYPE(copysignf)(float x, float y); 236 #endif 237 238 __m128d FN_PROTOTYPE(vrd2_exp)(__m128d x); 239 __m128d FN_PROTOTYPE(vrd2_exp2)(__m128d x); 240 __m128d FN_PROTOTYPE(vrd2_exp10)(__m128d x); 241 __m128d FN_PROTOTYPE(vrd2_expm1)(__m128d x); 242 __m128d FN_PROTOTYPE(vrd2_sin)(__m128d x); 243 __m128d FN_PROTOTYPE(vrd2_cos)(__m128d x); 244 __m128d FN_PROTOTYPE(vrd2_cbrt)(__m128d x); 245 __m128d FN_PROTOTYPE(vrd2_log)(__m128d x); 246 __m128d FN_PROTOTYPE(vrd2_log2)(__m128d x); 247 __m128d FN_PROTOTYPE(vrd2_log10)(__m128d x); 248 __m128d FN_PROTOTYPE(vrd2_log1p)(__m128d x); 249 __m128d FN_PROTOTYPE(vrd2_pow)(__m128d x, __m128d y); 250 __m128d FN_PROTOTYPE(vrd2_tan)(__m128d x); 251 __m128d FN_PROTOTYPE(vrd2_cosh)(__m128d x); 252 253 __m256d FN_PROTOTYPE(vrd4_exp)(__m256d x); 254 __m256d FN_PROTOTYPE(vrd4_exp2)(__m256d x); 255 __m256d FN_PROTOTYPE(vrd4_expm1)(__m256d x); 256 __m256d FN_PROTOTYPE(vrd4_log)(__m256d x); 257 __m256d FN_PROTOTYPE(vrd4_pow)(__m256d x, __m256d y); 258 259 __m128 FN_PROTOTYPE(vrs4_expf)(__m128 x); 260 __m128 FN_PROTOTYPE(vrs4_exp2f)(__m128 x); 261 __m128 FN_PROTOTYPE(vrs4_exp10f)(__m128 x); 262 __m128 FN_PROTOTYPE(vrs4_expm1f)(__m128 x); 263 __m128 FN_PROTOTYPE(vrs4_sinf)(__m128 x); 264 __m128 FN_PROTOTYPE(vrs4_cosf)(__m128 x); 265 __m128 FN_PROTOTYPE(vrs4_cbrtf)(__m128 x); 266 __m128 FN_PROTOTYPE(vrs4_logf)(__m128 x); 267 __m128 FN_PROTOTYPE(vrs4_log2f)(__m128 x); 268 __m128 FN_PROTOTYPE(vrs4_log10f)(__m128 x); 269 __m128 FN_PROTOTYPE(vrs4_log1pf)(__m128 x); 270 __m128 FN_PROTOTYPE(vrs4_powf)(__m128 x, __m128 y); 271 __m128 FN_PROTOTYPE(vrs4_powxf)(__m128 x, float y); 272 __m128 FN_PROTOTYPE(vrs4_tanf)(__m128 x); 273 274 __m256 FN_PROTOTYPE(vrs8_logf)(__m256 x); 275 __m256 FN_PROTOTYPE(vrs8_powf)(__m256 x, __m256 y); 276 277 void FN_PROTOTYPE(vrd2_sincos)(__m128d x, __m128d* ys, __m128d* yc); 278 void FN_PROTOTYPE(vrda_sincos)(int n, double *x, double *ys, double *yc); 279 280 void FN_PROTOTYPE(vrs4_sincosf)(__m128 x, __m128* ys, __m128* yc); 281 void FN_PROTOTYPE(vrsa_sincosf)(int n, float *x, float *ys, float *yc); 282 283 void FN_PROTOTYPE(vrda_exp)(int len, double* x, double* y); 284 void FN_PROTOTYPE(vrsa_expf)(int len, float* x, float* y); 285 void FN_PROTOTYPE(vrda_exp10)(int len, double* x, double* y); 286 void FN_PROTOTYPE(vrsa_exp10f)(int len, float* x, float* y); 287 void FN_PROTOTYPE(vrda_exp2)(int len, double* x, double* y); 288 void FN_PROTOTYPE(vrsa_exp2f)(int len, float* x, float* y); 289 void FN_PROTOTYPE(vrda_expm1)(int len, double* x, double* y); 290 void FN_PROTOTYPE(vrsa_expm1f)(int len, float* x, float* y); 291 void FN_PROTOTYPE(vrda_sin)(int n, double *x, double *y); 292 void FN_PROTOTYPE(vrsa_sinf)(int n, float *x, float *y); 293 void FN_PROTOTYPE(vrda_cos)(int n, double *x, double *y); 294 void FN_PROTOTYPE(vrsa_cosf)(int n, float *x, float *y); 295 void FN_PROTOTYPE(vrsa_cbrtf)( int len, float *src, float* dst ); 296 void FN_PROTOTYPE(vrda_cbrt)( int len, double *src, double* dst ); 297 void FN_PROTOTYPE(vrsa_logf)( int len, float *src, float* dst ); 298 void FN_PROTOTYPE(vrda_log)( int len, double *src, double* dst ); 299 void FN_PROTOTYPE(vrsa_log2f)( int len, float *src, float* dst ); 300 void FN_PROTOTYPE(vrda_log2)( int len, double *src, double* dst ); 301 void FN_PROTOTYPE(vrsa_log10f)( int len, float *src, float* dst ); 302 void FN_PROTOTYPE(vrda_log10)( int len, double *src, double* dst ); 303 void FN_PROTOTYPE(vrsa_log1pf)( int len, float *src, float* dst ); 304 void FN_PROTOTYPE(vrda_log1p)( int len, double *src, double* dst ); 305 void FN_PROTOTYPE(vrsa_powxf)( int len, float *src1, float src2, float* dst ); 306 void FN_PROTOTYPE(vrsa_powf)( int len, float *src1, float *src2, float* dst ); 307 308 309 #ifdef __cplusplus 310 } 311 #endif 312 313 #endif /* LIBM_AMD_H_INCLUDED */