/ include / libm / iface.h
iface.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_IFACE_H__
 29  #define __AMD_LIBM_IFACE_H__
 30  
 31  
 32  #if defined(__cplusplus)
 33  extern "C" {
 34  #endif
 35  
 36  
 37  enum {
 38      /* We leave '0', */
 39      C_AMD_ACOS = 1,
 40      C_AMD_ACOSH,
 41      C_AMD_ASIN,
 42      C_AMD_ASINH,
 43      C_AMD_ATAN2,
 44      C_AMD_ATAN,
 45      C_AMD_ATANH,
 46      C_AMD_CBRT,
 47      C_AMD_CEIL,
 48      C_AMD_COPYSIGN,
 49      C_AMD_COS,
 50      C_AMD_COSH,
 51      C_AMD_COSPI,
 52      C_AMD_EXP10,
 53      C_AMD_EXP2,
 54      C_AMD_EXP,
 55      C_AMD_EXPM1,
 56      C_AMD_FABS,
 57      C_AMD_FDIM,
 58      C_AMD_FLOOR,
 59      C_AMD_FMA,
 60      C_AMD_FMAX,
 61      C_AMD_FMIN,
 62      C_AMD_FMOD,
 63      C_AMD_FREXP,
 64      C_AMD_HYPOT,
 65      C_AMD_LDEXP,
 66      C_AMD_LOG10,
 67      C_AMD_LOG1P,
 68      C_AMD_LOG2,
 69      C_AMD_LOGB,
 70      C_AMD_LOG,
 71      C_AMD_MODF,
 72      C_AMD_NAN,
 73      C_AMD_NEARBYINT,
 74      C_AMD_NEXTAFTER,
 75      C_AMD_NEXTTOWARD,
 76      C_AMD_POW,
 77      C_AMD_REMAINDER,
 78      C_AMD_REMQUO,
 79      C_AMD_RINT,
 80      C_AMD_ROUND,
 81      C_AMD_SCALBLN,
 82      C_AMD_SCALBN,
 83      C_AMD_SIN,
 84      C_AMD_SINH,
 85      C_AMD_SINPI,
 86      C_AMD_SQRT,
 87      C_AMD_TAN,
 88      C_AMD_TANH,
 89      C_AMD_TANPI,
 90      C_AMD_TRUNC,
 91  
 92      /*
 93       * INTEGER VARIANTS
 94       */
 95      C_AMD_FINITE,
 96      C_AMD_ILOGB,
 97      C_AMD_LRINT,
 98      C_AMD_LROUND,
 99      C_AMD_LLRINT,
100      C_AMD_LLROUND,
101  
102      /*
103       * This one needs to be last one, REALLY !!!
104       */
105      C_AMD_LAST_ENTRY,
106  };
107  
108  #if defined(__cplusplus)
109  }
110  #endif
111  
112  #define LIBM_IFACE_PROTO(fn) libm_iface_amd_##fn
113  
114  /* INIT function for libm */
115  extern void libm_iface_init(void);
116  
117  /* function specific initilizer */
118  extern void LIBM_IFACE_PROTO(acos)(void *arg);
119  extern void LIBM_IFACE_PROTO(acosh)(void *arg);
120  extern void LIBM_IFACE_PROTO(asin)(void *arg);
121  extern void LIBM_IFACE_PROTO(asinh)(void *arg);
122  extern void LIBM_IFACE_PROTO(atan2)(void *arg);
123  extern void LIBM_IFACE_PROTO(atan)(void *arg);
124  extern void LIBM_IFACE_PROTO(atanh)(void *arg);
125  extern void LIBM_IFACE_PROTO(cbrt)(void *arg);
126  extern void LIBM_IFACE_PROTO(ceil)(void *arg);
127  extern void LIBM_IFACE_PROTO(copysign)(void *arg);
128  extern void LIBM_IFACE_PROTO(cos)(void *arg);
129  extern void LIBM_IFACE_PROTO(cosh)(void *arg);
130  extern void LIBM_IFACE_PROTO(cospi)(void *arg);
131  extern void LIBM_IFACE_PROTO(exp10)(void *arg);
132  extern void LIBM_IFACE_PROTO(exp2)(void *arg);
133  extern void LIBM_IFACE_PROTO(exp)(void *arg);
134  extern void LIBM_IFACE_PROTO(expm1)(void *arg);
135  extern void LIBM_IFACE_PROTO(fabs)(void *arg);
136  extern void LIBM_IFACE_PROTO(finite)(void *arg);
137  extern void LIBM_IFACE_PROTO(fastpow)(void *arg);
138  extern void LIBM_IFACE_PROTO(fdim)(void *arg);
139  extern void LIBM_IFACE_PROTO(floor)(void *arg);
140  extern void LIBM_IFACE_PROTO(fma)(void *arg);
141  extern void LIBM_IFACE_PROTO(fmax)(void *arg);
142  extern void LIBM_IFACE_PROTO(fmin)(void *arg);
143  extern void LIBM_IFACE_PROTO(fmod)(void *arg);
144  extern void LIBM_IFACE_PROTO(frexp)(void *arg);
145  extern void LIBM_IFACE_PROTO(hypot)(void *arg);
146  extern void LIBM_IFACE_PROTO(ldexp)(void *arg);
147  extern void LIBM_IFACE_PROTO(log10)(void *arg);
148  extern void LIBM_IFACE_PROTO(log1p)(void *arg);
149  extern void LIBM_IFACE_PROTO(log2)(void *arg);
150  extern void LIBM_IFACE_PROTO(logb)(void *arg);
151  extern void LIBM_IFACE_PROTO(log)(void *arg);
152  extern void LIBM_IFACE_PROTO(lrint)(void *arg);
153  extern void LIBM_IFACE_PROTO(llrint)(void *arg);
154  extern void LIBM_IFACE_PROTO(lround)(void *arg);
155  extern void LIBM_IFACE_PROTO(llround)(void *arg);
156  extern void LIBM_IFACE_PROTO(ilogb)(void *arg);
157  extern void LIBM_IFACE_PROTO(modf)(void *arg);
158  extern void LIBM_IFACE_PROTO(nan)(void *arg);
159  extern void LIBM_IFACE_PROTO(nearbyint)(void *arg);
160  extern void LIBM_IFACE_PROTO(nextafter)(void *arg);
161  extern void LIBM_IFACE_PROTO(nexttoward)(void *arg);
162  extern void LIBM_IFACE_PROTO(pow)(void *arg);
163  extern void LIBM_IFACE_PROTO(remainder)(void *arg);
164  extern void LIBM_IFACE_PROTO(remquo)(void *arg);
165  extern void LIBM_IFACE_PROTO(rint)(void *arg);
166  extern void LIBM_IFACE_PROTO(round)(void *arg);
167  extern void LIBM_IFACE_PROTO(scalbln)(void *arg);
168  extern void LIBM_IFACE_PROTO(scalbn)(void *arg);
169  extern void LIBM_IFACE_PROTO(sin)(void *arg);
170  extern void LIBM_IFACE_PROTO(sinh)(void *arg);
171  extern void LIBM_IFACE_PROTO(sinpi)(void *arg);
172  extern void LIBM_IFACE_PROTO(sqrt)(void *arg);
173  extern void LIBM_IFACE_PROTO(tan)(void *arg);
174  extern void LIBM_IFACE_PROTO(tanh)(void *arg);
175  extern void LIBM_IFACE_PROTO(tanpi)(void *arg);
176  extern void LIBM_IFACE_PROTO(trunc)(void *arg);
177  
178  struct entry_pt_interface {
179      void (*epi_init)(void *arg);
180      void *epi_arg;
181  };
182  
183  extern struct entry_pt_interface entry_pt_initializers[C_AMD_LAST_ENTRY];
184  
185  #endif