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