VecFuncs.def revision 360784
1//===-- VecFuncs.def - Library information -------------*- C++ -*-----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// This .def file will create mappings from scalar math functions to vector
10// functions along with their vectorization factor. The current support includes
11// such mappings for Accelerate framework, MASS vector library, and SVML library.
12// This .def file also allows creating an array of vector functions supported in
13// the specified framework or library.
14
15#if defined(TLI_DEFINE_MASSV_VECFUNCS_NAMES)
16#define TLI_DEFINE_MASSV_VECFUNCS
17#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF) VEC,
18#endif
19
20#if !(defined(TLI_DEFINE_VECFUNC))
21#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF) {SCAL, VEC, VF},
22#endif 
23
24#if defined(TLI_DEFINE_ACCELERATE_VECFUNCS)
25// Accelerate framework's Vector Functions
26
27// Floating-Point Arithmetic and Auxiliary Functions
28TLI_DEFINE_VECFUNC("ceilf", "vceilf", 4)
29TLI_DEFINE_VECFUNC("fabsf", "vfabsf", 4)
30TLI_DEFINE_VECFUNC("llvm.fabs.f32", "vfabsf", 4)
31TLI_DEFINE_VECFUNC("floorf", "vfloorf", 4)
32TLI_DEFINE_VECFUNC("sqrtf", "vsqrtf", 4)
33TLI_DEFINE_VECFUNC("llvm.sqrt.f32", "vsqrtf", 4)
34
35// Exponential and Logarithmic Functions
36TLI_DEFINE_VECFUNC("expf", "vexpf", 4)
37TLI_DEFINE_VECFUNC("llvm.exp.f32", "vexpf", 4)
38TLI_DEFINE_VECFUNC("expm1f", "vexpm1f", 4)
39TLI_DEFINE_VECFUNC("logf", "vlogf", 4)
40TLI_DEFINE_VECFUNC("llvm.log.f32", "vlogf", 4)
41TLI_DEFINE_VECFUNC("log1pf", "vlog1pf", 4)
42TLI_DEFINE_VECFUNC("log10f", "vlog10f", 4)
43TLI_DEFINE_VECFUNC("llvm.log10.f32", "vlog10f", 4)
44TLI_DEFINE_VECFUNC("logbf", "vlogbf", 4)
45
46// Trigonometric Functions
47TLI_DEFINE_VECFUNC("sinf", "vsinf", 4)
48TLI_DEFINE_VECFUNC("llvm.sin.f32", "vsinf", 4)
49TLI_DEFINE_VECFUNC("cosf", "vcosf", 4)
50TLI_DEFINE_VECFUNC("llvm.cos.f32", "vcosf", 4)
51TLI_DEFINE_VECFUNC("tanf", "vtanf", 4)
52TLI_DEFINE_VECFUNC("asinf", "vasinf", 4)
53TLI_DEFINE_VECFUNC("acosf", "vacosf", 4)
54TLI_DEFINE_VECFUNC("atanf", "vatanf", 4)
55
56// Hyperbolic Functions
57TLI_DEFINE_VECFUNC("sinhf", "vsinhf", 4)
58TLI_DEFINE_VECFUNC("coshf", "vcoshf", 4)
59TLI_DEFINE_VECFUNC("tanhf", "vtanhf", 4)
60TLI_DEFINE_VECFUNC("asinhf", "vasinhf", 4)
61TLI_DEFINE_VECFUNC("acoshf", "vacoshf", 4)
62TLI_DEFINE_VECFUNC("atanhf", "vatanhf", 4)
63
64
65#elif defined(TLI_DEFINE_MASSV_VECFUNCS)
66// IBM MASS library's vector Functions
67
68// Floating-Point Arithmetic and Auxiliary Functions
69TLI_DEFINE_VECFUNC("cbrt", "__cbrtd2_massv", 2)
70TLI_DEFINE_VECFUNC("cbrtf", "__cbrtf4_massv", 4)
71TLI_DEFINE_VECFUNC("pow", "__powd2_massv", 2)
72TLI_DEFINE_VECFUNC("llvm.pow.f64", "__powd2_massv", 2)
73TLI_DEFINE_VECFUNC("powf", "__powf4_massv", 4)
74TLI_DEFINE_VECFUNC("llvm.pow.f32", "__powf4_massv", 4)
75TLI_DEFINE_VECFUNC("sqrt", "__sqrtd2_massv", 2)
76TLI_DEFINE_VECFUNC("llvm.sqrt.f64", "__sqrtd2_massv", 2)
77TLI_DEFINE_VECFUNC("sqrtf", "__sqrtf4_massv", 4)
78TLI_DEFINE_VECFUNC("llvm.sqrt.f32", "__sqrtf4_massv", 4)
79
80// Exponential and Logarithmic Functions
81TLI_DEFINE_VECFUNC("exp", "__expd2_massv", 2)
82TLI_DEFINE_VECFUNC("llvm.exp.f64", "__expd2_massv", 2)
83TLI_DEFINE_VECFUNC("expf", "__expf4_massv", 4)
84TLI_DEFINE_VECFUNC("llvm.exp.f32", "__expf4_massv", 4)
85TLI_DEFINE_VECFUNC("exp2", "__exp2d2_massv", 2)
86TLI_DEFINE_VECFUNC("llvm.exp2.f64", "__exp2d2_massv", 2)
87TLI_DEFINE_VECFUNC("exp2f", "__exp2f4_massv", 4)
88TLI_DEFINE_VECFUNC("llvm.exp2.f32", "__exp2f4_massv", 4)
89TLI_DEFINE_VECFUNC("expm1", "__expm1d2_massv", 2)
90TLI_DEFINE_VECFUNC("expm1f", "__expm1f4_massv", 4)
91TLI_DEFINE_VECFUNC("log", "__logd2_massv", 2)
92TLI_DEFINE_VECFUNC("llvm.log.f64", "__logd2_massv", 2)
93TLI_DEFINE_VECFUNC("logf", "__logf4_massv", 4)
94TLI_DEFINE_VECFUNC("llvm.log.f32", "__logf4_massv", 4)
95TLI_DEFINE_VECFUNC("log1p", "__log1pd2_massv", 2)
96TLI_DEFINE_VECFUNC("log1pf", "__log1pf4_massv", 4)
97TLI_DEFINE_VECFUNC("log10", "__log10d2_massv", 2)
98TLI_DEFINE_VECFUNC("llvm.log10.f64", "__log10d2_massv", 2)
99TLI_DEFINE_VECFUNC("log10f", "__log10f4_massv", 4)
100TLI_DEFINE_VECFUNC("llvm.log10.f32", "__log10f4_massv", 4)
101TLI_DEFINE_VECFUNC("log2", "__log2d2_massv", 2)
102TLI_DEFINE_VECFUNC("llvm.log2.f64", "__log2d2_massv", 2)
103TLI_DEFINE_VECFUNC("log2f", "__log2f4_massv", 4)
104TLI_DEFINE_VECFUNC("llvm.log2.f32", "__log2f4_massv", 4)
105
106// Trigonometric Functions
107TLI_DEFINE_VECFUNC("sin", "__sind2_massv", 2)
108TLI_DEFINE_VECFUNC("llvm.sin.f64", "__sind2_massv", 2)
109TLI_DEFINE_VECFUNC("sinf", "__sinf4_massv", 4)
110TLI_DEFINE_VECFUNC("llvm.sin.f32", "__sinf4_massv", 4)
111TLI_DEFINE_VECFUNC("cos", "__cosd2_massv", 2)
112TLI_DEFINE_VECFUNC("llvm.cos.f64", "__cosd2_massv", 2)
113TLI_DEFINE_VECFUNC("cosf", "__cosf4_massv", 4)
114TLI_DEFINE_VECFUNC("llvm.cos.f32", "__cosf4_massv", 4)
115TLI_DEFINE_VECFUNC("tan", "__tand2_massv", 2)
116TLI_DEFINE_VECFUNC("tanf", "__tanf4_massv", 4)
117TLI_DEFINE_VECFUNC("asin", "__asind2_massv", 2)
118TLI_DEFINE_VECFUNC("asinf", "__asinf4_massv", 4)
119TLI_DEFINE_VECFUNC("acos", "__acosd2_massv", 2)
120TLI_DEFINE_VECFUNC("acosf", "__acosf4_massv", 4)
121TLI_DEFINE_VECFUNC("atan", "__atand2_massv", 2)
122TLI_DEFINE_VECFUNC("atanf", "__atanf4_massv", 4)
123TLI_DEFINE_VECFUNC("atan2", "__atan2d2_massv", 2)
124TLI_DEFINE_VECFUNC("atan2f", "__atan2f4_massv", 4)
125
126// Hyperbolic Functions
127TLI_DEFINE_VECFUNC("sinh", "__sinhd2_massv", 2)
128TLI_DEFINE_VECFUNC("sinhf", "__sinhf4_massv", 4)
129TLI_DEFINE_VECFUNC("cosh", "__coshd2_massv", 2)
130TLI_DEFINE_VECFUNC("coshf", "__coshf4_massv", 4)
131TLI_DEFINE_VECFUNC("tanh", "__tanhd2_massv", 2)
132TLI_DEFINE_VECFUNC("tanhf", "__tanhf4_massv", 4)
133TLI_DEFINE_VECFUNC("asinh", "__asinhd2_massv", 2)
134TLI_DEFINE_VECFUNC("asinhf", "__asinhf4_massv", 4)
135TLI_DEFINE_VECFUNC("acosh", "__acoshd2_massv", 2)
136TLI_DEFINE_VECFUNC("acoshf", "__acoshf4_massv", 4)
137TLI_DEFINE_VECFUNC("atanh", "__atanhd2_massv", 2)
138TLI_DEFINE_VECFUNC("atanhf", "__atanhf4_massv", 4)
139
140
141#elif defined(TLI_DEFINE_SVML_VECFUNCS)
142// Intel SVM library's Vector Functions
143
144TLI_DEFINE_VECFUNC("sin", "__svml_sin2", 2)
145TLI_DEFINE_VECFUNC("sin", "__svml_sin4", 4)
146TLI_DEFINE_VECFUNC("sin", "__svml_sin8", 8)
147
148TLI_DEFINE_VECFUNC("sinf", "__svml_sinf4", 4)
149TLI_DEFINE_VECFUNC("sinf", "__svml_sinf8", 8)
150TLI_DEFINE_VECFUNC("sinf", "__svml_sinf16", 16)
151
152TLI_DEFINE_VECFUNC("llvm.sin.f64", "__svml_sin2", 2)
153TLI_DEFINE_VECFUNC("llvm.sin.f64", "__svml_sin4", 4)
154TLI_DEFINE_VECFUNC("llvm.sin.f64", "__svml_sin8", 8)
155
156TLI_DEFINE_VECFUNC("llvm.sin.f32", "__svml_sinf4", 4)
157TLI_DEFINE_VECFUNC("llvm.sin.f32", "__svml_sinf8", 8)
158TLI_DEFINE_VECFUNC("llvm.sin.f32", "__svml_sinf16", 16)
159
160TLI_DEFINE_VECFUNC("cos", "__svml_cos2", 2)
161TLI_DEFINE_VECFUNC("cos", "__svml_cos4", 4)
162TLI_DEFINE_VECFUNC("cos", "__svml_cos8", 8)
163
164TLI_DEFINE_VECFUNC("cosf", "__svml_cosf4", 4)
165TLI_DEFINE_VECFUNC("cosf", "__svml_cosf8", 8)
166TLI_DEFINE_VECFUNC("cosf", "__svml_cosf16", 16)
167
168TLI_DEFINE_VECFUNC("llvm.cos.f64", "__svml_cos2", 2)
169TLI_DEFINE_VECFUNC("llvm.cos.f64", "__svml_cos4", 4)
170TLI_DEFINE_VECFUNC("llvm.cos.f64", "__svml_cos8", 8)
171
172TLI_DEFINE_VECFUNC("llvm.cos.f32", "__svml_cosf4", 4)
173TLI_DEFINE_VECFUNC("llvm.cos.f32", "__svml_cosf8", 8)
174TLI_DEFINE_VECFUNC("llvm.cos.f32", "__svml_cosf16", 16)
175
176TLI_DEFINE_VECFUNC("pow", "__svml_pow2", 2)
177TLI_DEFINE_VECFUNC("pow", "__svml_pow4", 4)
178TLI_DEFINE_VECFUNC("pow", "__svml_pow8", 8)
179
180TLI_DEFINE_VECFUNC("powf", "__svml_powf4", 4)
181TLI_DEFINE_VECFUNC("powf", "__svml_powf8", 8)
182TLI_DEFINE_VECFUNC("powf", "__svml_powf16", 16)
183
184TLI_DEFINE_VECFUNC("__pow_finite", "__svml_pow2", 2)
185TLI_DEFINE_VECFUNC("__pow_finite", "__svml_pow4", 4)
186TLI_DEFINE_VECFUNC("__pow_finite", "__svml_pow8", 8)
187
188TLI_DEFINE_VECFUNC("__powf_finite", "__svml_powf4", 4)
189TLI_DEFINE_VECFUNC("__powf_finite", "__svml_powf8", 8)
190TLI_DEFINE_VECFUNC("__powf_finite", "__svml_powf16", 16)
191
192TLI_DEFINE_VECFUNC("llvm.pow.f64", "__svml_pow2", 2)
193TLI_DEFINE_VECFUNC("llvm.pow.f64", "__svml_pow4", 4)
194TLI_DEFINE_VECFUNC("llvm.pow.f64", "__svml_pow8", 8)
195
196TLI_DEFINE_VECFUNC("llvm.pow.f32", "__svml_powf4", 4)
197TLI_DEFINE_VECFUNC("llvm.pow.f32", "__svml_powf8", 8)
198TLI_DEFINE_VECFUNC("llvm.pow.f32", "__svml_powf16", 16)
199
200TLI_DEFINE_VECFUNC("exp", "__svml_exp2", 2)
201TLI_DEFINE_VECFUNC("exp", "__svml_exp4", 4)
202TLI_DEFINE_VECFUNC("exp", "__svml_exp8", 8)
203
204TLI_DEFINE_VECFUNC("expf", "__svml_expf4", 4)
205TLI_DEFINE_VECFUNC("expf", "__svml_expf8", 8)
206TLI_DEFINE_VECFUNC("expf", "__svml_expf16", 16)
207
208TLI_DEFINE_VECFUNC("__exp_finite", "__svml_exp2", 2)
209TLI_DEFINE_VECFUNC("__exp_finite", "__svml_exp4", 4)
210TLI_DEFINE_VECFUNC("__exp_finite", "__svml_exp8", 8)
211
212TLI_DEFINE_VECFUNC("__expf_finite", "__svml_expf4", 4)
213TLI_DEFINE_VECFUNC("__expf_finite", "__svml_expf8", 8)
214TLI_DEFINE_VECFUNC("__expf_finite", "__svml_expf16", 16)
215
216TLI_DEFINE_VECFUNC("llvm.exp.f64", "__svml_exp2", 2)
217TLI_DEFINE_VECFUNC("llvm.exp.f64", "__svml_exp4", 4)
218TLI_DEFINE_VECFUNC("llvm.exp.f64", "__svml_exp8", 8)
219
220TLI_DEFINE_VECFUNC("llvm.exp.f32", "__svml_expf4", 4)
221TLI_DEFINE_VECFUNC("llvm.exp.f32", "__svml_expf8", 8)
222TLI_DEFINE_VECFUNC("llvm.exp.f32", "__svml_expf16", 16)
223
224TLI_DEFINE_VECFUNC("log", "__svml_log2", 2)
225TLI_DEFINE_VECFUNC("log", "__svml_log4", 4)
226TLI_DEFINE_VECFUNC("log", "__svml_log8", 8)
227
228TLI_DEFINE_VECFUNC("logf", "__svml_logf4", 4)
229TLI_DEFINE_VECFUNC("logf", "__svml_logf8", 8)
230TLI_DEFINE_VECFUNC("logf", "__svml_logf16", 16)
231
232TLI_DEFINE_VECFUNC("__log_finite", "__svml_log2", 2)
233TLI_DEFINE_VECFUNC("__log_finite", "__svml_log4", 4)
234TLI_DEFINE_VECFUNC("__log_finite", "__svml_log8", 8)
235
236TLI_DEFINE_VECFUNC("__logf_finite", "__svml_logf4", 4)
237TLI_DEFINE_VECFUNC("__logf_finite", "__svml_logf8", 8)
238TLI_DEFINE_VECFUNC("__logf_finite", "__svml_logf16", 16)
239
240TLI_DEFINE_VECFUNC("llvm.log.f64", "__svml_log2", 2)
241TLI_DEFINE_VECFUNC("llvm.log.f64", "__svml_log4", 4)
242TLI_DEFINE_VECFUNC("llvm.log.f64", "__svml_log8", 8)
243
244TLI_DEFINE_VECFUNC("llvm.log.f32", "__svml_logf4", 4)
245TLI_DEFINE_VECFUNC("llvm.log.f32", "__svml_logf8", 8)
246TLI_DEFINE_VECFUNC("llvm.log.f32", "__svml_logf16", 16)
247
248
249#else
250#error "Must choose which vector library functions are to be defined."
251#endif
252
253#undef TLI_DEFINE_VECFUNC
254#undef TLI_DEFINE_ACCELERATE_VECFUNCS
255#undef TLI_DEFINE_MASSV_VECFUNCS
256#undef TLI_DEFINE_SVML_VECFUNCS
257#undef TLI_DEFINE_MASSV_VECFUNCS_NAMES
258