/ include / libm / entry_pt.h
entry_pt.h
  1  /*
  2   * Copyright (C) 2018-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 __AMD_LIBM_ENTRY_PT_H__
 29  #define __AMD_LIBM_ENTRY_PT_H__
 30  
 31  #define G_ENTRY_PT(fn) (*g_amd_libm_ep_##fn)
 32  
 33  #define G_ENTRY_PT_ASM(fn) g_amd_libm_ep_##fn
 34  
 35  #define G_ENTRY_PT_PTR(fn) g_amd_libm_ep_##fn
 36  
 37  extern double G_ENTRY_PT(acos)(double x);
 38  extern double G_ENTRY_PT(acosh)(double x);
 39  extern double G_ENTRY_PT(asin)(double x);
 40  extern double G_ENTRY_PT(asinh)(double x);
 41  extern double G_ENTRY_PT(atan2)(double x, double y);
 42  extern double G_ENTRY_PT(atan)(double x);
 43  extern double G_ENTRY_PT(atanh)(double x);
 44  extern double G_ENTRY_PT(cbrt)(double x);
 45  extern double G_ENTRY_PT(ceil)(double x);
 46  extern double G_ENTRY_PT(copysign)(double x, double y);
 47  extern double G_ENTRY_PT(cos)(double x);
 48  extern double G_ENTRY_PT(cosh)(double x);
 49  extern double G_ENTRY_PT(cospi)(double x);
 50  extern double G_ENTRY_PT(exp10)(double x);
 51  extern double G_ENTRY_PT(exp2)(double x);
 52  extern double G_ENTRY_PT(exp)(double x);
 53  extern double G_ENTRY_PT(expm1)(double x);
 54  extern double G_ENTRY_PT(fabs)(double x);
 55  extern double G_ENTRY_PT(fastpow)(double x, double y);
 56  extern double G_ENTRY_PT(fdim)(double x, double y);
 57  extern double G_ENTRY_PT(floor)(double x);
 58  extern double G_ENTRY_PT(fma)(double x, double y, double z);
 59  extern double G_ENTRY_PT(fmax)(double x, double y);
 60  extern double G_ENTRY_PT(fmin)(double x, double y);
 61  extern double G_ENTRY_PT(fmod)(double x, double y);
 62  extern double G_ENTRY_PT(frexp)(double value, int *exp);
 63  extern double G_ENTRY_PT(hypot)(double x, double y);
 64  extern double G_ENTRY_PT(ldexp)(double x, int exp);
 65  extern double G_ENTRY_PT(log10)(double x);
 66  extern double G_ENTRY_PT(log1p)(double x);
 67  extern double G_ENTRY_PT(log2)(double x);
 68  extern double G_ENTRY_PT(logb)(double x);
 69  extern double G_ENTRY_PT(log)(double x);
 70  extern double G_ENTRY_PT(modf)(double x, double *iptr);
 71  extern double G_ENTRY_PT(nan)(const char *tagp);
 72  extern double G_ENTRY_PT(nearbyint)(double x);
 73  extern double G_ENTRY_PT(nextafter)(double x, double y);
 74  extern double G_ENTRY_PT(nexttoward)(double x, long double y);
 75  extern double G_ENTRY_PT(pow)(double x, double y);
 76  extern double G_ENTRY_PT(remainder)(double x, double y);
 77  extern double G_ENTRY_PT(remquo) (double x, double y, int *quo);
 78  extern double G_ENTRY_PT(rint)(double x);
 79  extern double G_ENTRY_PT(round)(double f);
 80  extern double G_ENTRY_PT(scalbln)(double x, long int n);
 81  extern double G_ENTRY_PT(scalbn)(double x, int n);
 82  extern double G_ENTRY_PT(sin)(double x);
 83  extern double G_ENTRY_PT(sinh)(double x);
 84  extern double G_ENTRY_PT(sinpi)(double x);
 85  extern double G_ENTRY_PT(sqrt)(double x);
 86  extern double G_ENTRY_PT(tan)(double x);
 87  extern double G_ENTRY_PT(tanh)(double x);
 88  extern double G_ENTRY_PT(tanpi)(double x);
 89  extern double G_ENTRY_PT(trunc)(double x);
 90  
 91  /*
 92   * Single Precision functions
 93   */
 94  extern float G_ENTRY_PT(acosf)(float x);
 95  extern float G_ENTRY_PT(acoshf)(float x);
 96  extern float G_ENTRY_PT(asinf)(float x);
 97  extern float G_ENTRY_PT(asinhf)(float x);
 98  extern float G_ENTRY_PT(atan2f)(float x, float y);
 99  extern float G_ENTRY_PT(atanf)(float x);
100  extern float G_ENTRY_PT(atanhf)(float x);
101  extern float G_ENTRY_PT(cbrtf)(float x);
102  extern float G_ENTRY_PT(ceilf)(float x);
103  extern float G_ENTRY_PT(copysignf)(float x, float y);
104  extern float G_ENTRY_PT(cosf)(float x);
105  extern float G_ENTRY_PT(coshf)(float fx);
106  extern float G_ENTRY_PT(cospif)(float x);
107  extern float G_ENTRY_PT(exp10f)(float x);
108  extern float G_ENTRY_PT(exp2f)(float x);
109  extern float G_ENTRY_PT(expf)(float x);
110  extern float G_ENTRY_PT(expm1f)(float x);
111  extern float G_ENTRY_PT(fabsf)(float x);
112  extern float G_ENTRY_PT(fdimf)(float x, float y);
113  extern float G_ENTRY_PT(floorf)(float x);
114  extern float G_ENTRY_PT(fmaf)(float x, float y, float z);
115  extern float G_ENTRY_PT(fmaxf)(float x, float y);
116  extern float G_ENTRY_PT(fminf)(float x, float y);
117  extern float G_ENTRY_PT(fmodf)(float x, float y);
118  extern float G_ENTRY_PT(frexpf)(float value, int *exp);
119  extern float G_ENTRY_PT(hypotf)(float x, float y);
120  extern float G_ENTRY_PT(ldexpf)(float x, int exp);
121  extern float G_ENTRY_PT(log10f)(float x);
122  extern float G_ENTRY_PT(log1pf)(float x);
123  extern float G_ENTRY_PT(log2f)(float x);
124  extern float G_ENTRY_PT(logbf)(float x);
125  extern float G_ENTRY_PT(logf)(float x);
126  extern float G_ENTRY_PT(modff)(float x, float *iptr);
127  extern float G_ENTRY_PT(nanf)(const char *tagp);
128  extern float G_ENTRY_PT(nearbyintf)(float x);
129  extern float G_ENTRY_PT(nextafterf)(float x, float y);
130  extern float G_ENTRY_PT(nexttowardf)(float x, long double y);
131  extern float G_ENTRY_PT(powf)(float x, float y);
132  extern float G_ENTRY_PT(remainderf)(float x, float y);
133  extern float G_ENTRY_PT(remquof) (float x, float y, int *quo);
134  extern float G_ENTRY_PT(rintf)(float x);
135  extern float G_ENTRY_PT(roundf)(float f);
136  extern float G_ENTRY_PT(scalblnf)(float x, long int n);
137  extern float G_ENTRY_PT(scalbnf)(float x, int n);
138  extern float G_ENTRY_PT(sinf)(float x);
139  extern float G_ENTRY_PT(sinhf)(float x);
140  extern float G_ENTRY_PT(sinpif)(float x);
141  extern float G_ENTRY_PT(sqrtf)(float x);
142  extern float G_ENTRY_PT(tanf)(float x);
143  extern float G_ENTRY_PT(tanhf)(float x);
144  extern float G_ENTRY_PT(tanpif)(float x);
145  extern float G_ENTRY_PT(truncf)(float x);
146  
147  /*
148   * Integer variants
149   */
150  extern int G_ENTRY_PT(finite)(double x);
151  extern int G_ENTRY_PT(finitef)(float x);
152  extern int G_ENTRY_PT(ilogb)(double x);
153  extern int G_ENTRY_PT(ilogbf)(float x);
154  extern long int G_ENTRY_PT(lrint)(double x);
155  extern long int G_ENTRY_PT(lrintf)(float x);
156  extern long int G_ENTRY_PT(lround)(double d);
157  extern long int G_ENTRY_PT(lroundf)(float f);
158  extern long long int G_ENTRY_PT(llrint)(double x);
159  extern long long int G_ENTRY_PT(llrintf)(float x);
160  extern long long int G_ENTRY_PT(llround)(double d);
161  extern long long int G_ENTRY_PT(llroundf)(float f);
162  
163  extern void G_ENTRY_PT(vrda_exp)(int, double*, double*);
164  extern void G_ENTRY_PT(vrda_exp2)(int, double*, double*);
165  extern void G_ENTRY_PT(vrda_exp10)(int, double*, double*);
166  extern void G_ENTRY_PT(vrda_expm1)(int, double*, double*);
167  extern void G_ENTRY_PT(vrsa_expf)(int, float*, float*);
168  extern void G_ENTRY_PT(vrsa_exp2f)(int, float*, float*);
169  extern void G_ENTRY_PT(vrsa_exp10f)(int, float*, float*);
170  extern void G_ENTRY_PT(vrsa_expm1f)(int, float*, float*);
171  extern void G_ENTRY_PT(vrda_cbrt)(int, double*, double*);
172  extern void G_ENTRY_PT(vrda_log)(int, double*, double*);
173  extern void G_ENTRY_PT(vrda_log10)(int, double*, double*);
174  extern void G_ENTRY_PT(vrda_log1p)(int, double*, double*);
175  extern void G_ENTRY_PT(vrda_log2)(int, double*, double*);
176  extern void G_ENTRY_PT(vrda_cos)(int, double*, double*);
177  extern void G_ENTRY_PT(vrda_sin)(int, double*, double*);
178  
179  extern void G_ENTRY_PT(vrsa_cosf)(int, float*, float*);
180  extern void G_ENTRY_PT(vrsa_log1pf)(int, float*, float*);
181  extern void G_ENTRY_PT(vrsa_sinf)(int, float*, float*);
182  extern void G_ENTRY_PT(vrsa_log2f)(int, float*, float*);
183  extern void G_ENTRY_PT(vrsa_cbrtf)(int, float*, float*);
184  extern void G_ENTRY_PT(vrsa_log10f)(int, float*, float*);
185  extern void G_ENTRY_PT(vrsa_logf)(int, float*, float*);
186  
187  #ifndef _MSC_VER
188  extern void  G_ENTRY_PT(sincos)(double,double *,double *);
189  extern void  G_ENTRY_PT(sincosf)(float,float *,float *);
190  #endif
191  
192  #include <immintrin.h>
193  
194  extern __m128  G_ENTRY_PT(vrs4_expf)(__m128);
195  extern __m128  G_ENTRY_PT(vrs4_exp2f)(__m128);
196  extern __m128  G_ENTRY_PT(vrs4_exp10f)(__m128);
197  extern __m128  G_ENTRY_PT(vrs4_expm1f)(__m128);
198  extern __m128  G_ENTRY_PT(vrs4_logf)(__m128);
199  extern __m128  G_ENTRY_PT(vrs4_powf)(__m128, __m128);
200  extern __m128  G_ENTRY_PT(vrs4_log2f)(__m128);
201  extern __m128  G_ENTRY_PT(vrs4_log10f)(__m128);
202  extern __m128  G_ENTRY_PT(vrs4_log1pf)(__m128);
203  extern __m128  G_ENTRY_PT(vrs4_cosf)(__m128);
204  extern __m128  G_ENTRY_PT(vrs4_sinf)(__m128);
205  extern __m128  G_ENTRY_PT(vrs4_tanf)(__m128);
206  extern __m128  G_ENTRY_PT(vrs4_cbrtf)(__m128);
207  
208  extern __m256  G_ENTRY_PT(vrs8_cosf)(__m256);
209  extern __m256  G_ENTRY_PT(vrs8_expf)(__m256);
210  extern __m256  G_ENTRY_PT(vrs8_log2f)(__m256);
211  extern __m256  G_ENTRY_PT(vrs8_log10f)(__m256);
212  extern __m256  G_ENTRY_PT(vrs8_logf)(__m256);
213  extern __m256  G_ENTRY_PT(vrs8_sinf)(__m256);
214  extern __m256  G_ENTRY_PT(vrs8_tanf)(__m256);
215  extern __m256  G_ENTRY_PT(vrs8_powf)(__m256, __m256);
216  
217  extern __m128d G_ENTRY_PT(vrd2_cbrt)(__m128d);
218  extern __m128d G_ENTRY_PT(vrd2_cos)(__m128d);
219  extern __m128d G_ENTRY_PT(vrd2_exp)(__m128d);
220  extern __m128d G_ENTRY_PT(vrd2_exp2)(__m128d);
221  extern __m128d G_ENTRY_PT(vrd2_exp10)(__m128d);
222  extern __m128d G_ENTRY_PT(vrd2_expm1)(__m128d);
223  extern __m128d G_ENTRY_PT(vrd2_log)(__m128d);
224  extern __m128d G_ENTRY_PT(vrd2_log2)(__m128d);
225  extern __m128d G_ENTRY_PT(vrd2_log10)(__m128d);
226  extern __m128d G_ENTRY_PT(vrd2_log1p)(__m128d);
227  extern __m128d G_ENTRY_PT(vrd2_pow)(__m128d, __m128d);
228  extern __m128d G_ENTRY_PT(vrd2_sin)(__m128d);
229  extern __m128d G_ENTRY_PT(vrd2_tan)(__m128d);
230  
231  extern __m256d G_ENTRY_PT(vrd4_exp)(__m256d);
232  extern __m256d G_ENTRY_PT(vrd4_exp2)(__m256d);
233  extern __m256d G_ENTRY_PT(vrd4_expm1)(__m256d);
234  extern __m256d G_ENTRY_PT(vrd4_log)(__m256d);
235  extern __m256d G_ENTRY_PT(vrd4_pow)(__m256d, __m256d);
236  extern __m256d G_ENTRY_PT(vrd4_sin)(__m256d);
237  
238  #endif	/* __AMD_LIBM_ENTRY_PT_H__ */
239