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