1 /*
2  * Copyright (c) 2015-2018, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef MTH_H_
19 #define MTH_H_
20 
21 /*  mth.h - 'parameterize' the names of the __mth_i/__fmth_i ... functions.
22  *          Macros are not used for the new naming conventions, i.e.,
23  *             _f[sv][sd]_BASE, _g[sv][sdcz]_BASE[L]
24  *
25  *  New ...
26  *  Create the function representing a math routine:
27  *  Name is
28  *     __<ftype><data type>_<name>_<vectlen><mask>
29  *
30  * <ftype>     : f - fastmath (default)
31  *               r - relaxed math (-Mfprelaxed ...)
32  *               p - precise math (-Kieee)
33  * <data type> : s - single precision
34  *               d - double precision
35  *               c - single precision complex
36  *               z - double precision complex
37  * <name>      : exp, log, log10, pow, powi, powk, powi1, powk1, sin, cos,
38  *               tan, asin, acos, atan, sinh, cosh, tanh, atan2,
39  * <vectlen>   : 1 (scalar), 2, 4, 8, 16
40  * <mask>      : m or null
41  *
42 exp
43 log
44 log10
45 pow
46 powi
47 powk
48 powi1
49 powk1
50 sin
51 cos
52 tan
53 asin
54 acos
55 atan
56 sinh
57 cosh
58 tanh
59 atan2
60 div
61 mod
62 floor
63 ceil
64 aint
65  */
66 
67 typedef enum MTH_FN {
68   MTH_acos,
69   MTH_asin,
70   MTH_atan,
71   MTH_atan2,
72   MTH_cos,
73   MTH_cosh,
74   MTH_div,
75   MTH_exp,
76   MTH_log,
77   MTH_log10,
78   MTH_pow,
79   MTH_powi,
80   MTH_powk,
81   MTH_powi1,
82   MTH_powk1,
83   MTH_sin,
84   MTH_sincos,
85   MTH_sinh,
86   MTH_sqrt,
87   MTH_tan,
88   MTH_tanh,
89   MTH_mod,
90   MTH_floor,
91   MTH_ceil,
92   MTH_aint
93 } MTH_FN;
94 
95 #define MTH_I_DFIXK "__mth_i_dfixk"
96 
97 #define MTH_I_DFIXUK "__mth_i_dfixuk"
98 
99 #define MTH_I_DFLOATK "__mth_i_dfloatk"
100 #define MTH_I_DFLOATUK "__mth_i_dfloatuk"
101 #define MTH_I_DRSQRT "__mth_i_drsqrt"
102 #define MTH_I_FIXK "__mth_i_fixk"
103 #define MTH_I_FIXUK "__mth_i_fixuk"
104 #define MTH_I_FLOATK "__mth_i_floatk"
105 #define MTH_I_FLOATUK "__mth_i_floatuk"
106 #define MTH_I_FRSQRT "__mth_i_frsqrt"
107 #define MTH_I_KCMP "__mth_i_kcmp"
108 #define MTH_I_KICSHFT "__mth_i_kicshft"
109 #define MTH_I_UKICSHFT "__mth_i_ukicshft"
110 #define MTH_I_KULSHIFT "__mth_i_klshift"
111 #define MTH_I_KRSHIFT "__mth_i_krshift"
112 #define MTH_I_KURSHIFT "__mth_i_kurshift"
113 
114 #define MTH_I_NINT "__mth_i_nint"
115 #define MTH_I_KNINT "__mth_i_knint"
116 #define MTH_I_IDNINT "__mth_i_idnint"
117 #define MTH_I_KIDNINT "__mth_i_kidnnt"
118 
119 #define MTH_I_FLOATU "__mth_i_floatu"
120 #define MTH_I_DFLOATU "__mth_i_dfloatu"
121 
122 #define MTH_I_ATAN "__mth_i_atan"
123 #define MTH_I_DATAN "__mth_i_datan"
124 #define MTH_I_SIN "__mth_i_sin"
125 #define MTH_I_COS "__mth_i_cos"
126 #define MTH_I_SINCOS "__mth_i_sincos"
127 #define MTH_I_TAN "__mth_i_tan"
128 #define MTH_I_DSIN "__mth_i_dsin"
129 #define MTH_I_DCOS "__mth_i_dcos"
130 #define MTH_I_DSINCOS "__mth_i_dsincos"
131 #define MTH_I_DTAN "__mth_i_dtan"
132 #define MTH_I_RPOWI "__mth_i_rpowi"
133 #define MTH_I_RPOWK "__mth_i_rpowk"
134 #define MTH_I_RPOWF "__mth_i_rpowr"
135 #define MTH_I_DPOWI "__mth_i_dpowi"
136 #define MTH_I_DPOWK "__mth_i_dpowk"
137 #define MTH_I_DPOWD "__mth_i_dpowd"
138 #define MTH_I_FSIGN "__mth_i_sign"
139 #define MTH_I_DSIGN "__mth_i_dsign"
140 #define MTH_I_EXP "__mth_i_exp"
141 #define MTH_I_DEXP "__mth_i_dexp"
142 #define MTH_I_ALOG "__mth_i_alog"
143 #define MTH_I_DLOG "__mth_i_dlog"
144 #define MTH_I_ALOG10 "__mth_i_alog10"
145 #define MTH_I_DLOG10 "__mth_i_dlog10"
146 #define MTH_I_AMOD "__mth_i_amod"
147 #define MTH_I_DMOD "__mth_i_dmod"
148 #define MTH_I_SINH "__mth_i_sinh"
149 #define MTH_I_COSH "__mth_i_cosh"
150 #define MTH_I_TANH "__mth_i_tanh"
151 #define MTH_I_DSINH "__mth_i_dsinh"
152 #define MTH_I_DCOSH "__mth_i_dcosh"
153 #define MTH_I_DTANH "__mth_i_dtanh"
154 #define MTH_I_FFLOOR "__mth_i_ffloor"
155 #define MTH_I_DFLOOR "__mth_i_dfloor"
156 #define MTH_I_FCEIL "__mth_i_fceil"
157 #define MTH_I_DCEIL "__mth_i_dceil"
158 #define MTH_I_AINT "__mth_i_aint"
159 #define MTH_I_DINT "__mth_i_dint"
160 
161 #define MTH_I_JN "__mth_i_bessel_jn"
162 #define MTH_I_DJN "__mth_i_dbessel_jn"
163 #define MTH_I_YN "__mth_i_bessel_yn"
164 #define MTH_I_DYN "__mth_i_dbessel_yn"
165 
166 #define FMTH_I_RPOWF "__fmth_i_rpowr"
167 #define FMTH_I_DPOWD "__fmth_i_dpowd"
168 #define FMTH_I_EXP "__fmth_i_exp"
169 #define FMTH_I_DEXP "__fmth_i_dexp"
170 #define FMTH_I_ALOG "__fmth_i_alog"
171 #define FMTH_I_DLOG "__fmth_i_dlog"
172 #define FMTH_I_ALOG10 "__fmth_i_alog10"
173 #define FMTH_I_DLOG10 "__fmth_i_dlog10"
174 #define FMTH_I_CBRT "__fmth_i_cbrt"
175 #define FMTH_I_AMOD "__fmth_i_amod"
176 #define FMTH_I_DMOD "__fmth_i_dmod"
177 #define FMTH_I_SIN "__fmth_i_sin"
178 #define FMTH_I_DSIN "__fmth_i_dsin"
179 #define FMTH_I_COS "__fmth_i_cos"
180 #define FMTH_I_DCOS "__fmth_i_dcos"
181 #define FMTH_I_SINCOS "__fmth_i_sincos"
182 #define FMTH_I_DSINCOS "__fmth_i_dsincos"
183 #define FMTH_I_SINH "__fmth_i_sinh"
184 #define FMTH_I_COSH "__fmth_i_cosh"
185 #define FMTH_I_DSINH "__fmth_i_dsinh"
186 #define FMTH_I_DCOSH "__fmth_i_dcosh"
187 #define FMTH_I_TAN "__fmth_i_tan"
188 #define FMTH_I_DTAN "__fmth_i_dtan"
189 #define FMTH_I_CSDIV "__fsc_div"
190 #define FMTH_I_CDDIV "__fsz_div"
191 
192 #define MTH_I_ACOS "__mth_i_acos"
193 #define MTH_I_ASIN "__mth_i_asin"
194 #define MTH_I_ATAN2 "__mth_i_atan2"
195 #define MTH_I_DADD "__mth_i_dadd"
196 #define MTH_I_DACOS "__mth_i_dacos"
197 #define MTH_I_DASIN "__mth_i_dasin"
198 #define MTH_I_DATAN2 "__mth_i_datan2"
199 #define MTH_I_DBLE "__mth_i_dble"
200 #define MTH_I_DCMP "__mth_i_dcmp"
201 #define MTH_I_DDIV "__mth_i_ddiv"
202 #define MTH_I_IPOWI "__mth_i_ipowi"
203 #define MTH_I_KPOWI "__mth_i_kpowi"
204 #define MTH_I_KPOWK "__mth_i_kpowk"
205 #define MTH_I_DFIX "__mth_i_dfix"
206 #define MTH_I_DFLOAT "__mth_i_dfloat"
207 #define MTH_I_DFLOATK "__mth_i_dfloatk"
208 #define MTH_I_DFLOATUK "__mth_i_dfloatuk"
209 #define MTH_I_DMUL "__mth_i_dmul"
210 #define MTH_I_DSQRT "__mth_i_dsqrt"
211 #define MTH_I_DSUB "__mth_i_dsub"
212 #define MTH_I_FADD "__mth_i_fadd"
213 #define MTH_I_FCMP "__mth_i_fcmp"
214 #define MTH_I_FDIV "__mth_i_fdiv"
215 #define MTH_I_FIX "__mth_i_fix"
216 #define MTH_I_FLOAT "__mth_i_float"
217 #define MTH_I_FLOATK "__mth_i_floatk"
218 #define MTH_I_FLOATUK "__mth_i_floatuk"
219 #define MTH_I_FMUL "__mth_i_fmul"
220 #define MTH_I_FSUB "__mth_i_fsub"
221 #define MTH_I_IDIV "__mth_i_idiv"
222 #define MTH_I_IMOD "__mth_i_imod"
223 #define MTH_I_KADD "__mth_i_kadd"
224 #define MTH_I_KCMP "__mth_i_kcmp"
225 #define MTH_I_KCMPZ "__mth_i_kcmpz"
226 #define MTH_I_KDIV "__mth_i_kdiv"
227 #define MTH_I_KMUL "__mth_i_kmul"
228 #define MTH_I_KMAX "__mth_i_kmax"
229 #define MTH_I_KMIN "__mth_i_kmin"
230 #define MTH_I_KSUB "__mth_i_ksub"
231 #define MTH_I_KUCMP "__mth_i_kucmp"
232 #define MTH_I_KUCMPZ "__mth_i_kucmpz"
233 #define MTH_I_LOG "__mth_i_log"
234 #define MTH_I_LOG10 "__mth_i_log10"
235 #define MTH_I_QIDIV "__mth_i_qidiv"
236 #define MTH_I_RDIV "__mth_i_rdiv"
237 #define MTH_I_SNGL "__mth_i_sngl"
238 #define MTH_I_SQRT "__mth_i_sqrt"
239 #define MTH_I_UICMP "__mth_i_uicmp"
240 #define MTH_I_UIDIV "__mth_i_uidiv"
241 #define MTH_I_UIMOD "__mth_i_uimod"
242 #define MTH_I_UKDIV "__mth_i_ukdiv"
243 #define MTH_I_KULSHIFT "__mth_i_klshift"
244 #define MTH_I_KRSHIFT "__mth_i_krshift"
245 #define MTH_I_KURSHIFT "__mth_i_kurshift"
246 #define MTH_I_ILEADZI "__mth_i_ileadzi"
247 #define MTH_I_ILEADZ "__mth_i_ileadz"
248 #define MTH_I_KLEADZ "__mth_i_kleadz"
249 #define MTH_I_IPOPCNTI "__mth_i_ipopcnti"
250 #define MTH_I_IPOPCNT "__mth_i_ipopcnt"
251 #define MTH_I_KPOPCNT "__mth_i_kpopcnt"
252 #define MTH_I_IPOPPARI "__mth_i_ipoppari"
253 #define MTH_I_IPOPPAR "__mth_i_ipoppar"
254 #define MTH_I_KPOPPAR "__mth_i_kpoppar"
255 
256 #define MTH_I_KBITS "ftn_i_kibits"
257 #define MTH_I_KBSET "ftn_i_kibset"
258 #define MTH_I_KBTEST "ftn_i_bktest"
259 #define MTH_I_KBCLR "ftn_i_kibclr"
260 
261 #endif // MTH_H_
262