master
1/*! @header
2 * The interfaces declared in this header provide elementwise math operations
3 * on vectors; each lane of the result vector depends only on the data in the
4 * corresponding lane of the argument(s) to the function.
5 *
6 * You should not use the C functions declared in this header directly (these
7 * are functions with names like `__tg_cos(x)`). These are merely
8 * implementation details of <tgmath.h> overloading; instead of calling
9 * `__tg_cos(x)`, call `cos(x)`. If you are writing C++, use `simd::cos(x)`.
10 *
11 * Note that while these vector functions are relatively recent additions,
12 * scalar fallback is provided for all of them, so they are available even
13 * when targeting older OS versions.
14 *
15 * The following functions are available:
16 *
17 * C name C++ name Notes
18 * ----------------------------------------------------------------------
19 * acos(x) simd::acos(x)
20 * asin(x) simd::asin(x)
21 * atan(x) simd::atan(x)
22 * atan2(y,x) simd::atan2(y,x) The argument order matches the scalar
23 * atan2 function, which gives the angle
24 * of a line with slope y/x.
25 * cos(x) simd::cos(x)
26 * sin(x) simd::sin(x)
27 * tan(x) simd::tan(x)
28 * sincos(x) simd::sincos(x) Computes sin(x) and cos(x) more efficiently
29 *
30 * cospi(x) simd::cospi(x) Returns cos(pi*x), sin(pi*x), tan(pi*x)
31 * sinpi(x) simd::sinpi(x) more efficiently and accurately than
32 * tanpi(x) simd::tanpi(x) would otherwise be possible
33 * sincospi(x) simd::sincospi(x) Computes sin(pi*x) and cos(pi*x) more efficiently
34 *
35 * acosh(x) simd::acosh(x)
36 * asinh(x) simd::asinh(x)
37 * atanh(x) simd::atanh(x)
38 *
39 * cosh(x) simd::cosh(x)
40 * sinh(x) simd::sinh(x)
41 * tanh(x) simd::tanh(x)
42 *
43 * exp(x) simd::exp(x)
44 * exp2(x) simd::exp2(x)
45 * exp10(x) simd::exp10(x) More efficient that pow(10,x).
46 * expm1(x) simd::expm1(x) exp(x)-1, accurate even for tiny x.
47 *
48 * log(x) simd::log(x)
49 * log2(x) simd::log2(x)
50 * log10(x) simd::log10(x)
51 * log1p(x) simd::log1p(x) log(1+x), accurate even for tiny x.
52 *
53 * fabs(x) simd::fabs(x)
54 * cbrt(x) simd::cbrt(x)
55 * sqrt(x) simd::sqrt(x)
56 * pow(x,y) simd::pow(x,y)
57 * copysign(x,y) simd::copysign(x,y)
58 * hypot(x,y) simd::hypot(x,y) sqrt(x*x + y*y), computed without
59 * overflow.1
60 * erf(x) simd::erf(x)
61 * erfc(x) simd::erfc(x)
62 * tgamma(x) simd::tgamma(x)
63 * lgamma(x) simd::lgamma(x)
64 *
65 * fmod(x,y) simd::fmod(x,y)
66 * remainder(x,y) simd::remainder(x,y)
67 *
68 * ceil(x) simd::ceil(x)
69 * floor(x) simd::floor(x)
70 * rint(x) simd::rint(x)
71 * round(x) simd::round(x)
72 * trunc(x) simd::trunc(x)
73 *
74 * fdim(x,y) simd::fdim(x,y)
75 * fmax(x,y) simd::fmax(x,y) When one argument to fmin or fmax is
76 * fmin(x,y) simd::fmin(x,y) constant, use it as the *second* (y)
77 * argument to get better codegen on some
78 * architectures. E.g., write fmin(x,2)
79 * instead of fmin(2,x).
80 * fma(x,y,z) simd::fma(x,y,z) Fast on arm64 and when targeting AVX2
81 * and later; may be quite expensive on
82 * older hardware.
83 * simd_muladd(x,y,z) simd::muladd(x,y,z)
84 * @copyright 2014-2017 Apple, Inc. All rights reserved.
85 * @unsorted */
86
87#ifndef SIMD_MATH_HEADER
88#define SIMD_MATH_HEADER
89
90#include <simd/base.h>
91#if SIMD_COMPILER_HAS_REQUIRED_FEATURES
92#include <simd/vector_make.h>
93#include <simd/logic.h>
94
95#ifdef __cplusplus
96extern "C" {
97#endif
98/*! @abstract Do not call this function; instead use `acos` in C and
99 * Objective-C, and `simd::acos` in C++. */
100static inline SIMD_CFUNC simd_float2 __tg_acos(simd_float2 x);
101/*! @abstract Do not call this function; instead use `acos` in C and
102 * Objective-C, and `simd::acos` in C++. */
103static inline SIMD_CFUNC simd_float3 __tg_acos(simd_float3 x);
104/*! @abstract Do not call this function; instead use `acos` in C and
105 * Objective-C, and `simd::acos` in C++. */
106static inline SIMD_CFUNC simd_float4 __tg_acos(simd_float4 x);
107/*! @abstract Do not call this function; instead use `acos` in C and
108 * Objective-C, and `simd::acos` in C++. */
109static inline SIMD_CFUNC simd_float8 __tg_acos(simd_float8 x);
110/*! @abstract Do not call this function; instead use `acos` in C and
111 * Objective-C, and `simd::acos` in C++. */
112static inline SIMD_CFUNC simd_float16 __tg_acos(simd_float16 x);
113/*! @abstract Do not call this function; instead use `acos` in C and
114 * Objective-C, and `simd::acos` in C++. */
115static inline SIMD_CFUNC simd_double2 __tg_acos(simd_double2 x);
116/*! @abstract Do not call this function; instead use `acos` in C and
117 * Objective-C, and `simd::acos` in C++. */
118static inline SIMD_CFUNC simd_double3 __tg_acos(simd_double3 x);
119/*! @abstract Do not call this function; instead use `acos` in C and
120 * Objective-C, and `simd::acos` in C++. */
121static inline SIMD_CFUNC simd_double4 __tg_acos(simd_double4 x);
122/*! @abstract Do not call this function; instead use `acos` in C and
123 * Objective-C, and `simd::acos` in C++. */
124static inline SIMD_CFUNC simd_double8 __tg_acos(simd_double8 x);
125
126/*! @abstract Do not call this function; instead use `asin` in C and
127 * Objective-C, and `simd::asin` in C++. */
128static inline SIMD_CFUNC simd_float2 __tg_asin(simd_float2 x);
129/*! @abstract Do not call this function; instead use `asin` in C and
130 * Objective-C, and `simd::asin` in C++. */
131static inline SIMD_CFUNC simd_float3 __tg_asin(simd_float3 x);
132/*! @abstract Do not call this function; instead use `asin` in C and
133 * Objective-C, and `simd::asin` in C++. */
134static inline SIMD_CFUNC simd_float4 __tg_asin(simd_float4 x);
135/*! @abstract Do not call this function; instead use `asin` in C and
136 * Objective-C, and `simd::asin` in C++. */
137static inline SIMD_CFUNC simd_float8 __tg_asin(simd_float8 x);
138/*! @abstract Do not call this function; instead use `asin` in C and
139 * Objective-C, and `simd::asin` in C++. */
140static inline SIMD_CFUNC simd_float16 __tg_asin(simd_float16 x);
141/*! @abstract Do not call this function; instead use `asin` in C and
142 * Objective-C, and `simd::asin` in C++. */
143static inline SIMD_CFUNC simd_double2 __tg_asin(simd_double2 x);
144/*! @abstract Do not call this function; instead use `asin` in C and
145 * Objective-C, and `simd::asin` in C++. */
146static inline SIMD_CFUNC simd_double3 __tg_asin(simd_double3 x);
147/*! @abstract Do not call this function; instead use `asin` in C and
148 * Objective-C, and `simd::asin` in C++. */
149static inline SIMD_CFUNC simd_double4 __tg_asin(simd_double4 x);
150/*! @abstract Do not call this function; instead use `asin` in C and
151 * Objective-C, and `simd::asin` in C++. */
152static inline SIMD_CFUNC simd_double8 __tg_asin(simd_double8 x);
153
154/*! @abstract Do not call this function; instead use `atan` in C and
155 * Objective-C, and `simd::atan` in C++. */
156static inline SIMD_CFUNC simd_float2 __tg_atan(simd_float2 x);
157/*! @abstract Do not call this function; instead use `atan` in C and
158 * Objective-C, and `simd::atan` in C++. */
159static inline SIMD_CFUNC simd_float3 __tg_atan(simd_float3 x);
160/*! @abstract Do not call this function; instead use `atan` in C and
161 * Objective-C, and `simd::atan` in C++. */
162static inline SIMD_CFUNC simd_float4 __tg_atan(simd_float4 x);
163/*! @abstract Do not call this function; instead use `atan` in C and
164 * Objective-C, and `simd::atan` in C++. */
165static inline SIMD_CFUNC simd_float8 __tg_atan(simd_float8 x);
166/*! @abstract Do not call this function; instead use `atan` in C and
167 * Objective-C, and `simd::atan` in C++. */
168static inline SIMD_CFUNC simd_float16 __tg_atan(simd_float16 x);
169/*! @abstract Do not call this function; instead use `atan` in C and
170 * Objective-C, and `simd::atan` in C++. */
171static inline SIMD_CFUNC simd_double2 __tg_atan(simd_double2 x);
172/*! @abstract Do not call this function; instead use `atan` in C and
173 * Objective-C, and `simd::atan` in C++. */
174static inline SIMD_CFUNC simd_double3 __tg_atan(simd_double3 x);
175/*! @abstract Do not call this function; instead use `atan` in C and
176 * Objective-C, and `simd::atan` in C++. */
177static inline SIMD_CFUNC simd_double4 __tg_atan(simd_double4 x);
178/*! @abstract Do not call this function; instead use `atan` in C and
179 * Objective-C, and `simd::atan` in C++. */
180static inline SIMD_CFUNC simd_double8 __tg_atan(simd_double8 x);
181
182/*! @abstract Do not call this function; instead use `cos` in C and
183 * Objective-C, and `simd::cos` in C++. */
184static inline SIMD_CFUNC simd_float2 __tg_cos(simd_float2 x);
185/*! @abstract Do not call this function; instead use `cos` in C and
186 * Objective-C, and `simd::cos` in C++. */
187static inline SIMD_CFUNC simd_float3 __tg_cos(simd_float3 x);
188/*! @abstract Do not call this function; instead use `cos` in C and
189 * Objective-C, and `simd::cos` in C++. */
190static inline SIMD_CFUNC simd_float4 __tg_cos(simd_float4 x);
191/*! @abstract Do not call this function; instead use `cos` in C and
192 * Objective-C, and `simd::cos` in C++. */
193static inline SIMD_CFUNC simd_float8 __tg_cos(simd_float8 x);
194/*! @abstract Do not call this function; instead use `cos` in C and
195 * Objective-C, and `simd::cos` in C++. */
196static inline SIMD_CFUNC simd_float16 __tg_cos(simd_float16 x);
197/*! @abstract Do not call this function; instead use `cos` in C and
198 * Objective-C, and `simd::cos` in C++. */
199static inline SIMD_CFUNC simd_double2 __tg_cos(simd_double2 x);
200/*! @abstract Do not call this function; instead use `cos` in C and
201 * Objective-C, and `simd::cos` in C++. */
202static inline SIMD_CFUNC simd_double3 __tg_cos(simd_double3 x);
203/*! @abstract Do not call this function; instead use `cos` in C and
204 * Objective-C, and `simd::cos` in C++. */
205static inline SIMD_CFUNC simd_double4 __tg_cos(simd_double4 x);
206/*! @abstract Do not call this function; instead use `cos` in C and
207 * Objective-C, and `simd::cos` in C++. */
208static inline SIMD_CFUNC simd_double8 __tg_cos(simd_double8 x);
209
210/*! @abstract Do not call this function; instead use `sin` in C and
211 * Objective-C, and `simd::sin` in C++. */
212static inline SIMD_CFUNC simd_float2 __tg_sin(simd_float2 x);
213/*! @abstract Do not call this function; instead use `sin` in C and
214 * Objective-C, and `simd::sin` in C++. */
215static inline SIMD_CFUNC simd_float3 __tg_sin(simd_float3 x);
216/*! @abstract Do not call this function; instead use `sin` in C and
217 * Objective-C, and `simd::sin` in C++. */
218static inline SIMD_CFUNC simd_float4 __tg_sin(simd_float4 x);
219/*! @abstract Do not call this function; instead use `sin` in C and
220 * Objective-C, and `simd::sin` in C++. */
221static inline SIMD_CFUNC simd_float8 __tg_sin(simd_float8 x);
222/*! @abstract Do not call this function; instead use `sin` in C and
223 * Objective-C, and `simd::sin` in C++. */
224static inline SIMD_CFUNC simd_float16 __tg_sin(simd_float16 x);
225/*! @abstract Do not call this function; instead use `sin` in C and
226 * Objective-C, and `simd::sin` in C++. */
227static inline SIMD_CFUNC simd_double2 __tg_sin(simd_double2 x);
228/*! @abstract Do not call this function; instead use `sin` in C and
229 * Objective-C, and `simd::sin` in C++. */
230static inline SIMD_CFUNC simd_double3 __tg_sin(simd_double3 x);
231/*! @abstract Do not call this function; instead use `sin` in C and
232 * Objective-C, and `simd::sin` in C++. */
233static inline SIMD_CFUNC simd_double4 __tg_sin(simd_double4 x);
234/*! @abstract Do not call this function; instead use `sin` in C and
235 * Objective-C, and `simd::sin` in C++. */
236static inline SIMD_CFUNC simd_double8 __tg_sin(simd_double8 x);
237
238/*! @abstract Do not call this function; instead use `tan` in C and
239 * Objective-C, and `simd::tan` in C++. */
240static inline SIMD_CFUNC simd_float2 __tg_tan(simd_float2 x);
241/*! @abstract Do not call this function; instead use `tan` in C and
242 * Objective-C, and `simd::tan` in C++. */
243static inline SIMD_CFUNC simd_float3 __tg_tan(simd_float3 x);
244/*! @abstract Do not call this function; instead use `tan` in C and
245 * Objective-C, and `simd::tan` in C++. */
246static inline SIMD_CFUNC simd_float4 __tg_tan(simd_float4 x);
247/*! @abstract Do not call this function; instead use `tan` in C and
248 * Objective-C, and `simd::tan` in C++. */
249static inline SIMD_CFUNC simd_float8 __tg_tan(simd_float8 x);
250/*! @abstract Do not call this function; instead use `tan` in C and
251 * Objective-C, and `simd::tan` in C++. */
252static inline SIMD_CFUNC simd_float16 __tg_tan(simd_float16 x);
253/*! @abstract Do not call this function; instead use `tan` in C and
254 * Objective-C, and `simd::tan` in C++. */
255static inline SIMD_CFUNC simd_double2 __tg_tan(simd_double2 x);
256/*! @abstract Do not call this function; instead use `tan` in C and
257 * Objective-C, and `simd::tan` in C++. */
258static inline SIMD_CFUNC simd_double3 __tg_tan(simd_double3 x);
259/*! @abstract Do not call this function; instead use `tan` in C and
260 * Objective-C, and `simd::tan` in C++. */
261static inline SIMD_CFUNC simd_double4 __tg_tan(simd_double4 x);
262/*! @abstract Do not call this function; instead use `tan` in C and
263 * Objective-C, and `simd::tan` in C++. */
264static inline SIMD_CFUNC simd_double8 __tg_tan(simd_double8 x);
265
266#if SIMD_LIBRARY_VERSION >= 1
267/*! @abstract Do not call this function; instead use `cospi` in C and
268 * Objective-C, and `simd::cospi` in C++. */
269static inline SIMD_CFUNC simd_float2 __tg_cospi(simd_float2 x);
270/*! @abstract Do not call this function; instead use `cospi` in C and
271 * Objective-C, and `simd::cospi` in C++. */
272static inline SIMD_CFUNC simd_float3 __tg_cospi(simd_float3 x);
273/*! @abstract Do not call this function; instead use `cospi` in C and
274 * Objective-C, and `simd::cospi` in C++. */
275static inline SIMD_CFUNC simd_float4 __tg_cospi(simd_float4 x);
276/*! @abstract Do not call this function; instead use `cospi` in C and
277 * Objective-C, and `simd::cospi` in C++. */
278static inline SIMD_CFUNC simd_float8 __tg_cospi(simd_float8 x);
279/*! @abstract Do not call this function; instead use `cospi` in C and
280 * Objective-C, and `simd::cospi` in C++. */
281static inline SIMD_CFUNC simd_float16 __tg_cospi(simd_float16 x);
282/*! @abstract Do not call this function; instead use `cospi` in C and
283 * Objective-C, and `simd::cospi` in C++. */
284static inline SIMD_CFUNC simd_double2 __tg_cospi(simd_double2 x);
285/*! @abstract Do not call this function; instead use `cospi` in C and
286 * Objective-C, and `simd::cospi` in C++. */
287static inline SIMD_CFUNC simd_double3 __tg_cospi(simd_double3 x);
288/*! @abstract Do not call this function; instead use `cospi` in C and
289 * Objective-C, and `simd::cospi` in C++. */
290static inline SIMD_CFUNC simd_double4 __tg_cospi(simd_double4 x);
291/*! @abstract Do not call this function; instead use `cospi` in C and
292 * Objective-C, and `simd::cospi` in C++. */
293static inline SIMD_CFUNC simd_double8 __tg_cospi(simd_double8 x);
294#endif
295
296#if SIMD_LIBRARY_VERSION >= 1
297/*! @abstract Do not call this function; instead use `sinpi` in C and
298 * Objective-C, and `simd::sinpi` in C++. */
299static inline SIMD_CFUNC simd_float2 __tg_sinpi(simd_float2 x);
300/*! @abstract Do not call this function; instead use `sinpi` in C and
301 * Objective-C, and `simd::sinpi` in C++. */
302static inline SIMD_CFUNC simd_float3 __tg_sinpi(simd_float3 x);
303/*! @abstract Do not call this function; instead use `sinpi` in C and
304 * Objective-C, and `simd::sinpi` in C++. */
305static inline SIMD_CFUNC simd_float4 __tg_sinpi(simd_float4 x);
306/*! @abstract Do not call this function; instead use `sinpi` in C and
307 * Objective-C, and `simd::sinpi` in C++. */
308static inline SIMD_CFUNC simd_float8 __tg_sinpi(simd_float8 x);
309/*! @abstract Do not call this function; instead use `sinpi` in C and
310 * Objective-C, and `simd::sinpi` in C++. */
311static inline SIMD_CFUNC simd_float16 __tg_sinpi(simd_float16 x);
312/*! @abstract Do not call this function; instead use `sinpi` in C and
313 * Objective-C, and `simd::sinpi` in C++. */
314static inline SIMD_CFUNC simd_double2 __tg_sinpi(simd_double2 x);
315/*! @abstract Do not call this function; instead use `sinpi` in C and
316 * Objective-C, and `simd::sinpi` in C++. */
317static inline SIMD_CFUNC simd_double3 __tg_sinpi(simd_double3 x);
318/*! @abstract Do not call this function; instead use `sinpi` in C and
319 * Objective-C, and `simd::sinpi` in C++. */
320static inline SIMD_CFUNC simd_double4 __tg_sinpi(simd_double4 x);
321/*! @abstract Do not call this function; instead use `sinpi` in C and
322 * Objective-C, and `simd::sinpi` in C++. */
323static inline SIMD_CFUNC simd_double8 __tg_sinpi(simd_double8 x);
324#endif
325
326#if SIMD_LIBRARY_VERSION >= 1
327/*! @abstract Do not call this function; instead use `tanpi` in C and
328 * Objective-C, and `simd::tanpi` in C++. */
329static inline SIMD_CFUNC simd_float2 __tg_tanpi(simd_float2 x);
330/*! @abstract Do not call this function; instead use `tanpi` in C and
331 * Objective-C, and `simd::tanpi` in C++. */
332static inline SIMD_CFUNC simd_float3 __tg_tanpi(simd_float3 x);
333/*! @abstract Do not call this function; instead use `tanpi` in C and
334 * Objective-C, and `simd::tanpi` in C++. */
335static inline SIMD_CFUNC simd_float4 __tg_tanpi(simd_float4 x);
336/*! @abstract Do not call this function; instead use `tanpi` in C and
337 * Objective-C, and `simd::tanpi` in C++. */
338static inline SIMD_CFUNC simd_float8 __tg_tanpi(simd_float8 x);
339/*! @abstract Do not call this function; instead use `tanpi` in C and
340 * Objective-C, and `simd::tanpi` in C++. */
341static inline SIMD_CFUNC simd_float16 __tg_tanpi(simd_float16 x);
342/*! @abstract Do not call this function; instead use `tanpi` in C and
343 * Objective-C, and `simd::tanpi` in C++. */
344static inline SIMD_CFUNC simd_double2 __tg_tanpi(simd_double2 x);
345/*! @abstract Do not call this function; instead use `tanpi` in C and
346 * Objective-C, and `simd::tanpi` in C++. */
347static inline SIMD_CFUNC simd_double3 __tg_tanpi(simd_double3 x);
348/*! @abstract Do not call this function; instead use `tanpi` in C and
349 * Objective-C, and `simd::tanpi` in C++. */
350static inline SIMD_CFUNC simd_double4 __tg_tanpi(simd_double4 x);
351/*! @abstract Do not call this function; instead use `tanpi` in C and
352 * Objective-C, and `simd::tanpi` in C++. */
353static inline SIMD_CFUNC simd_double8 __tg_tanpi(simd_double8 x);
354#endif
355
356/*! @abstract Do not call this function; instead use `acosh` in C and
357 * Objective-C, and `simd::acosh` in C++. */
358static inline SIMD_CFUNC simd_float2 __tg_acosh(simd_float2 x);
359/*! @abstract Do not call this function; instead use `acosh` in C and
360 * Objective-C, and `simd::acosh` in C++. */
361static inline SIMD_CFUNC simd_float3 __tg_acosh(simd_float3 x);
362/*! @abstract Do not call this function; instead use `acosh` in C and
363 * Objective-C, and `simd::acosh` in C++. */
364static inline SIMD_CFUNC simd_float4 __tg_acosh(simd_float4 x);
365/*! @abstract Do not call this function; instead use `acosh` in C and
366 * Objective-C, and `simd::acosh` in C++. */
367static inline SIMD_CFUNC simd_float8 __tg_acosh(simd_float8 x);
368/*! @abstract Do not call this function; instead use `acosh` in C and
369 * Objective-C, and `simd::acosh` in C++. */
370static inline SIMD_CFUNC simd_float16 __tg_acosh(simd_float16 x);
371/*! @abstract Do not call this function; instead use `acosh` in C and
372 * Objective-C, and `simd::acosh` in C++. */
373static inline SIMD_CFUNC simd_double2 __tg_acosh(simd_double2 x);
374/*! @abstract Do not call this function; instead use `acosh` in C and
375 * Objective-C, and `simd::acosh` in C++. */
376static inline SIMD_CFUNC simd_double3 __tg_acosh(simd_double3 x);
377/*! @abstract Do not call this function; instead use `acosh` in C and
378 * Objective-C, and `simd::acosh` in C++. */
379static inline SIMD_CFUNC simd_double4 __tg_acosh(simd_double4 x);
380/*! @abstract Do not call this function; instead use `acosh` in C and
381 * Objective-C, and `simd::acosh` in C++. */
382static inline SIMD_CFUNC simd_double8 __tg_acosh(simd_double8 x);
383
384/*! @abstract Do not call this function; instead use `asinh` in C and
385 * Objective-C, and `simd::asinh` in C++. */
386static inline SIMD_CFUNC simd_float2 __tg_asinh(simd_float2 x);
387/*! @abstract Do not call this function; instead use `asinh` in C and
388 * Objective-C, and `simd::asinh` in C++. */
389static inline SIMD_CFUNC simd_float3 __tg_asinh(simd_float3 x);
390/*! @abstract Do not call this function; instead use `asinh` in C and
391 * Objective-C, and `simd::asinh` in C++. */
392static inline SIMD_CFUNC simd_float4 __tg_asinh(simd_float4 x);
393/*! @abstract Do not call this function; instead use `asinh` in C and
394 * Objective-C, and `simd::asinh` in C++. */
395static inline SIMD_CFUNC simd_float8 __tg_asinh(simd_float8 x);
396/*! @abstract Do not call this function; instead use `asinh` in C and
397 * Objective-C, and `simd::asinh` in C++. */
398static inline SIMD_CFUNC simd_float16 __tg_asinh(simd_float16 x);
399/*! @abstract Do not call this function; instead use `asinh` in C and
400 * Objective-C, and `simd::asinh` in C++. */
401static inline SIMD_CFUNC simd_double2 __tg_asinh(simd_double2 x);
402/*! @abstract Do not call this function; instead use `asinh` in C and
403 * Objective-C, and `simd::asinh` in C++. */
404static inline SIMD_CFUNC simd_double3 __tg_asinh(simd_double3 x);
405/*! @abstract Do not call this function; instead use `asinh` in C and
406 * Objective-C, and `simd::asinh` in C++. */
407static inline SIMD_CFUNC simd_double4 __tg_asinh(simd_double4 x);
408/*! @abstract Do not call this function; instead use `asinh` in C and
409 * Objective-C, and `simd::asinh` in C++. */
410static inline SIMD_CFUNC simd_double8 __tg_asinh(simd_double8 x);
411
412/*! @abstract Do not call this function; instead use `atanh` in C and
413 * Objective-C, and `simd::atanh` in C++. */
414static inline SIMD_CFUNC simd_float2 __tg_atanh(simd_float2 x);
415/*! @abstract Do not call this function; instead use `atanh` in C and
416 * Objective-C, and `simd::atanh` in C++. */
417static inline SIMD_CFUNC simd_float3 __tg_atanh(simd_float3 x);
418/*! @abstract Do not call this function; instead use `atanh` in C and
419 * Objective-C, and `simd::atanh` in C++. */
420static inline SIMD_CFUNC simd_float4 __tg_atanh(simd_float4 x);
421/*! @abstract Do not call this function; instead use `atanh` in C and
422 * Objective-C, and `simd::atanh` in C++. */
423static inline SIMD_CFUNC simd_float8 __tg_atanh(simd_float8 x);
424/*! @abstract Do not call this function; instead use `atanh` in C and
425 * Objective-C, and `simd::atanh` in C++. */
426static inline SIMD_CFUNC simd_float16 __tg_atanh(simd_float16 x);
427/*! @abstract Do not call this function; instead use `atanh` in C and
428 * Objective-C, and `simd::atanh` in C++. */
429static inline SIMD_CFUNC simd_double2 __tg_atanh(simd_double2 x);
430/*! @abstract Do not call this function; instead use `atanh` in C and
431 * Objective-C, and `simd::atanh` in C++. */
432static inline SIMD_CFUNC simd_double3 __tg_atanh(simd_double3 x);
433/*! @abstract Do not call this function; instead use `atanh` in C and
434 * Objective-C, and `simd::atanh` in C++. */
435static inline SIMD_CFUNC simd_double4 __tg_atanh(simd_double4 x);
436/*! @abstract Do not call this function; instead use `atanh` in C and
437 * Objective-C, and `simd::atanh` in C++. */
438static inline SIMD_CFUNC simd_double8 __tg_atanh(simd_double8 x);
439
440/*! @abstract Do not call this function; instead use `cosh` in C and
441 * Objective-C, and `simd::cosh` in C++. */
442static inline SIMD_CFUNC simd_float2 __tg_cosh(simd_float2 x);
443/*! @abstract Do not call this function; instead use `cosh` in C and
444 * Objective-C, and `simd::cosh` in C++. */
445static inline SIMD_CFUNC simd_float3 __tg_cosh(simd_float3 x);
446/*! @abstract Do not call this function; instead use `cosh` in C and
447 * Objective-C, and `simd::cosh` in C++. */
448static inline SIMD_CFUNC simd_float4 __tg_cosh(simd_float4 x);
449/*! @abstract Do not call this function; instead use `cosh` in C and
450 * Objective-C, and `simd::cosh` in C++. */
451static inline SIMD_CFUNC simd_float8 __tg_cosh(simd_float8 x);
452/*! @abstract Do not call this function; instead use `cosh` in C and
453 * Objective-C, and `simd::cosh` in C++. */
454static inline SIMD_CFUNC simd_float16 __tg_cosh(simd_float16 x);
455/*! @abstract Do not call this function; instead use `cosh` in C and
456 * Objective-C, and `simd::cosh` in C++. */
457static inline SIMD_CFUNC simd_double2 __tg_cosh(simd_double2 x);
458/*! @abstract Do not call this function; instead use `cosh` in C and
459 * Objective-C, and `simd::cosh` in C++. */
460static inline SIMD_CFUNC simd_double3 __tg_cosh(simd_double3 x);
461/*! @abstract Do not call this function; instead use `cosh` in C and
462 * Objective-C, and `simd::cosh` in C++. */
463static inline SIMD_CFUNC simd_double4 __tg_cosh(simd_double4 x);
464/*! @abstract Do not call this function; instead use `cosh` in C and
465 * Objective-C, and `simd::cosh` in C++. */
466static inline SIMD_CFUNC simd_double8 __tg_cosh(simd_double8 x);
467
468/*! @abstract Do not call this function; instead use `sinh` in C and
469 * Objective-C, and `simd::sinh` in C++. */
470static inline SIMD_CFUNC simd_float2 __tg_sinh(simd_float2 x);
471/*! @abstract Do not call this function; instead use `sinh` in C and
472 * Objective-C, and `simd::sinh` in C++. */
473static inline SIMD_CFUNC simd_float3 __tg_sinh(simd_float3 x);
474/*! @abstract Do not call this function; instead use `sinh` in C and
475 * Objective-C, and `simd::sinh` in C++. */
476static inline SIMD_CFUNC simd_float4 __tg_sinh(simd_float4 x);
477/*! @abstract Do not call this function; instead use `sinh` in C and
478 * Objective-C, and `simd::sinh` in C++. */
479static inline SIMD_CFUNC simd_float8 __tg_sinh(simd_float8 x);
480/*! @abstract Do not call this function; instead use `sinh` in C and
481 * Objective-C, and `simd::sinh` in C++. */
482static inline SIMD_CFUNC simd_float16 __tg_sinh(simd_float16 x);
483/*! @abstract Do not call this function; instead use `sinh` in C and
484 * Objective-C, and `simd::sinh` in C++. */
485static inline SIMD_CFUNC simd_double2 __tg_sinh(simd_double2 x);
486/*! @abstract Do not call this function; instead use `sinh` in C and
487 * Objective-C, and `simd::sinh` in C++. */
488static inline SIMD_CFUNC simd_double3 __tg_sinh(simd_double3 x);
489/*! @abstract Do not call this function; instead use `sinh` in C and
490 * Objective-C, and `simd::sinh` in C++. */
491static inline SIMD_CFUNC simd_double4 __tg_sinh(simd_double4 x);
492/*! @abstract Do not call this function; instead use `sinh` in C and
493 * Objective-C, and `simd::sinh` in C++. */
494static inline SIMD_CFUNC simd_double8 __tg_sinh(simd_double8 x);
495
496/*! @abstract Do not call this function; instead use `tanh` in C and
497 * Objective-C, and `simd::tanh` in C++. */
498static inline SIMD_CFUNC simd_float2 __tg_tanh(simd_float2 x);
499/*! @abstract Do not call this function; instead use `tanh` in C and
500 * Objective-C, and `simd::tanh` in C++. */
501static inline SIMD_CFUNC simd_float3 __tg_tanh(simd_float3 x);
502/*! @abstract Do not call this function; instead use `tanh` in C and
503 * Objective-C, and `simd::tanh` in C++. */
504static inline SIMD_CFUNC simd_float4 __tg_tanh(simd_float4 x);
505/*! @abstract Do not call this function; instead use `tanh` in C and
506 * Objective-C, and `simd::tanh` in C++. */
507static inline SIMD_CFUNC simd_float8 __tg_tanh(simd_float8 x);
508/*! @abstract Do not call this function; instead use `tanh` in C and
509 * Objective-C, and `simd::tanh` in C++. */
510static inline SIMD_CFUNC simd_float16 __tg_tanh(simd_float16 x);
511/*! @abstract Do not call this function; instead use `tanh` in C and
512 * Objective-C, and `simd::tanh` in C++. */
513static inline SIMD_CFUNC simd_double2 __tg_tanh(simd_double2 x);
514/*! @abstract Do not call this function; instead use `tanh` in C and
515 * Objective-C, and `simd::tanh` in C++. */
516static inline SIMD_CFUNC simd_double3 __tg_tanh(simd_double3 x);
517/*! @abstract Do not call this function; instead use `tanh` in C and
518 * Objective-C, and `simd::tanh` in C++. */
519static inline SIMD_CFUNC simd_double4 __tg_tanh(simd_double4 x);
520/*! @abstract Do not call this function; instead use `tanh` in C and
521 * Objective-C, and `simd::tanh` in C++. */
522static inline SIMD_CFUNC simd_double8 __tg_tanh(simd_double8 x);
523
524/*! @abstract Do not call this function; instead use `exp` in C and
525 * Objective-C, and `simd::exp` in C++. */
526static inline SIMD_CFUNC simd_float2 __tg_exp(simd_float2 x);
527/*! @abstract Do not call this function; instead use `exp` in C and
528 * Objective-C, and `simd::exp` in C++. */
529static inline SIMD_CFUNC simd_float3 __tg_exp(simd_float3 x);
530/*! @abstract Do not call this function; instead use `exp` in C and
531 * Objective-C, and `simd::exp` in C++. */
532static inline SIMD_CFUNC simd_float4 __tg_exp(simd_float4 x);
533/*! @abstract Do not call this function; instead use `exp` in C and
534 * Objective-C, and `simd::exp` in C++. */
535static inline SIMD_CFUNC simd_float8 __tg_exp(simd_float8 x);
536/*! @abstract Do not call this function; instead use `exp` in C and
537 * Objective-C, and `simd::exp` in C++. */
538static inline SIMD_CFUNC simd_float16 __tg_exp(simd_float16 x);
539/*! @abstract Do not call this function; instead use `exp` in C and
540 * Objective-C, and `simd::exp` in C++. */
541static inline SIMD_CFUNC simd_double2 __tg_exp(simd_double2 x);
542/*! @abstract Do not call this function; instead use `exp` in C and
543 * Objective-C, and `simd::exp` in C++. */
544static inline SIMD_CFUNC simd_double3 __tg_exp(simd_double3 x);
545/*! @abstract Do not call this function; instead use `exp` in C and
546 * Objective-C, and `simd::exp` in C++. */
547static inline SIMD_CFUNC simd_double4 __tg_exp(simd_double4 x);
548/*! @abstract Do not call this function; instead use `exp` in C and
549 * Objective-C, and `simd::exp` in C++. */
550static inline SIMD_CFUNC simd_double8 __tg_exp(simd_double8 x);
551
552/*! @abstract Do not call this function; instead use `exp2` in C and
553 * Objective-C, and `simd::exp2` in C++. */
554static inline SIMD_CFUNC simd_float2 __tg_exp2(simd_float2 x);
555/*! @abstract Do not call this function; instead use `exp2` in C and
556 * Objective-C, and `simd::exp2` in C++. */
557static inline SIMD_CFUNC simd_float3 __tg_exp2(simd_float3 x);
558/*! @abstract Do not call this function; instead use `exp2` in C and
559 * Objective-C, and `simd::exp2` in C++. */
560static inline SIMD_CFUNC simd_float4 __tg_exp2(simd_float4 x);
561/*! @abstract Do not call this function; instead use `exp2` in C and
562 * Objective-C, and `simd::exp2` in C++. */
563static inline SIMD_CFUNC simd_float8 __tg_exp2(simd_float8 x);
564/*! @abstract Do not call this function; instead use `exp2` in C and
565 * Objective-C, and `simd::exp2` in C++. */
566static inline SIMD_CFUNC simd_float16 __tg_exp2(simd_float16 x);
567/*! @abstract Do not call this function; instead use `exp2` in C and
568 * Objective-C, and `simd::exp2` in C++. */
569static inline SIMD_CFUNC simd_double2 __tg_exp2(simd_double2 x);
570/*! @abstract Do not call this function; instead use `exp2` in C and
571 * Objective-C, and `simd::exp2` in C++. */
572static inline SIMD_CFUNC simd_double3 __tg_exp2(simd_double3 x);
573/*! @abstract Do not call this function; instead use `exp2` in C and
574 * Objective-C, and `simd::exp2` in C++. */
575static inline SIMD_CFUNC simd_double4 __tg_exp2(simd_double4 x);
576/*! @abstract Do not call this function; instead use `exp2` in C and
577 * Objective-C, and `simd::exp2` in C++. */
578static inline SIMD_CFUNC simd_double8 __tg_exp2(simd_double8 x);
579
580#if SIMD_LIBRARY_VERSION >= 1
581/*! @abstract Do not call this function; instead use `exp10` in C and
582 * Objective-C, and `simd::exp10` in C++. */
583static inline SIMD_CFUNC simd_float2 __tg_exp10(simd_float2 x);
584/*! @abstract Do not call this function; instead use `exp10` in C and
585 * Objective-C, and `simd::exp10` in C++. */
586static inline SIMD_CFUNC simd_float3 __tg_exp10(simd_float3 x);
587/*! @abstract Do not call this function; instead use `exp10` in C and
588 * Objective-C, and `simd::exp10` in C++. */
589static inline SIMD_CFUNC simd_float4 __tg_exp10(simd_float4 x);
590/*! @abstract Do not call this function; instead use `exp10` in C and
591 * Objective-C, and `simd::exp10` in C++. */
592static inline SIMD_CFUNC simd_float8 __tg_exp10(simd_float8 x);
593/*! @abstract Do not call this function; instead use `exp10` in C and
594 * Objective-C, and `simd::exp10` in C++. */
595static inline SIMD_CFUNC simd_float16 __tg_exp10(simd_float16 x);
596/*! @abstract Do not call this function; instead use `exp10` in C and
597 * Objective-C, and `simd::exp10` in C++. */
598static inline SIMD_CFUNC simd_double2 __tg_exp10(simd_double2 x);
599/*! @abstract Do not call this function; instead use `exp10` in C and
600 * Objective-C, and `simd::exp10` in C++. */
601static inline SIMD_CFUNC simd_double3 __tg_exp10(simd_double3 x);
602/*! @abstract Do not call this function; instead use `exp10` in C and
603 * Objective-C, and `simd::exp10` in C++. */
604static inline SIMD_CFUNC simd_double4 __tg_exp10(simd_double4 x);
605/*! @abstract Do not call this function; instead use `exp10` in C and
606 * Objective-C, and `simd::exp10` in C++. */
607static inline SIMD_CFUNC simd_double8 __tg_exp10(simd_double8 x);
608#endif
609
610/*! @abstract Do not call this function; instead use `expm1` in C and
611 * Objective-C, and `simd::expm1` in C++. */
612static inline SIMD_CFUNC simd_float2 __tg_expm1(simd_float2 x);
613/*! @abstract Do not call this function; instead use `expm1` in C and
614 * Objective-C, and `simd::expm1` in C++. */
615static inline SIMD_CFUNC simd_float3 __tg_expm1(simd_float3 x);
616/*! @abstract Do not call this function; instead use `expm1` in C and
617 * Objective-C, and `simd::expm1` in C++. */
618static inline SIMD_CFUNC simd_float4 __tg_expm1(simd_float4 x);
619/*! @abstract Do not call this function; instead use `expm1` in C and
620 * Objective-C, and `simd::expm1` in C++. */
621static inline SIMD_CFUNC simd_float8 __tg_expm1(simd_float8 x);
622/*! @abstract Do not call this function; instead use `expm1` in C and
623 * Objective-C, and `simd::expm1` in C++. */
624static inline SIMD_CFUNC simd_float16 __tg_expm1(simd_float16 x);
625/*! @abstract Do not call this function; instead use `expm1` in C and
626 * Objective-C, and `simd::expm1` in C++. */
627static inline SIMD_CFUNC simd_double2 __tg_expm1(simd_double2 x);
628/*! @abstract Do not call this function; instead use `expm1` in C and
629 * Objective-C, and `simd::expm1` in C++. */
630static inline SIMD_CFUNC simd_double3 __tg_expm1(simd_double3 x);
631/*! @abstract Do not call this function; instead use `expm1` in C and
632 * Objective-C, and `simd::expm1` in C++. */
633static inline SIMD_CFUNC simd_double4 __tg_expm1(simd_double4 x);
634/*! @abstract Do not call this function; instead use `expm1` in C and
635 * Objective-C, and `simd::expm1` in C++. */
636static inline SIMD_CFUNC simd_double8 __tg_expm1(simd_double8 x);
637
638/*! @abstract Do not call this function; instead use `log` in C and
639 * Objective-C, and `simd::log` in C++. */
640static inline SIMD_CFUNC simd_float2 __tg_log(simd_float2 x);
641/*! @abstract Do not call this function; instead use `log` in C and
642 * Objective-C, and `simd::log` in C++. */
643static inline SIMD_CFUNC simd_float3 __tg_log(simd_float3 x);
644/*! @abstract Do not call this function; instead use `log` in C and
645 * Objective-C, and `simd::log` in C++. */
646static inline SIMD_CFUNC simd_float4 __tg_log(simd_float4 x);
647/*! @abstract Do not call this function; instead use `log` in C and
648 * Objective-C, and `simd::log` in C++. */
649static inline SIMD_CFUNC simd_float8 __tg_log(simd_float8 x);
650/*! @abstract Do not call this function; instead use `log` in C and
651 * Objective-C, and `simd::log` in C++. */
652static inline SIMD_CFUNC simd_float16 __tg_log(simd_float16 x);
653/*! @abstract Do not call this function; instead use `log` in C and
654 * Objective-C, and `simd::log` in C++. */
655static inline SIMD_CFUNC simd_double2 __tg_log(simd_double2 x);
656/*! @abstract Do not call this function; instead use `log` in C and
657 * Objective-C, and `simd::log` in C++. */
658static inline SIMD_CFUNC simd_double3 __tg_log(simd_double3 x);
659/*! @abstract Do not call this function; instead use `log` in C and
660 * Objective-C, and `simd::log` in C++. */
661static inline SIMD_CFUNC simd_double4 __tg_log(simd_double4 x);
662/*! @abstract Do not call this function; instead use `log` in C and
663 * Objective-C, and `simd::log` in C++. */
664static inline SIMD_CFUNC simd_double8 __tg_log(simd_double8 x);
665
666/*! @abstract Do not call this function; instead use `log2` in C and
667 * Objective-C, and `simd::log2` in C++. */
668static inline SIMD_CFUNC simd_float2 __tg_log2(simd_float2 x);
669/*! @abstract Do not call this function; instead use `log2` in C and
670 * Objective-C, and `simd::log2` in C++. */
671static inline SIMD_CFUNC simd_float3 __tg_log2(simd_float3 x);
672/*! @abstract Do not call this function; instead use `log2` in C and
673 * Objective-C, and `simd::log2` in C++. */
674static inline SIMD_CFUNC simd_float4 __tg_log2(simd_float4 x);
675/*! @abstract Do not call this function; instead use `log2` in C and
676 * Objective-C, and `simd::log2` in C++. */
677static inline SIMD_CFUNC simd_float8 __tg_log2(simd_float8 x);
678/*! @abstract Do not call this function; instead use `log2` in C and
679 * Objective-C, and `simd::log2` in C++. */
680static inline SIMD_CFUNC simd_float16 __tg_log2(simd_float16 x);
681/*! @abstract Do not call this function; instead use `log2` in C and
682 * Objective-C, and `simd::log2` in C++. */
683static inline SIMD_CFUNC simd_double2 __tg_log2(simd_double2 x);
684/*! @abstract Do not call this function; instead use `log2` in C and
685 * Objective-C, and `simd::log2` in C++. */
686static inline SIMD_CFUNC simd_double3 __tg_log2(simd_double3 x);
687/*! @abstract Do not call this function; instead use `log2` in C and
688 * Objective-C, and `simd::log2` in C++. */
689static inline SIMD_CFUNC simd_double4 __tg_log2(simd_double4 x);
690/*! @abstract Do not call this function; instead use `log2` in C and
691 * Objective-C, and `simd::log2` in C++. */
692static inline SIMD_CFUNC simd_double8 __tg_log2(simd_double8 x);
693
694/*! @abstract Do not call this function; instead use `log10` in C and
695 * Objective-C, and `simd::log10` in C++. */
696static inline SIMD_CFUNC simd_float2 __tg_log10(simd_float2 x);
697/*! @abstract Do not call this function; instead use `log10` in C and
698 * Objective-C, and `simd::log10` in C++. */
699static inline SIMD_CFUNC simd_float3 __tg_log10(simd_float3 x);
700/*! @abstract Do not call this function; instead use `log10` in C and
701 * Objective-C, and `simd::log10` in C++. */
702static inline SIMD_CFUNC simd_float4 __tg_log10(simd_float4 x);
703/*! @abstract Do not call this function; instead use `log10` in C and
704 * Objective-C, and `simd::log10` in C++. */
705static inline SIMD_CFUNC simd_float8 __tg_log10(simd_float8 x);
706/*! @abstract Do not call this function; instead use `log10` in C and
707 * Objective-C, and `simd::log10` in C++. */
708static inline SIMD_CFUNC simd_float16 __tg_log10(simd_float16 x);
709/*! @abstract Do not call this function; instead use `log10` in C and
710 * Objective-C, and `simd::log10` in C++. */
711static inline SIMD_CFUNC simd_double2 __tg_log10(simd_double2 x);
712/*! @abstract Do not call this function; instead use `log10` in C and
713 * Objective-C, and `simd::log10` in C++. */
714static inline SIMD_CFUNC simd_double3 __tg_log10(simd_double3 x);
715/*! @abstract Do not call this function; instead use `log10` in C and
716 * Objective-C, and `simd::log10` in C++. */
717static inline SIMD_CFUNC simd_double4 __tg_log10(simd_double4 x);
718/*! @abstract Do not call this function; instead use `log10` in C and
719 * Objective-C, and `simd::log10` in C++. */
720static inline SIMD_CFUNC simd_double8 __tg_log10(simd_double8 x);
721
722/*! @abstract Do not call this function; instead use `log1p` in C and
723 * Objective-C, and `simd::log1p` in C++. */
724static inline SIMD_CFUNC simd_float2 __tg_log1p(simd_float2 x);
725/*! @abstract Do not call this function; instead use `log1p` in C and
726 * Objective-C, and `simd::log1p` in C++. */
727static inline SIMD_CFUNC simd_float3 __tg_log1p(simd_float3 x);
728/*! @abstract Do not call this function; instead use `log1p` in C and
729 * Objective-C, and `simd::log1p` in C++. */
730static inline SIMD_CFUNC simd_float4 __tg_log1p(simd_float4 x);
731/*! @abstract Do not call this function; instead use `log1p` in C and
732 * Objective-C, and `simd::log1p` in C++. */
733static inline SIMD_CFUNC simd_float8 __tg_log1p(simd_float8 x);
734/*! @abstract Do not call this function; instead use `log1p` in C and
735 * Objective-C, and `simd::log1p` in C++. */
736static inline SIMD_CFUNC simd_float16 __tg_log1p(simd_float16 x);
737/*! @abstract Do not call this function; instead use `log1p` in C and
738 * Objective-C, and `simd::log1p` in C++. */
739static inline SIMD_CFUNC simd_double2 __tg_log1p(simd_double2 x);
740/*! @abstract Do not call this function; instead use `log1p` in C and
741 * Objective-C, and `simd::log1p` in C++. */
742static inline SIMD_CFUNC simd_double3 __tg_log1p(simd_double3 x);
743/*! @abstract Do not call this function; instead use `log1p` in C and
744 * Objective-C, and `simd::log1p` in C++. */
745static inline SIMD_CFUNC simd_double4 __tg_log1p(simd_double4 x);
746/*! @abstract Do not call this function; instead use `log1p` in C and
747 * Objective-C, and `simd::log1p` in C++. */
748static inline SIMD_CFUNC simd_double8 __tg_log1p(simd_double8 x);
749
750/*! @abstract Do not call this function; instead use `fabs` in C and
751 * Objective-C, and `simd::fabs` in C++. */
752static inline SIMD_CFUNC simd_float2 __tg_fabs(simd_float2 x);
753/*! @abstract Do not call this function; instead use `fabs` in C and
754 * Objective-C, and `simd::fabs` in C++. */
755static inline SIMD_CFUNC simd_float3 __tg_fabs(simd_float3 x);
756/*! @abstract Do not call this function; instead use `fabs` in C and
757 * Objective-C, and `simd::fabs` in C++. */
758static inline SIMD_CFUNC simd_float4 __tg_fabs(simd_float4 x);
759/*! @abstract Do not call this function; instead use `fabs` in C and
760 * Objective-C, and `simd::fabs` in C++. */
761static inline SIMD_CFUNC simd_float8 __tg_fabs(simd_float8 x);
762/*! @abstract Do not call this function; instead use `fabs` in C and
763 * Objective-C, and `simd::fabs` in C++. */
764static inline SIMD_CFUNC simd_float16 __tg_fabs(simd_float16 x);
765/*! @abstract Do not call this function; instead use `fabs` in C and
766 * Objective-C, and `simd::fabs` in C++. */
767static inline SIMD_CFUNC simd_double2 __tg_fabs(simd_double2 x);
768/*! @abstract Do not call this function; instead use `fabs` in C and
769 * Objective-C, and `simd::fabs` in C++. */
770static inline SIMD_CFUNC simd_double3 __tg_fabs(simd_double3 x);
771/*! @abstract Do not call this function; instead use `fabs` in C and
772 * Objective-C, and `simd::fabs` in C++. */
773static inline SIMD_CFUNC simd_double4 __tg_fabs(simd_double4 x);
774/*! @abstract Do not call this function; instead use `fabs` in C and
775 * Objective-C, and `simd::fabs` in C++. */
776static inline SIMD_CFUNC simd_double8 __tg_fabs(simd_double8 x);
777
778/*! @abstract Do not call this function; instead use `cbrt` in C and
779 * Objective-C, and `simd::cbrt` in C++. */
780static inline SIMD_CFUNC simd_float2 __tg_cbrt(simd_float2 x);
781/*! @abstract Do not call this function; instead use `cbrt` in C and
782 * Objective-C, and `simd::cbrt` in C++. */
783static inline SIMD_CFUNC simd_float3 __tg_cbrt(simd_float3 x);
784/*! @abstract Do not call this function; instead use `cbrt` in C and
785 * Objective-C, and `simd::cbrt` in C++. */
786static inline SIMD_CFUNC simd_float4 __tg_cbrt(simd_float4 x);
787/*! @abstract Do not call this function; instead use `cbrt` in C and
788 * Objective-C, and `simd::cbrt` in C++. */
789static inline SIMD_CFUNC simd_float8 __tg_cbrt(simd_float8 x);
790/*! @abstract Do not call this function; instead use `cbrt` in C and
791 * Objective-C, and `simd::cbrt` in C++. */
792static inline SIMD_CFUNC simd_float16 __tg_cbrt(simd_float16 x);
793/*! @abstract Do not call this function; instead use `cbrt` in C and
794 * Objective-C, and `simd::cbrt` in C++. */
795static inline SIMD_CFUNC simd_double2 __tg_cbrt(simd_double2 x);
796/*! @abstract Do not call this function; instead use `cbrt` in C and
797 * Objective-C, and `simd::cbrt` in C++. */
798static inline SIMD_CFUNC simd_double3 __tg_cbrt(simd_double3 x);
799/*! @abstract Do not call this function; instead use `cbrt` in C and
800 * Objective-C, and `simd::cbrt` in C++. */
801static inline SIMD_CFUNC simd_double4 __tg_cbrt(simd_double4 x);
802/*! @abstract Do not call this function; instead use `cbrt` in C and
803 * Objective-C, and `simd::cbrt` in C++. */
804static inline SIMD_CFUNC simd_double8 __tg_cbrt(simd_double8 x);
805
806/*! @abstract Do not call this function; instead use `sqrt` in C and
807 * Objective-C, and `simd::sqrt` in C++. */
808static inline SIMD_CFUNC simd_float2 __tg_sqrt(simd_float2 x);
809/*! @abstract Do not call this function; instead use `sqrt` in C and
810 * Objective-C, and `simd::sqrt` in C++. */
811static inline SIMD_CFUNC simd_float3 __tg_sqrt(simd_float3 x);
812/*! @abstract Do not call this function; instead use `sqrt` in C and
813 * Objective-C, and `simd::sqrt` in C++. */
814static inline SIMD_CFUNC simd_float4 __tg_sqrt(simd_float4 x);
815/*! @abstract Do not call this function; instead use `sqrt` in C and
816 * Objective-C, and `simd::sqrt` in C++. */
817static inline SIMD_CFUNC simd_float8 __tg_sqrt(simd_float8 x);
818/*! @abstract Do not call this function; instead use `sqrt` in C and
819 * Objective-C, and `simd::sqrt` in C++. */
820static inline SIMD_CFUNC simd_float16 __tg_sqrt(simd_float16 x);
821/*! @abstract Do not call this function; instead use `sqrt` in C and
822 * Objective-C, and `simd::sqrt` in C++. */
823static inline SIMD_CFUNC simd_double2 __tg_sqrt(simd_double2 x);
824/*! @abstract Do not call this function; instead use `sqrt` in C and
825 * Objective-C, and `simd::sqrt` in C++. */
826static inline SIMD_CFUNC simd_double3 __tg_sqrt(simd_double3 x);
827/*! @abstract Do not call this function; instead use `sqrt` in C and
828 * Objective-C, and `simd::sqrt` in C++. */
829static inline SIMD_CFUNC simd_double4 __tg_sqrt(simd_double4 x);
830/*! @abstract Do not call this function; instead use `sqrt` in C and
831 * Objective-C, and `simd::sqrt` in C++. */
832static inline SIMD_CFUNC simd_double8 __tg_sqrt(simd_double8 x);
833
834/*! @abstract Do not call this function; instead use `erf` in C and
835 * Objective-C, and `simd::erf` in C++. */
836static inline SIMD_CFUNC simd_float2 __tg_erf(simd_float2 x);
837/*! @abstract Do not call this function; instead use `erf` in C and
838 * Objective-C, and `simd::erf` in C++. */
839static inline SIMD_CFUNC simd_float3 __tg_erf(simd_float3 x);
840/*! @abstract Do not call this function; instead use `erf` in C and
841 * Objective-C, and `simd::erf` in C++. */
842static inline SIMD_CFUNC simd_float4 __tg_erf(simd_float4 x);
843/*! @abstract Do not call this function; instead use `erf` in C and
844 * Objective-C, and `simd::erf` in C++. */
845static inline SIMD_CFUNC simd_float8 __tg_erf(simd_float8 x);
846/*! @abstract Do not call this function; instead use `erf` in C and
847 * Objective-C, and `simd::erf` in C++. */
848static inline SIMD_CFUNC simd_float16 __tg_erf(simd_float16 x);
849/*! @abstract Do not call this function; instead use `erf` in C and
850 * Objective-C, and `simd::erf` in C++. */
851static inline SIMD_CFUNC simd_double2 __tg_erf(simd_double2 x);
852/*! @abstract Do not call this function; instead use `erf` in C and
853 * Objective-C, and `simd::erf` in C++. */
854static inline SIMD_CFUNC simd_double3 __tg_erf(simd_double3 x);
855/*! @abstract Do not call this function; instead use `erf` in C and
856 * Objective-C, and `simd::erf` in C++. */
857static inline SIMD_CFUNC simd_double4 __tg_erf(simd_double4 x);
858/*! @abstract Do not call this function; instead use `erf` in C and
859 * Objective-C, and `simd::erf` in C++. */
860static inline SIMD_CFUNC simd_double8 __tg_erf(simd_double8 x);
861
862/*! @abstract Do not call this function; instead use `erfc` in C and
863 * Objective-C, and `simd::erfc` in C++. */
864static inline SIMD_CFUNC simd_float2 __tg_erfc(simd_float2 x);
865/*! @abstract Do not call this function; instead use `erfc` in C and
866 * Objective-C, and `simd::erfc` in C++. */
867static inline SIMD_CFUNC simd_float3 __tg_erfc(simd_float3 x);
868/*! @abstract Do not call this function; instead use `erfc` in C and
869 * Objective-C, and `simd::erfc` in C++. */
870static inline SIMD_CFUNC simd_float4 __tg_erfc(simd_float4 x);
871/*! @abstract Do not call this function; instead use `erfc` in C and
872 * Objective-C, and `simd::erfc` in C++. */
873static inline SIMD_CFUNC simd_float8 __tg_erfc(simd_float8 x);
874/*! @abstract Do not call this function; instead use `erfc` in C and
875 * Objective-C, and `simd::erfc` in C++. */
876static inline SIMD_CFUNC simd_float16 __tg_erfc(simd_float16 x);
877/*! @abstract Do not call this function; instead use `erfc` in C and
878 * Objective-C, and `simd::erfc` in C++. */
879static inline SIMD_CFUNC simd_double2 __tg_erfc(simd_double2 x);
880/*! @abstract Do not call this function; instead use `erfc` in C and
881 * Objective-C, and `simd::erfc` in C++. */
882static inline SIMD_CFUNC simd_double3 __tg_erfc(simd_double3 x);
883/*! @abstract Do not call this function; instead use `erfc` in C and
884 * Objective-C, and `simd::erfc` in C++. */
885static inline SIMD_CFUNC simd_double4 __tg_erfc(simd_double4 x);
886/*! @abstract Do not call this function; instead use `erfc` in C and
887 * Objective-C, and `simd::erfc` in C++. */
888static inline SIMD_CFUNC simd_double8 __tg_erfc(simd_double8 x);
889
890/*! @abstract Do not call this function; instead use `tgamma` in C and
891 * Objective-C, and `simd::tgamma` in C++. */
892static inline SIMD_CFUNC simd_float2 __tg_tgamma(simd_float2 x);
893/*! @abstract Do not call this function; instead use `tgamma` in C and
894 * Objective-C, and `simd::tgamma` in C++. */
895static inline SIMD_CFUNC simd_float3 __tg_tgamma(simd_float3 x);
896/*! @abstract Do not call this function; instead use `tgamma` in C and
897 * Objective-C, and `simd::tgamma` in C++. */
898static inline SIMD_CFUNC simd_float4 __tg_tgamma(simd_float4 x);
899/*! @abstract Do not call this function; instead use `tgamma` in C and
900 * Objective-C, and `simd::tgamma` in C++. */
901static inline SIMD_CFUNC simd_float8 __tg_tgamma(simd_float8 x);
902/*! @abstract Do not call this function; instead use `tgamma` in C and
903 * Objective-C, and `simd::tgamma` in C++. */
904static inline SIMD_CFUNC simd_float16 __tg_tgamma(simd_float16 x);
905/*! @abstract Do not call this function; instead use `tgamma` in C and
906 * Objective-C, and `simd::tgamma` in C++. */
907static inline SIMD_CFUNC simd_double2 __tg_tgamma(simd_double2 x);
908/*! @abstract Do not call this function; instead use `tgamma` in C and
909 * Objective-C, and `simd::tgamma` in C++. */
910static inline SIMD_CFUNC simd_double3 __tg_tgamma(simd_double3 x);
911/*! @abstract Do not call this function; instead use `tgamma` in C and
912 * Objective-C, and `simd::tgamma` in C++. */
913static inline SIMD_CFUNC simd_double4 __tg_tgamma(simd_double4 x);
914/*! @abstract Do not call this function; instead use `tgamma` in C and
915 * Objective-C, and `simd::tgamma` in C++. */
916static inline SIMD_CFUNC simd_double8 __tg_tgamma(simd_double8 x);
917
918/*! @abstract Do not call this function; instead use `lgamma` in C and
919 * Objective-C, and `simd::lgamma` in C++. */
920static inline SIMD_CFUNC simd_float2 __tg_lgamma(simd_float2 x);
921/*! @abstract Do not call this function; instead use `lgamma` in C and
922 * Objective-C, and `simd::lgamma` in C++. */
923static inline SIMD_CFUNC simd_float3 __tg_lgamma(simd_float3 x);
924/*! @abstract Do not call this function; instead use `lgamma` in C and
925 * Objective-C, and `simd::lgamma` in C++. */
926static inline SIMD_CFUNC simd_float4 __tg_lgamma(simd_float4 x);
927/*! @abstract Do not call this function; instead use `lgamma` in C and
928 * Objective-C, and `simd::lgamma` in C++. */
929static inline SIMD_CFUNC simd_float8 __tg_lgamma(simd_float8 x);
930/*! @abstract Do not call this function; instead use `lgamma` in C and
931 * Objective-C, and `simd::lgamma` in C++. */
932static inline SIMD_CFUNC simd_float16 __tg_lgamma(simd_float16 x);
933/*! @abstract Do not call this function; instead use `lgamma` in C and
934 * Objective-C, and `simd::lgamma` in C++. */
935static inline SIMD_CFUNC simd_double2 __tg_lgamma(simd_double2 x);
936/*! @abstract Do not call this function; instead use `lgamma` in C and
937 * Objective-C, and `simd::lgamma` in C++. */
938static inline SIMD_CFUNC simd_double3 __tg_lgamma(simd_double3 x);
939/*! @abstract Do not call this function; instead use `lgamma` in C and
940 * Objective-C, and `simd::lgamma` in C++. */
941static inline SIMD_CFUNC simd_double4 __tg_lgamma(simd_double4 x);
942/*! @abstract Do not call this function; instead use `lgamma` in C and
943 * Objective-C, and `simd::lgamma` in C++. */
944static inline SIMD_CFUNC simd_double8 __tg_lgamma(simd_double8 x);
945
946/*! @abstract Do not call this function; instead use `ceil` in C and
947 * Objective-C, and `simd::ceil` in C++. */
948static inline SIMD_CFUNC simd_float2 __tg_ceil(simd_float2 x);
949/*! @abstract Do not call this function; instead use `ceil` in C and
950 * Objective-C, and `simd::ceil` in C++. */
951static inline SIMD_CFUNC simd_float3 __tg_ceil(simd_float3 x);
952/*! @abstract Do not call this function; instead use `ceil` in C and
953 * Objective-C, and `simd::ceil` in C++. */
954static inline SIMD_CFUNC simd_float4 __tg_ceil(simd_float4 x);
955/*! @abstract Do not call this function; instead use `ceil` in C and
956 * Objective-C, and `simd::ceil` in C++. */
957static inline SIMD_CFUNC simd_float8 __tg_ceil(simd_float8 x);
958/*! @abstract Do not call this function; instead use `ceil` in C and
959 * Objective-C, and `simd::ceil` in C++. */
960static inline SIMD_CFUNC simd_float16 __tg_ceil(simd_float16 x);
961/*! @abstract Do not call this function; instead use `ceil` in C and
962 * Objective-C, and `simd::ceil` in C++. */
963static inline SIMD_CFUNC simd_double2 __tg_ceil(simd_double2 x);
964/*! @abstract Do not call this function; instead use `ceil` in C and
965 * Objective-C, and `simd::ceil` in C++. */
966static inline SIMD_CFUNC simd_double3 __tg_ceil(simd_double3 x);
967/*! @abstract Do not call this function; instead use `ceil` in C and
968 * Objective-C, and `simd::ceil` in C++. */
969static inline SIMD_CFUNC simd_double4 __tg_ceil(simd_double4 x);
970/*! @abstract Do not call this function; instead use `ceil` in C and
971 * Objective-C, and `simd::ceil` in C++. */
972static inline SIMD_CFUNC simd_double8 __tg_ceil(simd_double8 x);
973
974/*! @abstract Do not call this function; instead use `floor` in C and
975 * Objective-C, and `simd::floor` in C++. */
976static inline SIMD_CFUNC simd_float2 __tg_floor(simd_float2 x);
977/*! @abstract Do not call this function; instead use `floor` in C and
978 * Objective-C, and `simd::floor` in C++. */
979static inline SIMD_CFUNC simd_float3 __tg_floor(simd_float3 x);
980/*! @abstract Do not call this function; instead use `floor` in C and
981 * Objective-C, and `simd::floor` in C++. */
982static inline SIMD_CFUNC simd_float4 __tg_floor(simd_float4 x);
983/*! @abstract Do not call this function; instead use `floor` in C and
984 * Objective-C, and `simd::floor` in C++. */
985static inline SIMD_CFUNC simd_float8 __tg_floor(simd_float8 x);
986/*! @abstract Do not call this function; instead use `floor` in C and
987 * Objective-C, and `simd::floor` in C++. */
988static inline SIMD_CFUNC simd_float16 __tg_floor(simd_float16 x);
989/*! @abstract Do not call this function; instead use `floor` in C and
990 * Objective-C, and `simd::floor` in C++. */
991static inline SIMD_CFUNC simd_double2 __tg_floor(simd_double2 x);
992/*! @abstract Do not call this function; instead use `floor` in C and
993 * Objective-C, and `simd::floor` in C++. */
994static inline SIMD_CFUNC simd_double3 __tg_floor(simd_double3 x);
995/*! @abstract Do not call this function; instead use `floor` in C and
996 * Objective-C, and `simd::floor` in C++. */
997static inline SIMD_CFUNC simd_double4 __tg_floor(simd_double4 x);
998/*! @abstract Do not call this function; instead use `floor` in C and
999 * Objective-C, and `simd::floor` in C++. */
1000static inline SIMD_CFUNC simd_double8 __tg_floor(simd_double8 x);
1001
1002/*! @abstract Do not call this function; instead use `rint` in C and
1003 * Objective-C, and `simd::rint` in C++. */
1004static inline SIMD_CFUNC simd_float2 __tg_rint(simd_float2 x);
1005/*! @abstract Do not call this function; instead use `rint` in C and
1006 * Objective-C, and `simd::rint` in C++. */
1007static inline SIMD_CFUNC simd_float3 __tg_rint(simd_float3 x);
1008/*! @abstract Do not call this function; instead use `rint` in C and
1009 * Objective-C, and `simd::rint` in C++. */
1010static inline SIMD_CFUNC simd_float4 __tg_rint(simd_float4 x);
1011/*! @abstract Do not call this function; instead use `rint` in C and
1012 * Objective-C, and `simd::rint` in C++. */
1013static inline SIMD_CFUNC simd_float8 __tg_rint(simd_float8 x);
1014/*! @abstract Do not call this function; instead use `rint` in C and
1015 * Objective-C, and `simd::rint` in C++. */
1016static inline SIMD_CFUNC simd_float16 __tg_rint(simd_float16 x);
1017/*! @abstract Do not call this function; instead use `rint` in C and
1018 * Objective-C, and `simd::rint` in C++. */
1019static inline SIMD_CFUNC simd_double2 __tg_rint(simd_double2 x);
1020/*! @abstract Do not call this function; instead use `rint` in C and
1021 * Objective-C, and `simd::rint` in C++. */
1022static inline SIMD_CFUNC simd_double3 __tg_rint(simd_double3 x);
1023/*! @abstract Do not call this function; instead use `rint` in C and
1024 * Objective-C, and `simd::rint` in C++. */
1025static inline SIMD_CFUNC simd_double4 __tg_rint(simd_double4 x);
1026/*! @abstract Do not call this function; instead use `rint` in C and
1027 * Objective-C, and `simd::rint` in C++. */
1028static inline SIMD_CFUNC simd_double8 __tg_rint(simd_double8 x);
1029
1030/*! @abstract Do not call this function; instead use `round` in C and
1031 * Objective-C, and `simd::round` in C++. */
1032static inline SIMD_CFUNC simd_float2 __tg_round(simd_float2 x);
1033/*! @abstract Do not call this function; instead use `round` in C and
1034 * Objective-C, and `simd::round` in C++. */
1035static inline SIMD_CFUNC simd_float3 __tg_round(simd_float3 x);
1036/*! @abstract Do not call this function; instead use `round` in C and
1037 * Objective-C, and `simd::round` in C++. */
1038static inline SIMD_CFUNC simd_float4 __tg_round(simd_float4 x);
1039/*! @abstract Do not call this function; instead use `round` in C and
1040 * Objective-C, and `simd::round` in C++. */
1041static inline SIMD_CFUNC simd_float8 __tg_round(simd_float8 x);
1042/*! @abstract Do not call this function; instead use `round` in C and
1043 * Objective-C, and `simd::round` in C++. */
1044static inline SIMD_CFUNC simd_float16 __tg_round(simd_float16 x);
1045/*! @abstract Do not call this function; instead use `round` in C and
1046 * Objective-C, and `simd::round` in C++. */
1047static inline SIMD_CFUNC simd_double2 __tg_round(simd_double2 x);
1048/*! @abstract Do not call this function; instead use `round` in C and
1049 * Objective-C, and `simd::round` in C++. */
1050static inline SIMD_CFUNC simd_double3 __tg_round(simd_double3 x);
1051/*! @abstract Do not call this function; instead use `round` in C and
1052 * Objective-C, and `simd::round` in C++. */
1053static inline SIMD_CFUNC simd_double4 __tg_round(simd_double4 x);
1054/*! @abstract Do not call this function; instead use `round` in C and
1055 * Objective-C, and `simd::round` in C++. */
1056static inline SIMD_CFUNC simd_double8 __tg_round(simd_double8 x);
1057
1058/*! @abstract Do not call this function; instead use `trunc` in C and
1059 * Objective-C, and `simd::trunc` in C++. */
1060static inline SIMD_CFUNC simd_float2 __tg_trunc(simd_float2 x);
1061/*! @abstract Do not call this function; instead use `trunc` in C and
1062 * Objective-C, and `simd::trunc` in C++. */
1063static inline SIMD_CFUNC simd_float3 __tg_trunc(simd_float3 x);
1064/*! @abstract Do not call this function; instead use `trunc` in C and
1065 * Objective-C, and `simd::trunc` in C++. */
1066static inline SIMD_CFUNC simd_float4 __tg_trunc(simd_float4 x);
1067/*! @abstract Do not call this function; instead use `trunc` in C and
1068 * Objective-C, and `simd::trunc` in C++. */
1069static inline SIMD_CFUNC simd_float8 __tg_trunc(simd_float8 x);
1070/*! @abstract Do not call this function; instead use `trunc` in C and
1071 * Objective-C, and `simd::trunc` in C++. */
1072static inline SIMD_CFUNC simd_float16 __tg_trunc(simd_float16 x);
1073/*! @abstract Do not call this function; instead use `trunc` in C and
1074 * Objective-C, and `simd::trunc` in C++. */
1075static inline SIMD_CFUNC simd_double2 __tg_trunc(simd_double2 x);
1076/*! @abstract Do not call this function; instead use `trunc` in C and
1077 * Objective-C, and `simd::trunc` in C++. */
1078static inline SIMD_CFUNC simd_double3 __tg_trunc(simd_double3 x);
1079/*! @abstract Do not call this function; instead use `trunc` in C and
1080 * Objective-C, and `simd::trunc` in C++. */
1081static inline SIMD_CFUNC simd_double4 __tg_trunc(simd_double4 x);
1082/*! @abstract Do not call this function; instead use `trunc` in C and
1083 * Objective-C, and `simd::trunc` in C++. */
1084static inline SIMD_CFUNC simd_double8 __tg_trunc(simd_double8 x);
1085
1086#if SIMD_LIBRARY_VERSION >= 5
1087/*! @abstract Do not call this function; instead use `sincos` in C and
1088 * Objective-C, and `simd::sincos` in C++. */
1089static inline SIMD_NONCONST void __tg_sincos(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp);
1090/*! @abstract Do not call this function; instead use `sincos` in C and
1091 * Objective-C, and `simd::sincos` in C++. */
1092static inline SIMD_NONCONST void __tg_sincos(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp);
1093/*! @abstract Do not call this function; instead use `sincos` in C and
1094 * Objective-C, and `simd::sincos` in C++. */
1095static inline SIMD_NONCONST void __tg_sincos(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp);
1096/*! @abstract Do not call this function; instead use `sincos` in C and
1097 * Objective-C, and `simd::sincos` in C++. */
1098static inline SIMD_NONCONST void __tg_sincos(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp);
1099/*! @abstract Do not call this function; instead use `sincos` in C and
1100 * Objective-C, and `simd::sincos` in C++. */
1101static inline SIMD_NONCONST void __tg_sincos(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp);
1102/*! @abstract Do not call this function; instead use `sincos` in C and
1103 * Objective-C, and `simd::sincos` in C++. */
1104static inline SIMD_NONCONST void __tg_sincos(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp);
1105/*! @abstract Do not call this function; instead use `sincos` in C and
1106 * Objective-C, and `simd::sincos` in C++. */
1107static inline SIMD_NONCONST void __tg_sincos(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp);
1108/*! @abstract Do not call this function; instead use `sincos` in C and
1109 * Objective-C, and `simd::sincos` in C++. */
1110static inline SIMD_NONCONST void __tg_sincos(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp);
1111/*! @abstract Do not call this function; instead use `sincos` in C and
1112 * Objective-C, and `simd::sincos` in C++. */
1113static inline SIMD_NONCONST void __tg_sincos(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp);
1114
1115/*! @abstract Do not call this function; instead use `sincospi` in C and
1116 * Objective-C, and `simd::sincospi` in C++. */
1117static inline SIMD_NONCONST void __tg_sincospi(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp);
1118/*! @abstract Do not call this function; instead use `sincospi` in C and
1119 * Objective-C, and `simd::sincospi` in C++. */
1120static inline SIMD_NONCONST void __tg_sincospi(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp);
1121/*! @abstract Do not call this function; instead use `sincospi` in C and
1122 * Objective-C, and `simd::sincospi` in C++. */
1123static inline SIMD_NONCONST void __tg_sincospi(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp);
1124/*! @abstract Do not call this function; instead use `sincospi` in C and
1125 * Objective-C, and `simd::sincospi` in C++. */
1126static inline SIMD_NONCONST void __tg_sincospi(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp);
1127/*! @abstract Do not call this function; instead use `sincospi` in C and
1128 * Objective-C, and `simd::sincospi` in C++. */
1129static inline SIMD_NONCONST void __tg_sincospi(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp);
1130/*! @abstract Do not call this function; instead use `sincospi` in C and
1131 * Objective-C, and `simd::sincospi` in C++. */
1132static inline SIMD_NONCONST void __tg_sincospi(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp);
1133/*! @abstract Do not call this function; instead use `sincospi` in C and
1134 * Objective-C, and `simd::sincospi` in C++. */
1135static inline SIMD_NONCONST void __tg_sincospi(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp);
1136/*! @abstract Do not call this function; instead use `sincospi` in C and
1137 * Objective-C, and `simd::sincospi` in C++. */
1138static inline SIMD_NONCONST void __tg_sincospi(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp);
1139/*! @abstract Do not call this function; instead use `sincospi` in C and
1140 * Objective-C, and `simd::sincospi` in C++. */
1141static inline SIMD_NONCONST void __tg_sincospi(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp);
1142
1143#endif
1144/*! @abstract Do not call this function; instead use `isfinite` in C and
1145 * Objective-C, and `simd::isfinite` in C++. */
1146static inline SIMD_CFUNC simd_short2 __tg_isfinite(simd_half2 x);
1147/*! @abstract Do not call this function; instead use `isfinite` in C and
1148 * Objective-C, and `simd::isfinite` in C++. */
1149static inline SIMD_CFUNC simd_short3 __tg_isfinite(simd_half3 x);
1150/*! @abstract Do not call this function; instead use `isfinite` in C and
1151 * Objective-C, and `simd::isfinite` in C++. */
1152static inline SIMD_CFUNC simd_short4 __tg_isfinite(simd_half4 x);
1153/*! @abstract Do not call this function; instead use `isfinite` in C and
1154 * Objective-C, and `simd::isfinite` in C++. */
1155static inline SIMD_CFUNC simd_short8 __tg_isfinite(simd_half8 x);
1156/*! @abstract Do not call this function; instead use `isfinite` in C and
1157 * Objective-C, and `simd::isfinite` in C++. */
1158static inline SIMD_CFUNC simd_short16 __tg_isfinite(simd_half16 x);
1159/*! @abstract Do not call this function; instead use `isfinite` in C and
1160 * Objective-C, and `simd::isfinite` in C++. */
1161static inline SIMD_CFUNC simd_short32 __tg_isfinite(simd_half32 x);
1162/*! @abstract Do not call this function; instead use `isfinite` in C and
1163 * Objective-C, and `simd::isfinite` in C++. */
1164static inline SIMD_CFUNC simd_int2 __tg_isfinite(simd_float2 x);
1165/*! @abstract Do not call this function; instead use `isfinite` in C and
1166 * Objective-C, and `simd::isfinite` in C++. */
1167static inline SIMD_CFUNC simd_int3 __tg_isfinite(simd_float3 x);
1168/*! @abstract Do not call this function; instead use `isfinite` in C and
1169 * Objective-C, and `simd::isfinite` in C++. */
1170static inline SIMD_CFUNC simd_int4 __tg_isfinite(simd_float4 x);
1171/*! @abstract Do not call this function; instead use `isfinite` in C and
1172 * Objective-C, and `simd::isfinite` in C++. */
1173static inline SIMD_CFUNC simd_int8 __tg_isfinite(simd_float8 x);
1174/*! @abstract Do not call this function; instead use `isfinite` in C and
1175 * Objective-C, and `simd::isfinite` in C++. */
1176static inline SIMD_CFUNC simd_int16 __tg_isfinite(simd_float16 x);
1177/*! @abstract Do not call this function; instead use `isfinite` in C and
1178 * Objective-C, and `simd::isfinite` in C++. */
1179static inline SIMD_CFUNC simd_long2 __tg_isfinite(simd_double2 x);
1180/*! @abstract Do not call this function; instead use `isfinite` in C and
1181 * Objective-C, and `simd::isfinite` in C++. */
1182static inline SIMD_CFUNC simd_long3 __tg_isfinite(simd_double3 x);
1183/*! @abstract Do not call this function; instead use `isfinite` in C and
1184 * Objective-C, and `simd::isfinite` in C++. */
1185static inline SIMD_CFUNC simd_long4 __tg_isfinite(simd_double4 x);
1186/*! @abstract Do not call this function; instead use `isfinite` in C and
1187 * Objective-C, and `simd::isfinite` in C++. */
1188static inline SIMD_CFUNC simd_long8 __tg_isfinite(simd_double8 x);
1189
1190/*! @abstract Do not call this function; instead use `isinf` in C and
1191 * Objective-C, and `simd::isinf` in C++. */
1192static inline SIMD_CFUNC simd_short2 __tg_isinf(simd_half2 x);
1193/*! @abstract Do not call this function; instead use `isinf` in C and
1194 * Objective-C, and `simd::isinf` in C++. */
1195static inline SIMD_CFUNC simd_short3 __tg_isinf(simd_half3 x);
1196/*! @abstract Do not call this function; instead use `isinf` in C and
1197 * Objective-C, and `simd::isinf` in C++. */
1198static inline SIMD_CFUNC simd_short4 __tg_isinf(simd_half4 x);
1199/*! @abstract Do not call this function; instead use `isinf` in C and
1200 * Objective-C, and `simd::isinf` in C++. */
1201static inline SIMD_CFUNC simd_short8 __tg_isinf(simd_half8 x);
1202/*! @abstract Do not call this function; instead use `isinf` in C and
1203 * Objective-C, and `simd::isinf` in C++. */
1204static inline SIMD_CFUNC simd_short16 __tg_isinf(simd_half16 x);
1205/*! @abstract Do not call this function; instead use `isinf` in C and
1206 * Objective-C, and `simd::isinf` in C++. */
1207static inline SIMD_CFUNC simd_short32 __tg_isinf(simd_half32 x);
1208/*! @abstract Do not call this function; instead use `isinf` in C and
1209 * Objective-C, and `simd::isinf` in C++. */
1210static inline SIMD_CFUNC simd_int2 __tg_isinf(simd_float2 x);
1211/*! @abstract Do not call this function; instead use `isinf` in C and
1212 * Objective-C, and `simd::isinf` in C++. */
1213static inline SIMD_CFUNC simd_int3 __tg_isinf(simd_float3 x);
1214/*! @abstract Do not call this function; instead use `isinf` in C and
1215 * Objective-C, and `simd::isinf` in C++. */
1216static inline SIMD_CFUNC simd_int4 __tg_isinf(simd_float4 x);
1217/*! @abstract Do not call this function; instead use `isinf` in C and
1218 * Objective-C, and `simd::isinf` in C++. */
1219static inline SIMD_CFUNC simd_int8 __tg_isinf(simd_float8 x);
1220/*! @abstract Do not call this function; instead use `isinf` in C and
1221 * Objective-C, and `simd::isinf` in C++. */
1222static inline SIMD_CFUNC simd_int16 __tg_isinf(simd_float16 x);
1223/*! @abstract Do not call this function; instead use `isinf` in C and
1224 * Objective-C, and `simd::isinf` in C++. */
1225static inline SIMD_CFUNC simd_long2 __tg_isinf(simd_double2 x);
1226/*! @abstract Do not call this function; instead use `isinf` in C and
1227 * Objective-C, and `simd::isinf` in C++. */
1228static inline SIMD_CFUNC simd_long3 __tg_isinf(simd_double3 x);
1229/*! @abstract Do not call this function; instead use `isinf` in C and
1230 * Objective-C, and `simd::isinf` in C++. */
1231static inline SIMD_CFUNC simd_long4 __tg_isinf(simd_double4 x);
1232/*! @abstract Do not call this function; instead use `isinf` in C and
1233 * Objective-C, and `simd::isinf` in C++. */
1234static inline SIMD_CFUNC simd_long8 __tg_isinf(simd_double8 x);
1235
1236/*! @abstract Do not call this function; instead use `isnan` in C and
1237 * Objective-C, and `simd::isnan` in C++. */
1238static inline SIMD_CFUNC simd_short2 __tg_isnan(simd_half2 x);
1239/*! @abstract Do not call this function; instead use `isnan` in C and
1240 * Objective-C, and `simd::isnan` in C++. */
1241static inline SIMD_CFUNC simd_short3 __tg_isnan(simd_half3 x);
1242/*! @abstract Do not call this function; instead use `isnan` in C and
1243 * Objective-C, and `simd::isnan` in C++. */
1244static inline SIMD_CFUNC simd_short4 __tg_isnan(simd_half4 x);
1245/*! @abstract Do not call this function; instead use `isnan` in C and
1246 * Objective-C, and `simd::isnan` in C++. */
1247static inline SIMD_CFUNC simd_short8 __tg_isnan(simd_half8 x);
1248/*! @abstract Do not call this function; instead use `isnan` in C and
1249 * Objective-C, and `simd::isnan` in C++. */
1250static inline SIMD_CFUNC simd_short16 __tg_isnan(simd_half16 x);
1251/*! @abstract Do not call this function; instead use `isnan` in C and
1252 * Objective-C, and `simd::isnan` in C++. */
1253static inline SIMD_CFUNC simd_short32 __tg_isnan(simd_half32 x);
1254/*! @abstract Do not call this function; instead use `isnan` in C and
1255 * Objective-C, and `simd::isnan` in C++. */
1256static inline SIMD_CFUNC simd_int2 __tg_isnan(simd_float2 x);
1257/*! @abstract Do not call this function; instead use `isnan` in C and
1258 * Objective-C, and `simd::isnan` in C++. */
1259static inline SIMD_CFUNC simd_int3 __tg_isnan(simd_float3 x);
1260/*! @abstract Do not call this function; instead use `isnan` in C and
1261 * Objective-C, and `simd::isnan` in C++. */
1262static inline SIMD_CFUNC simd_int4 __tg_isnan(simd_float4 x);
1263/*! @abstract Do not call this function; instead use `isnan` in C and
1264 * Objective-C, and `simd::isnan` in C++. */
1265static inline SIMD_CFUNC simd_int8 __tg_isnan(simd_float8 x);
1266/*! @abstract Do not call this function; instead use `isnan` in C and
1267 * Objective-C, and `simd::isnan` in C++. */
1268static inline SIMD_CFUNC simd_int16 __tg_isnan(simd_float16 x);
1269/*! @abstract Do not call this function; instead use `isnan` in C and
1270 * Objective-C, and `simd::isnan` in C++. */
1271static inline SIMD_CFUNC simd_long2 __tg_isnan(simd_double2 x);
1272/*! @abstract Do not call this function; instead use `isnan` in C and
1273 * Objective-C, and `simd::isnan` in C++. */
1274static inline SIMD_CFUNC simd_long3 __tg_isnan(simd_double3 x);
1275/*! @abstract Do not call this function; instead use `isnan` in C and
1276 * Objective-C, and `simd::isnan` in C++. */
1277static inline SIMD_CFUNC simd_long4 __tg_isnan(simd_double4 x);
1278/*! @abstract Do not call this function; instead use `isnan` in C and
1279 * Objective-C, and `simd::isnan` in C++. */
1280static inline SIMD_CFUNC simd_long8 __tg_isnan(simd_double8 x);
1281
1282/*! @abstract Do not call this function; instead use `isnormal` in C and
1283 * Objective-C, and `simd::isnormal` in C++. */
1284static inline SIMD_CFUNC simd_short2 __tg_isnormal(simd_half2 x);
1285/*! @abstract Do not call this function; instead use `isnormal` in C and
1286 * Objective-C, and `simd::isnormal` in C++. */
1287static inline SIMD_CFUNC simd_short3 __tg_isnormal(simd_half3 x);
1288/*! @abstract Do not call this function; instead use `isnormal` in C and
1289 * Objective-C, and `simd::isnormal` in C++. */
1290static inline SIMD_CFUNC simd_short4 __tg_isnormal(simd_half4 x);
1291/*! @abstract Do not call this function; instead use `isnormal` in C and
1292 * Objective-C, and `simd::isnormal` in C++. */
1293static inline SIMD_CFUNC simd_short8 __tg_isnormal(simd_half8 x);
1294/*! @abstract Do not call this function; instead use `isnormal` in C and
1295 * Objective-C, and `simd::isnormal` in C++. */
1296static inline SIMD_CFUNC simd_short16 __tg_isnormal(simd_half16 x);
1297/*! @abstract Do not call this function; instead use `isnormal` in C and
1298 * Objective-C, and `simd::isnormal` in C++. */
1299static inline SIMD_CFUNC simd_short32 __tg_isnormal(simd_half32 x);
1300/*! @abstract Do not call this function; instead use `isnormal` in C and
1301 * Objective-C, and `simd::isnormal` in C++. */
1302static inline SIMD_CFUNC simd_int2 __tg_isnormal(simd_float2 x);
1303/*! @abstract Do not call this function; instead use `isnormal` in C and
1304 * Objective-C, and `simd::isnormal` in C++. */
1305static inline SIMD_CFUNC simd_int3 __tg_isnormal(simd_float3 x);
1306/*! @abstract Do not call this function; instead use `isnormal` in C and
1307 * Objective-C, and `simd::isnormal` in C++. */
1308static inline SIMD_CFUNC simd_int4 __tg_isnormal(simd_float4 x);
1309/*! @abstract Do not call this function; instead use `isnormal` in C and
1310 * Objective-C, and `simd::isnormal` in C++. */
1311static inline SIMD_CFUNC simd_int8 __tg_isnormal(simd_float8 x);
1312/*! @abstract Do not call this function; instead use `isnormal` in C and
1313 * Objective-C, and `simd::isnormal` in C++. */
1314static inline SIMD_CFUNC simd_int16 __tg_isnormal(simd_float16 x);
1315/*! @abstract Do not call this function; instead use `isnormal` in C and
1316 * Objective-C, and `simd::isnormal` in C++. */
1317static inline SIMD_CFUNC simd_long2 __tg_isnormal(simd_double2 x);
1318/*! @abstract Do not call this function; instead use `isnormal` in C and
1319 * Objective-C, and `simd::isnormal` in C++. */
1320static inline SIMD_CFUNC simd_long3 __tg_isnormal(simd_double3 x);
1321/*! @abstract Do not call this function; instead use `isnormal` in C and
1322 * Objective-C, and `simd::isnormal` in C++. */
1323static inline SIMD_CFUNC simd_long4 __tg_isnormal(simd_double4 x);
1324/*! @abstract Do not call this function; instead use `isnormal` in C and
1325 * Objective-C, and `simd::isnormal` in C++. */
1326static inline SIMD_CFUNC simd_long8 __tg_isnormal(simd_double8 x);
1327
1328/*! @abstract Do not call this function; instead use `fabs` in C and
1329 * Objective-C, and `simd::fabs` in C++. */
1330static inline SIMD_CFUNC simd_half2 __tg_fabs(simd_half2 x);
1331/*! @abstract Do not call this function; instead use `fabs` in C and
1332 * Objective-C, and `simd::fabs` in C++. */
1333static inline SIMD_CFUNC simd_half3 __tg_fabs(simd_half3 x);
1334/*! @abstract Do not call this function; instead use `fabs` in C and
1335 * Objective-C, and `simd::fabs` in C++. */
1336static inline SIMD_CFUNC simd_half4 __tg_fabs(simd_half4 x);
1337/*! @abstract Do not call this function; instead use `fabs` in C and
1338 * Objective-C, and `simd::fabs` in C++. */
1339static inline SIMD_CFUNC simd_half8 __tg_fabs(simd_half8 x);
1340/*! @abstract Do not call this function; instead use `fabs` in C and
1341 * Objective-C, and `simd::fabs` in C++. */
1342static inline SIMD_CFUNC simd_half16 __tg_fabs(simd_half16 x);
1343/*! @abstract Do not call this function; instead use `fabs` in C and
1344 * Objective-C, and `simd::fabs` in C++. */
1345static inline SIMD_CFUNC simd_half32 __tg_fabs(simd_half32 x);
1346
1347/*! @abstract Do not call this function; instead use `sqrt` in C and
1348 * Objective-C, and `simd::sqrt` in C++. */
1349static inline SIMD_CFUNC simd_half2 __tg_sqrt(simd_half2 x);
1350/*! @abstract Do not call this function; instead use `sqrt` in C and
1351 * Objective-C, and `simd::sqrt` in C++. */
1352static inline SIMD_CFUNC simd_half3 __tg_sqrt(simd_half3 x);
1353/*! @abstract Do not call this function; instead use `sqrt` in C and
1354 * Objective-C, and `simd::sqrt` in C++. */
1355static inline SIMD_CFUNC simd_half4 __tg_sqrt(simd_half4 x);
1356/*! @abstract Do not call this function; instead use `sqrt` in C and
1357 * Objective-C, and `simd::sqrt` in C++. */
1358static inline SIMD_CFUNC simd_half8 __tg_sqrt(simd_half8 x);
1359/*! @abstract Do not call this function; instead use `sqrt` in C and
1360 * Objective-C, and `simd::sqrt` in C++. */
1361static inline SIMD_CFUNC simd_half16 __tg_sqrt(simd_half16 x);
1362/*! @abstract Do not call this function; instead use `sqrt` in C and
1363 * Objective-C, and `simd::sqrt` in C++. */
1364static inline SIMD_CFUNC simd_half32 __tg_sqrt(simd_half32 x);
1365
1366/*! @abstract Do not call this function; instead use `ceil` in C and
1367 * Objective-C, and `simd::ceil` in C++. */
1368static inline SIMD_CFUNC simd_half2 __tg_ceil(simd_half2 x);
1369/*! @abstract Do not call this function; instead use `ceil` in C and
1370 * Objective-C, and `simd::ceil` in C++. */
1371static inline SIMD_CFUNC simd_half3 __tg_ceil(simd_half3 x);
1372/*! @abstract Do not call this function; instead use `ceil` in C and
1373 * Objective-C, and `simd::ceil` in C++. */
1374static inline SIMD_CFUNC simd_half4 __tg_ceil(simd_half4 x);
1375/*! @abstract Do not call this function; instead use `ceil` in C and
1376 * Objective-C, and `simd::ceil` in C++. */
1377static inline SIMD_CFUNC simd_half8 __tg_ceil(simd_half8 x);
1378/*! @abstract Do not call this function; instead use `ceil` in C and
1379 * Objective-C, and `simd::ceil` in C++. */
1380static inline SIMD_CFUNC simd_half16 __tg_ceil(simd_half16 x);
1381/*! @abstract Do not call this function; instead use `ceil` in C and
1382 * Objective-C, and `simd::ceil` in C++. */
1383static inline SIMD_CFUNC simd_half32 __tg_ceil(simd_half32 x);
1384
1385/*! @abstract Do not call this function; instead use `floor` in C and
1386 * Objective-C, and `simd::floor` in C++. */
1387static inline SIMD_CFUNC simd_half2 __tg_floor(simd_half2 x);
1388/*! @abstract Do not call this function; instead use `floor` in C and
1389 * Objective-C, and `simd::floor` in C++. */
1390static inline SIMD_CFUNC simd_half3 __tg_floor(simd_half3 x);
1391/*! @abstract Do not call this function; instead use `floor` in C and
1392 * Objective-C, and `simd::floor` in C++. */
1393static inline SIMD_CFUNC simd_half4 __tg_floor(simd_half4 x);
1394/*! @abstract Do not call this function; instead use `floor` in C and
1395 * Objective-C, and `simd::floor` in C++. */
1396static inline SIMD_CFUNC simd_half8 __tg_floor(simd_half8 x);
1397/*! @abstract Do not call this function; instead use `floor` in C and
1398 * Objective-C, and `simd::floor` in C++. */
1399static inline SIMD_CFUNC simd_half16 __tg_floor(simd_half16 x);
1400/*! @abstract Do not call this function; instead use `floor` in C and
1401 * Objective-C, and `simd::floor` in C++. */
1402static inline SIMD_CFUNC simd_half32 __tg_floor(simd_half32 x);
1403
1404/*! @abstract Do not call this function; instead use `rint` in C and
1405 * Objective-C, and `simd::rint` in C++. */
1406static inline SIMD_CFUNC simd_half2 __tg_rint(simd_half2 x);
1407/*! @abstract Do not call this function; instead use `rint` in C and
1408 * Objective-C, and `simd::rint` in C++. */
1409static inline SIMD_CFUNC simd_half3 __tg_rint(simd_half3 x);
1410/*! @abstract Do not call this function; instead use `rint` in C and
1411 * Objective-C, and `simd::rint` in C++. */
1412static inline SIMD_CFUNC simd_half4 __tg_rint(simd_half4 x);
1413/*! @abstract Do not call this function; instead use `rint` in C and
1414 * Objective-C, and `simd::rint` in C++. */
1415static inline SIMD_CFUNC simd_half8 __tg_rint(simd_half8 x);
1416/*! @abstract Do not call this function; instead use `rint` in C and
1417 * Objective-C, and `simd::rint` in C++. */
1418static inline SIMD_CFUNC simd_half16 __tg_rint(simd_half16 x);
1419/*! @abstract Do not call this function; instead use `rint` in C and
1420 * Objective-C, and `simd::rint` in C++. */
1421static inline SIMD_CFUNC simd_half32 __tg_rint(simd_half32 x);
1422
1423/*! @abstract Do not call this function; instead use `trunc` in C and
1424 * Objective-C, and `simd::trunc` in C++. */
1425static inline SIMD_CFUNC simd_half2 __tg_trunc(simd_half2 x);
1426/*! @abstract Do not call this function; instead use `trunc` in C and
1427 * Objective-C, and `simd::trunc` in C++. */
1428static inline SIMD_CFUNC simd_half3 __tg_trunc(simd_half3 x);
1429/*! @abstract Do not call this function; instead use `trunc` in C and
1430 * Objective-C, and `simd::trunc` in C++. */
1431static inline SIMD_CFUNC simd_half4 __tg_trunc(simd_half4 x);
1432/*! @abstract Do not call this function; instead use `trunc` in C and
1433 * Objective-C, and `simd::trunc` in C++. */
1434static inline SIMD_CFUNC simd_half8 __tg_trunc(simd_half8 x);
1435/*! @abstract Do not call this function; instead use `trunc` in C and
1436 * Objective-C, and `simd::trunc` in C++. */
1437static inline SIMD_CFUNC simd_half16 __tg_trunc(simd_half16 x);
1438/*! @abstract Do not call this function; instead use `trunc` in C and
1439 * Objective-C, and `simd::trunc` in C++. */
1440static inline SIMD_CFUNC simd_half32 __tg_trunc(simd_half32 x);
1441
1442
1443/*! @abstract Do not call this function; instead use `atan2` in C and
1444 * Objective-C, and `simd::atan2` in C++. */
1445static inline SIMD_CFUNC simd_float2 __tg_atan2(simd_float2 y, simd_float2 x);
1446/*! @abstract Do not call this function; instead use `atan2` in C and
1447 * Objective-C, and `simd::atan2` in C++. */
1448static inline SIMD_CFUNC simd_float3 __tg_atan2(simd_float3 y, simd_float3 x);
1449/*! @abstract Do not call this function; instead use `atan2` in C and
1450 * Objective-C, and `simd::atan2` in C++. */
1451static inline SIMD_CFUNC simd_float4 __tg_atan2(simd_float4 y, simd_float4 x);
1452/*! @abstract Do not call this function; instead use `atan2` in C and
1453 * Objective-C, and `simd::atan2` in C++. */
1454static inline SIMD_CFUNC simd_float8 __tg_atan2(simd_float8 y, simd_float8 x);
1455/*! @abstract Do not call this function; instead use `atan2` in C and
1456 * Objective-C, and `simd::atan2` in C++. */
1457static inline SIMD_CFUNC simd_float16 __tg_atan2(simd_float16 y, simd_float16 x);
1458/*! @abstract Do not call this function; instead use `atan2` in C and
1459 * Objective-C, and `simd::atan2` in C++. */
1460static inline SIMD_CFUNC simd_double2 __tg_atan2(simd_double2 y, simd_double2 x);
1461/*! @abstract Do not call this function; instead use `atan2` in C and
1462 * Objective-C, and `simd::atan2` in C++. */
1463static inline SIMD_CFUNC simd_double3 __tg_atan2(simd_double3 y, simd_double3 x);
1464/*! @abstract Do not call this function; instead use `atan2` in C and
1465 * Objective-C, and `simd::atan2` in C++. */
1466static inline SIMD_CFUNC simd_double4 __tg_atan2(simd_double4 y, simd_double4 x);
1467/*! @abstract Do not call this function; instead use `atan2` in C and
1468 * Objective-C, and `simd::atan2` in C++. */
1469static inline SIMD_CFUNC simd_double8 __tg_atan2(simd_double8 y, simd_double8 x);
1470
1471/*! @abstract Do not call this function; instead use `hypot` in C and
1472 * Objective-C, and `simd::hypot` in C++. */
1473static inline SIMD_CFUNC simd_float2 __tg_hypot(simd_float2 x, simd_float2 y);
1474/*! @abstract Do not call this function; instead use `hypot` in C and
1475 * Objective-C, and `simd::hypot` in C++. */
1476static inline SIMD_CFUNC simd_float3 __tg_hypot(simd_float3 x, simd_float3 y);
1477/*! @abstract Do not call this function; instead use `hypot` in C and
1478 * Objective-C, and `simd::hypot` in C++. */
1479static inline SIMD_CFUNC simd_float4 __tg_hypot(simd_float4 x, simd_float4 y);
1480/*! @abstract Do not call this function; instead use `hypot` in C and
1481 * Objective-C, and `simd::hypot` in C++. */
1482static inline SIMD_CFUNC simd_float8 __tg_hypot(simd_float8 x, simd_float8 y);
1483/*! @abstract Do not call this function; instead use `hypot` in C and
1484 * Objective-C, and `simd::hypot` in C++. */
1485static inline SIMD_CFUNC simd_float16 __tg_hypot(simd_float16 x, simd_float16 y);
1486/*! @abstract Do not call this function; instead use `hypot` in C and
1487 * Objective-C, and `simd::hypot` in C++. */
1488static inline SIMD_CFUNC simd_double2 __tg_hypot(simd_double2 x, simd_double2 y);
1489/*! @abstract Do not call this function; instead use `hypot` in C and
1490 * Objective-C, and `simd::hypot` in C++. */
1491static inline SIMD_CFUNC simd_double3 __tg_hypot(simd_double3 x, simd_double3 y);
1492/*! @abstract Do not call this function; instead use `hypot` in C and
1493 * Objective-C, and `simd::hypot` in C++. */
1494static inline SIMD_CFUNC simd_double4 __tg_hypot(simd_double4 x, simd_double4 y);
1495/*! @abstract Do not call this function; instead use `hypot` in C and
1496 * Objective-C, and `simd::hypot` in C++. */
1497static inline SIMD_CFUNC simd_double8 __tg_hypot(simd_double8 x, simd_double8 y);
1498
1499/*! @abstract Do not call this function; instead use `pow` in C and
1500 * Objective-C, and `simd::pow` in C++. */
1501static inline SIMD_CFUNC simd_float2 __tg_pow(simd_float2 x, simd_float2 y);
1502/*! @abstract Do not call this function; instead use `pow` in C and
1503 * Objective-C, and `simd::pow` in C++. */
1504static inline SIMD_CFUNC simd_float3 __tg_pow(simd_float3 x, simd_float3 y);
1505/*! @abstract Do not call this function; instead use `pow` in C and
1506 * Objective-C, and `simd::pow` in C++. */
1507static inline SIMD_CFUNC simd_float4 __tg_pow(simd_float4 x, simd_float4 y);
1508/*! @abstract Do not call this function; instead use `pow` in C and
1509 * Objective-C, and `simd::pow` in C++. */
1510static inline SIMD_CFUNC simd_float8 __tg_pow(simd_float8 x, simd_float8 y);
1511/*! @abstract Do not call this function; instead use `pow` in C and
1512 * Objective-C, and `simd::pow` in C++. */
1513static inline SIMD_CFUNC simd_float16 __tg_pow(simd_float16 x, simd_float16 y);
1514/*! @abstract Do not call this function; instead use `pow` in C and
1515 * Objective-C, and `simd::pow` in C++. */
1516static inline SIMD_CFUNC simd_double2 __tg_pow(simd_double2 x, simd_double2 y);
1517/*! @abstract Do not call this function; instead use `pow` in C and
1518 * Objective-C, and `simd::pow` in C++. */
1519static inline SIMD_CFUNC simd_double3 __tg_pow(simd_double3 x, simd_double3 y);
1520/*! @abstract Do not call this function; instead use `pow` in C and
1521 * Objective-C, and `simd::pow` in C++. */
1522static inline SIMD_CFUNC simd_double4 __tg_pow(simd_double4 x, simd_double4 y);
1523/*! @abstract Do not call this function; instead use `pow` in C and
1524 * Objective-C, and `simd::pow` in C++. */
1525static inline SIMD_CFUNC simd_double8 __tg_pow(simd_double8 x, simd_double8 y);
1526
1527/*! @abstract Do not call this function; instead use `fmod` in C and
1528 * Objective-C, and `simd::fmod` in C++. */
1529static inline SIMD_CFUNC simd_float2 __tg_fmod(simd_float2 x, simd_float2 y);
1530/*! @abstract Do not call this function; instead use `fmod` in C and
1531 * Objective-C, and `simd::fmod` in C++. */
1532static inline SIMD_CFUNC simd_float3 __tg_fmod(simd_float3 x, simd_float3 y);
1533/*! @abstract Do not call this function; instead use `fmod` in C and
1534 * Objective-C, and `simd::fmod` in C++. */
1535static inline SIMD_CFUNC simd_float4 __tg_fmod(simd_float4 x, simd_float4 y);
1536/*! @abstract Do not call this function; instead use `fmod` in C and
1537 * Objective-C, and `simd::fmod` in C++. */
1538static inline SIMD_CFUNC simd_float8 __tg_fmod(simd_float8 x, simd_float8 y);
1539/*! @abstract Do not call this function; instead use `fmod` in C and
1540 * Objective-C, and `simd::fmod` in C++. */
1541static inline SIMD_CFUNC simd_float16 __tg_fmod(simd_float16 x, simd_float16 y);
1542/*! @abstract Do not call this function; instead use `fmod` in C and
1543 * Objective-C, and `simd::fmod` in C++. */
1544static inline SIMD_CFUNC simd_double2 __tg_fmod(simd_double2 x, simd_double2 y);
1545/*! @abstract Do not call this function; instead use `fmod` in C and
1546 * Objective-C, and `simd::fmod` in C++. */
1547static inline SIMD_CFUNC simd_double3 __tg_fmod(simd_double3 x, simd_double3 y);
1548/*! @abstract Do not call this function; instead use `fmod` in C and
1549 * Objective-C, and `simd::fmod` in C++. */
1550static inline SIMD_CFUNC simd_double4 __tg_fmod(simd_double4 x, simd_double4 y);
1551/*! @abstract Do not call this function; instead use `fmod` in C and
1552 * Objective-C, and `simd::fmod` in C++. */
1553static inline SIMD_CFUNC simd_double8 __tg_fmod(simd_double8 x, simd_double8 y);
1554
1555/*! @abstract Do not call this function; instead use `remainder` in C and
1556 * Objective-C, and `simd::remainder` in C++. */
1557static inline SIMD_CFUNC simd_float2 __tg_remainder(simd_float2 x, simd_float2 y);
1558/*! @abstract Do not call this function; instead use `remainder` in C and
1559 * Objective-C, and `simd::remainder` in C++. */
1560static inline SIMD_CFUNC simd_float3 __tg_remainder(simd_float3 x, simd_float3 y);
1561/*! @abstract Do not call this function; instead use `remainder` in C and
1562 * Objective-C, and `simd::remainder` in C++. */
1563static inline SIMD_CFUNC simd_float4 __tg_remainder(simd_float4 x, simd_float4 y);
1564/*! @abstract Do not call this function; instead use `remainder` in C and
1565 * Objective-C, and `simd::remainder` in C++. */
1566static inline SIMD_CFUNC simd_float8 __tg_remainder(simd_float8 x, simd_float8 y);
1567/*! @abstract Do not call this function; instead use `remainder` in C and
1568 * Objective-C, and `simd::remainder` in C++. */
1569static inline SIMD_CFUNC simd_float16 __tg_remainder(simd_float16 x, simd_float16 y);
1570/*! @abstract Do not call this function; instead use `remainder` in C and
1571 * Objective-C, and `simd::remainder` in C++. */
1572static inline SIMD_CFUNC simd_double2 __tg_remainder(simd_double2 x, simd_double2 y);
1573/*! @abstract Do not call this function; instead use `remainder` in C and
1574 * Objective-C, and `simd::remainder` in C++. */
1575static inline SIMD_CFUNC simd_double3 __tg_remainder(simd_double3 x, simd_double3 y);
1576/*! @abstract Do not call this function; instead use `remainder` in C and
1577 * Objective-C, and `simd::remainder` in C++. */
1578static inline SIMD_CFUNC simd_double4 __tg_remainder(simd_double4 x, simd_double4 y);
1579/*! @abstract Do not call this function; instead use `remainder` in C and
1580 * Objective-C, and `simd::remainder` in C++. */
1581static inline SIMD_CFUNC simd_double8 __tg_remainder(simd_double8 x, simd_double8 y);
1582
1583/*! @abstract Do not call this function; instead use `copysign` in C and
1584 * Objective-C, and `simd::copysign` in C++. */
1585static inline SIMD_CFUNC simd_float2 __tg_copysign(simd_float2 x, simd_float2 y);
1586/*! @abstract Do not call this function; instead use `copysign` in C and
1587 * Objective-C, and `simd::copysign` in C++. */
1588static inline SIMD_CFUNC simd_float3 __tg_copysign(simd_float3 x, simd_float3 y);
1589/*! @abstract Do not call this function; instead use `copysign` in C and
1590 * Objective-C, and `simd::copysign` in C++. */
1591static inline SIMD_CFUNC simd_float4 __tg_copysign(simd_float4 x, simd_float4 y);
1592/*! @abstract Do not call this function; instead use `copysign` in C and
1593 * Objective-C, and `simd::copysign` in C++. */
1594static inline SIMD_CFUNC simd_float8 __tg_copysign(simd_float8 x, simd_float8 y);
1595/*! @abstract Do not call this function; instead use `copysign` in C and
1596 * Objective-C, and `simd::copysign` in C++. */
1597static inline SIMD_CFUNC simd_float16 __tg_copysign(simd_float16 x, simd_float16 y);
1598/*! @abstract Do not call this function; instead use `copysign` in C and
1599 * Objective-C, and `simd::copysign` in C++. */
1600static inline SIMD_CFUNC simd_double2 __tg_copysign(simd_double2 x, simd_double2 y);
1601/*! @abstract Do not call this function; instead use `copysign` in C and
1602 * Objective-C, and `simd::copysign` in C++. */
1603static inline SIMD_CFUNC simd_double3 __tg_copysign(simd_double3 x, simd_double3 y);
1604/*! @abstract Do not call this function; instead use `copysign` in C and
1605 * Objective-C, and `simd::copysign` in C++. */
1606static inline SIMD_CFUNC simd_double4 __tg_copysign(simd_double4 x, simd_double4 y);
1607/*! @abstract Do not call this function; instead use `copysign` in C and
1608 * Objective-C, and `simd::copysign` in C++. */
1609static inline SIMD_CFUNC simd_double8 __tg_copysign(simd_double8 x, simd_double8 y);
1610
1611/*! @abstract Do not call this function; instead use `nextafter` in C and
1612 * Objective-C, and `simd::nextafter` in C++. */
1613static inline SIMD_CFUNC simd_float2 __tg_nextafter(simd_float2 x, simd_float2 y);
1614/*! @abstract Do not call this function; instead use `nextafter` in C and
1615 * Objective-C, and `simd::nextafter` in C++. */
1616static inline SIMD_CFUNC simd_float3 __tg_nextafter(simd_float3 x, simd_float3 y);
1617/*! @abstract Do not call this function; instead use `nextafter` in C and
1618 * Objective-C, and `simd::nextafter` in C++. */
1619static inline SIMD_CFUNC simd_float4 __tg_nextafter(simd_float4 x, simd_float4 y);
1620/*! @abstract Do not call this function; instead use `nextafter` in C and
1621 * Objective-C, and `simd::nextafter` in C++. */
1622static inline SIMD_CFUNC simd_float8 __tg_nextafter(simd_float8 x, simd_float8 y);
1623/*! @abstract Do not call this function; instead use `nextafter` in C and
1624 * Objective-C, and `simd::nextafter` in C++. */
1625static inline SIMD_CFUNC simd_float16 __tg_nextafter(simd_float16 x, simd_float16 y);
1626/*! @abstract Do not call this function; instead use `nextafter` in C and
1627 * Objective-C, and `simd::nextafter` in C++. */
1628static inline SIMD_CFUNC simd_double2 __tg_nextafter(simd_double2 x, simd_double2 y);
1629/*! @abstract Do not call this function; instead use `nextafter` in C and
1630 * Objective-C, and `simd::nextafter` in C++. */
1631static inline SIMD_CFUNC simd_double3 __tg_nextafter(simd_double3 x, simd_double3 y);
1632/*! @abstract Do not call this function; instead use `nextafter` in C and
1633 * Objective-C, and `simd::nextafter` in C++. */
1634static inline SIMD_CFUNC simd_double4 __tg_nextafter(simd_double4 x, simd_double4 y);
1635/*! @abstract Do not call this function; instead use `nextafter` in C and
1636 * Objective-C, and `simd::nextafter` in C++. */
1637static inline SIMD_CFUNC simd_double8 __tg_nextafter(simd_double8 x, simd_double8 y);
1638
1639/*! @abstract Do not call this function; instead use `fdim` in C and
1640 * Objective-C, and `simd::fdim` in C++. */
1641static inline SIMD_CFUNC simd_float2 __tg_fdim(simd_float2 x, simd_float2 y);
1642/*! @abstract Do not call this function; instead use `fdim` in C and
1643 * Objective-C, and `simd::fdim` in C++. */
1644static inline SIMD_CFUNC simd_float3 __tg_fdim(simd_float3 x, simd_float3 y);
1645/*! @abstract Do not call this function; instead use `fdim` in C and
1646 * Objective-C, and `simd::fdim` in C++. */
1647static inline SIMD_CFUNC simd_float4 __tg_fdim(simd_float4 x, simd_float4 y);
1648/*! @abstract Do not call this function; instead use `fdim` in C and
1649 * Objective-C, and `simd::fdim` in C++. */
1650static inline SIMD_CFUNC simd_float8 __tg_fdim(simd_float8 x, simd_float8 y);
1651/*! @abstract Do not call this function; instead use `fdim` in C and
1652 * Objective-C, and `simd::fdim` in C++. */
1653static inline SIMD_CFUNC simd_float16 __tg_fdim(simd_float16 x, simd_float16 y);
1654/*! @abstract Do not call this function; instead use `fdim` in C and
1655 * Objective-C, and `simd::fdim` in C++. */
1656static inline SIMD_CFUNC simd_double2 __tg_fdim(simd_double2 x, simd_double2 y);
1657/*! @abstract Do not call this function; instead use `fdim` in C and
1658 * Objective-C, and `simd::fdim` in C++. */
1659static inline SIMD_CFUNC simd_double3 __tg_fdim(simd_double3 x, simd_double3 y);
1660/*! @abstract Do not call this function; instead use `fdim` in C and
1661 * Objective-C, and `simd::fdim` in C++. */
1662static inline SIMD_CFUNC simd_double4 __tg_fdim(simd_double4 x, simd_double4 y);
1663/*! @abstract Do not call this function; instead use `fdim` in C and
1664 * Objective-C, and `simd::fdim` in C++. */
1665static inline SIMD_CFUNC simd_double8 __tg_fdim(simd_double8 x, simd_double8 y);
1666
1667/*! @abstract Do not call this function; instead use `fmax` in C and
1668 * Objective-C, and `simd::fmax` in C++. */
1669static inline SIMD_CFUNC simd_float2 __tg_fmax(simd_float2 x, simd_float2 y);
1670/*! @abstract Do not call this function; instead use `fmax` in C and
1671 * Objective-C, and `simd::fmax` in C++. */
1672static inline SIMD_CFUNC simd_float3 __tg_fmax(simd_float3 x, simd_float3 y);
1673/*! @abstract Do not call this function; instead use `fmax` in C and
1674 * Objective-C, and `simd::fmax` in C++. */
1675static inline SIMD_CFUNC simd_float4 __tg_fmax(simd_float4 x, simd_float4 y);
1676/*! @abstract Do not call this function; instead use `fmax` in C and
1677 * Objective-C, and `simd::fmax` in C++. */
1678static inline SIMD_CFUNC simd_float8 __tg_fmax(simd_float8 x, simd_float8 y);
1679/*! @abstract Do not call this function; instead use `fmax` in C and
1680 * Objective-C, and `simd::fmax` in C++. */
1681static inline SIMD_CFUNC simd_float16 __tg_fmax(simd_float16 x, simd_float16 y);
1682/*! @abstract Do not call this function; instead use `fmax` in C and
1683 * Objective-C, and `simd::fmax` in C++. */
1684static inline SIMD_CFUNC simd_double2 __tg_fmax(simd_double2 x, simd_double2 y);
1685/*! @abstract Do not call this function; instead use `fmax` in C and
1686 * Objective-C, and `simd::fmax` in C++. */
1687static inline SIMD_CFUNC simd_double3 __tg_fmax(simd_double3 x, simd_double3 y);
1688/*! @abstract Do not call this function; instead use `fmax` in C and
1689 * Objective-C, and `simd::fmax` in C++. */
1690static inline SIMD_CFUNC simd_double4 __tg_fmax(simd_double4 x, simd_double4 y);
1691/*! @abstract Do not call this function; instead use `fmax` in C and
1692 * Objective-C, and `simd::fmax` in C++. */
1693static inline SIMD_CFUNC simd_double8 __tg_fmax(simd_double8 x, simd_double8 y);
1694
1695/*! @abstract Do not call this function; instead use `fmin` in C and
1696 * Objective-C, and `simd::fmin` in C++. */
1697static inline SIMD_CFUNC simd_float2 __tg_fmin(simd_float2 x, simd_float2 y);
1698/*! @abstract Do not call this function; instead use `fmin` in C and
1699 * Objective-C, and `simd::fmin` in C++. */
1700static inline SIMD_CFUNC simd_float3 __tg_fmin(simd_float3 x, simd_float3 y);
1701/*! @abstract Do not call this function; instead use `fmin` in C and
1702 * Objective-C, and `simd::fmin` in C++. */
1703static inline SIMD_CFUNC simd_float4 __tg_fmin(simd_float4 x, simd_float4 y);
1704/*! @abstract Do not call this function; instead use `fmin` in C and
1705 * Objective-C, and `simd::fmin` in C++. */
1706static inline SIMD_CFUNC simd_float8 __tg_fmin(simd_float8 x, simd_float8 y);
1707/*! @abstract Do not call this function; instead use `fmin` in C and
1708 * Objective-C, and `simd::fmin` in C++. */
1709static inline SIMD_CFUNC simd_float16 __tg_fmin(simd_float16 x, simd_float16 y);
1710/*! @abstract Do not call this function; instead use `fmin` in C and
1711 * Objective-C, and `simd::fmin` in C++. */
1712static inline SIMD_CFUNC simd_double2 __tg_fmin(simd_double2 x, simd_double2 y);
1713/*! @abstract Do not call this function; instead use `fmin` in C and
1714 * Objective-C, and `simd::fmin` in C++. */
1715static inline SIMD_CFUNC simd_double3 __tg_fmin(simd_double3 x, simd_double3 y);
1716/*! @abstract Do not call this function; instead use `fmin` in C and
1717 * Objective-C, and `simd::fmin` in C++. */
1718static inline SIMD_CFUNC simd_double4 __tg_fmin(simd_double4 x, simd_double4 y);
1719/*! @abstract Do not call this function; instead use `fmin` in C and
1720 * Objective-C, and `simd::fmin` in C++. */
1721static inline SIMD_CFUNC simd_double8 __tg_fmin(simd_double8 x, simd_double8 y);
1722
1723/*! @abstract Do not call this function; instead use `fmin` in C and
1724 * Objective-C, and `simd::fmin` in C++. */
1725static inline SIMD_CFUNC simd_half2 __tg_fmin(simd_half2 x, simd_half2 y);
1726/*! @abstract Do not call this function; instead use `fmin` in C and
1727 * Objective-C, and `simd::fmin` in C++. */
1728static inline SIMD_CFUNC simd_half3 __tg_fmin(simd_half3 x, simd_half3 y);
1729/*! @abstract Do not call this function; instead use `fmin` in C and
1730 * Objective-C, and `simd::fmin` in C++. */
1731static inline SIMD_CFUNC simd_half4 __tg_fmin(simd_half4 x, simd_half4 y);
1732/*! @abstract Do not call this function; instead use `fmin` in C and
1733 * Objective-C, and `simd::fmin` in C++. */
1734static inline SIMD_CFUNC simd_half8 __tg_fmin(simd_half8 x, simd_half8 y);
1735/*! @abstract Do not call this function; instead use `fmin` in C and
1736 * Objective-C, and `simd::fmin` in C++. */
1737static inline SIMD_CFUNC simd_half16 __tg_fmin(simd_half16 x, simd_half16 y);
1738/*! @abstract Do not call this function; instead use `fmin` in C and
1739 * Objective-C, and `simd::fmin` in C++. */
1740static inline SIMD_CFUNC simd_half32 __tg_fmin(simd_half32 x, simd_half32 y);
1741
1742/*! @abstract Do not call this function; instead use `fmax` in C and
1743 * Objective-C, and `simd::fmax` in C++. */
1744static inline SIMD_CFUNC simd_half2 __tg_fmax(simd_half2 x, simd_half2 y);
1745/*! @abstract Do not call this function; instead use `fmax` in C and
1746 * Objective-C, and `simd::fmax` in C++. */
1747static inline SIMD_CFUNC simd_half3 __tg_fmax(simd_half3 x, simd_half3 y);
1748/*! @abstract Do not call this function; instead use `fmax` in C and
1749 * Objective-C, and `simd::fmax` in C++. */
1750static inline SIMD_CFUNC simd_half4 __tg_fmax(simd_half4 x, simd_half4 y);
1751/*! @abstract Do not call this function; instead use `fmax` in C and
1752 * Objective-C, and `simd::fmax` in C++. */
1753static inline SIMD_CFUNC simd_half8 __tg_fmax(simd_half8 x, simd_half8 y);
1754/*! @abstract Do not call this function; instead use `fmax` in C and
1755 * Objective-C, and `simd::fmax` in C++. */
1756static inline SIMD_CFUNC simd_half16 __tg_fmax(simd_half16 x, simd_half16 y);
1757/*! @abstract Do not call this function; instead use `fmax` in C and
1758 * Objective-C, and `simd::fmax` in C++. */
1759static inline SIMD_CFUNC simd_half32 __tg_fmax(simd_half32 x, simd_half32 y);
1760
1761/*! @abstract Do not call this function; instead use `copysign` in C and
1762 * Objective-C, and `simd::copysign` in C++. */
1763static inline SIMD_CFUNC simd_half2 __tg_copysign(simd_half2 x, simd_half2 y);
1764/*! @abstract Do not call this function; instead use `copysign` in C and
1765 * Objective-C, and `simd::copysign` in C++. */
1766static inline SIMD_CFUNC simd_half3 __tg_copysign(simd_half3 x, simd_half3 y);
1767/*! @abstract Do not call this function; instead use `copysign` in C and
1768 * Objective-C, and `simd::copysign` in C++. */
1769static inline SIMD_CFUNC simd_half4 __tg_copysign(simd_half4 x, simd_half4 y);
1770/*! @abstract Do not call this function; instead use `copysign` in C and
1771 * Objective-C, and `simd::copysign` in C++. */
1772static inline SIMD_CFUNC simd_half8 __tg_copysign(simd_half8 x, simd_half8 y);
1773/*! @abstract Do not call this function; instead use `copysign` in C and
1774 * Objective-C, and `simd::copysign` in C++. */
1775static inline SIMD_CFUNC simd_half16 __tg_copysign(simd_half16 x, simd_half16 y);
1776/*! @abstract Do not call this function; instead use `copysign` in C and
1777 * Objective-C, and `simd::copysign` in C++. */
1778static inline SIMD_CFUNC simd_half32 __tg_copysign(simd_half32 x, simd_half32 y);
1779
1780
1781/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1782 * and `simd::fma` in C++. */
1783static inline SIMD_CFUNC simd_float2 __tg_fma(simd_float2 x, simd_float2 y, simd_float2 z);
1784/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1785 * and `simd::fma` in C++. */
1786static inline SIMD_CFUNC simd_float3 __tg_fma(simd_float3 x, simd_float3 y, simd_float3 z);
1787/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1788 * and `simd::fma` in C++. */
1789static inline SIMD_CFUNC simd_float4 __tg_fma(simd_float4 x, simd_float4 y, simd_float4 z);
1790/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1791 * and `simd::fma` in C++. */
1792static inline SIMD_CFUNC simd_float8 __tg_fma(simd_float8 x, simd_float8 y, simd_float8 z);
1793/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1794 * and `simd::fma` in C++. */
1795static inline SIMD_CFUNC simd_float16 __tg_fma(simd_float16 x, simd_float16 y, simd_float16 z);
1796/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1797 * and `simd::fma` in C++. */
1798static inline SIMD_CFUNC simd_double2 __tg_fma(simd_double2 x, simd_double2 y, simd_double2 z);
1799/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1800 * and `simd::fma` in C++. */
1801static inline SIMD_CFUNC simd_double3 __tg_fma(simd_double3 x, simd_double3 y, simd_double3 z);
1802/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1803 * and `simd::fma` in C++. */
1804static inline SIMD_CFUNC simd_double4 __tg_fma(simd_double4 x, simd_double4 y, simd_double4 z);
1805/*! @abstract Do not call this function; instead use `fma` in C and Objective-C,
1806 * and `simd::fma` in C++. */
1807static inline SIMD_CFUNC simd_double8 __tg_fma(simd_double8 x, simd_double8 y, simd_double8 z);
1808
1809/*! @abstract Computes accum + x*y by the most efficient means available;
1810 * either a fused multiply add or separate multiply and add instructions. */
1811static inline SIMD_CFUNC _Float16 simd_muladd(_Float16 x, _Float16 y, _Float16 z);
1812/*! @abstract Computes accum + x*y by the most efficient means available;
1813 * either a fused multiply add or separate multiply and add instructions. */
1814static inline SIMD_CFUNC simd_half2 simd_muladd(simd_half2 x, simd_half2 y, simd_half2 z);
1815/*! @abstract Computes accum + x*y by the most efficient means available;
1816 * either a fused multiply add or separate multiply and add instructions. */
1817static inline SIMD_CFUNC simd_half3 simd_muladd(simd_half3 x, simd_half3 y, simd_half3 z);
1818/*! @abstract Computes accum + x*y by the most efficient means available;
1819 * either a fused multiply add or separate multiply and add instructions. */
1820static inline SIMD_CFUNC simd_half4 simd_muladd(simd_half4 x, simd_half4 y, simd_half4 z);
1821/*! @abstract Computes accum + x*y by the most efficient means available;
1822 * either a fused multiply add or separate multiply and add instructions. */
1823static inline SIMD_CFUNC simd_half8 simd_muladd(simd_half8 x, simd_half8 y, simd_half8 z);
1824/*! @abstract Computes accum + x*y by the most efficient means available;
1825 * either a fused multiply add or separate multiply and add instructions. */
1826static inline SIMD_CFUNC simd_half16 simd_muladd(simd_half16 x, simd_half16 y, simd_half16 z);
1827/*! @abstract Computes accum + x*y by the most efficient means available;
1828 * either a fused multiply add or separate multiply and add instructions. */
1829static inline SIMD_CFUNC simd_half32 simd_muladd(simd_half32 x, simd_half32 y, simd_half32 z);
1830/*! @abstract Computes accum + x*y by the most efficient means available;
1831 * either a fused multiply add or separate multiply and add instructions. */
1832static inline SIMD_CFUNC float simd_muladd(float x, float y, float z);
1833/*! @abstract Computes accum + x*y by the most efficient means available;
1834 * either a fused multiply add or separate multiply and add instructions. */
1835static inline SIMD_CFUNC simd_float2 simd_muladd(simd_float2 x, simd_float2 y, simd_float2 z);
1836/*! @abstract Computes accum + x*y by the most efficient means available;
1837 * either a fused multiply add or separate multiply and add instructions. */
1838static inline SIMD_CFUNC simd_float3 simd_muladd(simd_float3 x, simd_float3 y, simd_float3 z);
1839/*! @abstract Computes accum + x*y by the most efficient means available;
1840 * either a fused multiply add or separate multiply and add instructions. */
1841static inline SIMD_CFUNC simd_float4 simd_muladd(simd_float4 x, simd_float4 y, simd_float4 z);
1842/*! @abstract Computes accum + x*y by the most efficient means available;
1843 * either a fused multiply add or separate multiply and add instructions. */
1844static inline SIMD_CFUNC simd_float8 simd_muladd(simd_float8 x, simd_float8 y, simd_float8 z);
1845/*! @abstract Computes accum + x*y by the most efficient means available;
1846 * either a fused multiply add or separate multiply and add instructions. */
1847static inline SIMD_CFUNC simd_float16 simd_muladd(simd_float16 x, simd_float16 y, simd_float16 z);
1848/*! @abstract Computes accum + x*y by the most efficient means available;
1849 * either a fused multiply add or separate multiply and add instructions. */
1850static inline SIMD_CFUNC double simd_muladd(double x, double y, double z);
1851/*! @abstract Computes accum + x*y by the most efficient means available;
1852 * either a fused multiply add or separate multiply and add instructions. */
1853static inline SIMD_CFUNC simd_double2 simd_muladd(simd_double2 x, simd_double2 y, simd_double2 z);
1854/*! @abstract Computes accum + x*y by the most efficient means available;
1855 * either a fused multiply add or separate multiply and add instructions. */
1856static inline SIMD_CFUNC simd_double3 simd_muladd(simd_double3 x, simd_double3 y, simd_double3 z);
1857/*! @abstract Computes accum + x*y by the most efficient means available;
1858 * either a fused multiply add or separate multiply and add instructions. */
1859static inline SIMD_CFUNC simd_double4 simd_muladd(simd_double4 x, simd_double4 y, simd_double4 z);
1860/*! @abstract Computes accum + x*y by the most efficient means available;
1861 * either a fused multiply add or separate multiply and add instructions. */
1862static inline SIMD_CFUNC simd_double8 simd_muladd(simd_double8 x, simd_double8 y, simd_double8 z);
1863
1864#ifdef __cplusplus
1865} /* extern "C" */
1866
1867#include <cmath>
1868/*! @abstract Do not call this function directly; use simd::acos instead. */
1869static SIMD_CPPFUNC float __tg_acos(float x) { return ::acosf(x); }
1870/*! @abstract Do not call this function directly; use simd::acos instead. */
1871static SIMD_CPPFUNC double __tg_acos(double x) { return ::acos(x); }
1872/*! @abstract Do not call this function directly; use simd::asin instead. */
1873static SIMD_CPPFUNC float __tg_asin(float x) { return ::asinf(x); }
1874/*! @abstract Do not call this function directly; use simd::asin instead. */
1875static SIMD_CPPFUNC double __tg_asin(double x) { return ::asin(x); }
1876/*! @abstract Do not call this function directly; use simd::atan instead. */
1877static SIMD_CPPFUNC float __tg_atan(float x) { return ::atanf(x); }
1878/*! @abstract Do not call this function directly; use simd::atan instead. */
1879static SIMD_CPPFUNC double __tg_atan(double x) { return ::atan(x); }
1880/*! @abstract Do not call this function directly; use simd::cos instead. */
1881static SIMD_CPPFUNC float __tg_cos(float x) { return ::cosf(x); }
1882/*! @abstract Do not call this function directly; use simd::cos instead. */
1883static SIMD_CPPFUNC double __tg_cos(double x) { return ::cos(x); }
1884/*! @abstract Do not call this function directly; use simd::sin instead. */
1885static SIMD_CPPFUNC float __tg_sin(float x) { return ::sinf(x); }
1886/*! @abstract Do not call this function directly; use simd::sin instead. */
1887static SIMD_CPPFUNC double __tg_sin(double x) { return ::sin(x); }
1888/*! @abstract Do not call this function directly; use simd::tan instead. */
1889static SIMD_CPPFUNC float __tg_tan(float x) { return ::tanf(x); }
1890/*! @abstract Do not call this function directly; use simd::tan instead. */
1891static SIMD_CPPFUNC double __tg_tan(double x) { return ::tan(x); }
1892/*! @abstract Do not call this function directly; use simd::cospi instead. */
1893static SIMD_CPPFUNC float __tg_cospi(float x) { return ::__cospif(x); }
1894/*! @abstract Do not call this function directly; use simd::cospi instead. */
1895static SIMD_CPPFUNC double __tg_cospi(double x) { return ::__cospi(x); }
1896/*! @abstract Do not call this function directly; use simd::sinpi instead. */
1897static SIMD_CPPFUNC float __tg_sinpi(float x) { return ::__sinpif(x); }
1898/*! @abstract Do not call this function directly; use simd::sinpi instead. */
1899static SIMD_CPPFUNC double __tg_sinpi(double x) { return ::__sinpi(x); }
1900/*! @abstract Do not call this function directly; use simd::tanpi instead. */
1901static SIMD_CPPFUNC float __tg_tanpi(float x) { return ::__tanpif(x); }
1902/*! @abstract Do not call this function directly; use simd::tanpi instead. */
1903static SIMD_CPPFUNC double __tg_tanpi(double x) { return ::__tanpi(x); }
1904/*! @abstract Do not call this function directly; use simd::acosh instead. */
1905static SIMD_CPPFUNC float __tg_acosh(float x) { return ::acoshf(x); }
1906/*! @abstract Do not call this function directly; use simd::acosh instead. */
1907static SIMD_CPPFUNC double __tg_acosh(double x) { return ::acosh(x); }
1908/*! @abstract Do not call this function directly; use simd::asinh instead. */
1909static SIMD_CPPFUNC float __tg_asinh(float x) { return ::asinhf(x); }
1910/*! @abstract Do not call this function directly; use simd::asinh instead. */
1911static SIMD_CPPFUNC double __tg_asinh(double x) { return ::asinh(x); }
1912/*! @abstract Do not call this function directly; use simd::atanh instead. */
1913static SIMD_CPPFUNC float __tg_atanh(float x) { return ::atanhf(x); }
1914/*! @abstract Do not call this function directly; use simd::atanh instead. */
1915static SIMD_CPPFUNC double __tg_atanh(double x) { return ::atanh(x); }
1916/*! @abstract Do not call this function directly; use simd::cosh instead. */
1917static SIMD_CPPFUNC float __tg_cosh(float x) { return ::coshf(x); }
1918/*! @abstract Do not call this function directly; use simd::cosh instead. */
1919static SIMD_CPPFUNC double __tg_cosh(double x) { return ::cosh(x); }
1920/*! @abstract Do not call this function directly; use simd::sinh instead. */
1921static SIMD_CPPFUNC float __tg_sinh(float x) { return ::sinhf(x); }
1922/*! @abstract Do not call this function directly; use simd::sinh instead. */
1923static SIMD_CPPFUNC double __tg_sinh(double x) { return ::sinh(x); }
1924/*! @abstract Do not call this function directly; use simd::tanh instead. */
1925static SIMD_CPPFUNC float __tg_tanh(float x) { return ::tanhf(x); }
1926/*! @abstract Do not call this function directly; use simd::tanh instead. */
1927static SIMD_CPPFUNC double __tg_tanh(double x) { return ::tanh(x); }
1928/*! @abstract Do not call this function directly; use simd::exp instead. */
1929static SIMD_CPPFUNC float __tg_exp(float x) { return ::expf(x); }
1930/*! @abstract Do not call this function directly; use simd::exp instead. */
1931static SIMD_CPPFUNC double __tg_exp(double x) { return ::exp(x); }
1932/*! @abstract Do not call this function directly; use simd::exp2 instead. */
1933static SIMD_CPPFUNC float __tg_exp2(float x) { return ::exp2f(x); }
1934/*! @abstract Do not call this function directly; use simd::exp2 instead. */
1935static SIMD_CPPFUNC double __tg_exp2(double x) { return ::exp2(x); }
1936/*! @abstract Do not call this function directly; use simd::exp10 instead. */
1937static SIMD_CPPFUNC float __tg_exp10(float x) { return ::__exp10f(x); }
1938/*! @abstract Do not call this function directly; use simd::exp10 instead. */
1939static SIMD_CPPFUNC double __tg_exp10(double x) { return ::__exp10(x); }
1940/*! @abstract Do not call this function directly; use simd::expm1 instead. */
1941static SIMD_CPPFUNC float __tg_expm1(float x) { return ::expm1f(x); }
1942/*! @abstract Do not call this function directly; use simd::expm1 instead. */
1943static SIMD_CPPFUNC double __tg_expm1(double x) { return ::expm1(x); }
1944/*! @abstract Do not call this function directly; use simd::log instead. */
1945static SIMD_CPPFUNC float __tg_log(float x) { return ::logf(x); }
1946/*! @abstract Do not call this function directly; use simd::log instead. */
1947static SIMD_CPPFUNC double __tg_log(double x) { return ::log(x); }
1948/*! @abstract Do not call this function directly; use simd::log2 instead. */
1949static SIMD_CPPFUNC float __tg_log2(float x) { return ::log2f(x); }
1950/*! @abstract Do not call this function directly; use simd::log2 instead. */
1951static SIMD_CPPFUNC double __tg_log2(double x) { return ::log2(x); }
1952/*! @abstract Do not call this function directly; use simd::log10 instead. */
1953static SIMD_CPPFUNC float __tg_log10(float x) { return ::log10f(x); }
1954/*! @abstract Do not call this function directly; use simd::log10 instead. */
1955static SIMD_CPPFUNC double __tg_log10(double x) { return ::log10(x); }
1956/*! @abstract Do not call this function directly; use simd::log1p instead. */
1957static SIMD_CPPFUNC float __tg_log1p(float x) { return ::log1pf(x); }
1958/*! @abstract Do not call this function directly; use simd::log1p instead. */
1959static SIMD_CPPFUNC double __tg_log1p(double x) { return ::log1p(x); }
1960/*! @abstract Do not call this function directly; use simd::fabs instead. */
1961static SIMD_CPPFUNC float __tg_fabs(float x) { return ::fabsf(x); }
1962/*! @abstract Do not call this function directly; use simd::fabs instead. */
1963static SIMD_CPPFUNC double __tg_fabs(double x) { return ::fabs(x); }
1964/*! @abstract Do not call this function directly; use simd::cbrt instead. */
1965static SIMD_CPPFUNC float __tg_cbrt(float x) { return ::cbrtf(x); }
1966/*! @abstract Do not call this function directly; use simd::cbrt instead. */
1967static SIMD_CPPFUNC double __tg_cbrt(double x) { return ::cbrt(x); }
1968/*! @abstract Do not call this function directly; use simd::sqrt instead. */
1969static SIMD_CPPFUNC float __tg_sqrt(float x) { return ::sqrtf(x); }
1970/*! @abstract Do not call this function directly; use simd::sqrt instead. */
1971static SIMD_CPPFUNC double __tg_sqrt(double x) { return ::sqrt(x); }
1972/*! @abstract Do not call this function directly; use simd::erf instead. */
1973static SIMD_CPPFUNC float __tg_erf(float x) { return ::erff(x); }
1974/*! @abstract Do not call this function directly; use simd::erf instead. */
1975static SIMD_CPPFUNC double __tg_erf(double x) { return ::erf(x); }
1976/*! @abstract Do not call this function directly; use simd::erfc instead. */
1977static SIMD_CPPFUNC float __tg_erfc(float x) { return ::erfcf(x); }
1978/*! @abstract Do not call this function directly; use simd::erfc instead. */
1979static SIMD_CPPFUNC double __tg_erfc(double x) { return ::erfc(x); }
1980/*! @abstract Do not call this function directly; use simd::tgamma instead. */
1981static SIMD_CPPFUNC float __tg_tgamma(float x) { return ::tgammaf(x); }
1982/*! @abstract Do not call this function directly; use simd::tgamma instead. */
1983static SIMD_CPPFUNC double __tg_tgamma(double x) { return ::tgamma(x); }
1984/*! @abstract Do not call this function directly; use simd::lgamma instead. */
1985static SIMD_CPPFUNC float __tg_lgamma(float x) { return ::lgammaf(x); }
1986/*! @abstract Do not call this function directly; use simd::lgamma instead. */
1987static SIMD_CPPFUNC double __tg_lgamma(double x) { return ::lgamma(x); }
1988/*! @abstract Do not call this function directly; use simd::ceil instead. */
1989static SIMD_CPPFUNC float __tg_ceil(float x) { return ::ceilf(x); }
1990/*! @abstract Do not call this function directly; use simd::ceil instead. */
1991static SIMD_CPPFUNC double __tg_ceil(double x) { return ::ceil(x); }
1992/*! @abstract Do not call this function directly; use simd::floor instead. */
1993static SIMD_CPPFUNC float __tg_floor(float x) { return ::floorf(x); }
1994/*! @abstract Do not call this function directly; use simd::floor instead. */
1995static SIMD_CPPFUNC double __tg_floor(double x) { return ::floor(x); }
1996/*! @abstract Do not call this function directly; use simd::rint instead. */
1997static SIMD_CPPFUNC float __tg_rint(float x) { return ::rintf(x); }
1998/*! @abstract Do not call this function directly; use simd::rint instead. */
1999static SIMD_CPPFUNC double __tg_rint(double x) { return ::rint(x); }
2000/*! @abstract Do not call this function directly; use simd::round instead. */
2001static SIMD_CPPFUNC float __tg_round(float x) { return ::roundf(x); }
2002/*! @abstract Do not call this function directly; use simd::round instead. */
2003static SIMD_CPPFUNC double __tg_round(double x) { return ::round(x); }
2004/*! @abstract Do not call this function directly; use simd::trunc instead. */
2005static SIMD_CPPFUNC float __tg_trunc(float x) { return ::truncf(x); }
2006/*! @abstract Do not call this function directly; use simd::trunc instead. */
2007static SIMD_CPPFUNC double __tg_trunc(double x) { return ::trunc(x); }
2008#if SIMD_LIBRARY_VERSION >= 5
2009/*! @abstract Do not call this function directly; use simd::sincos instead. */
2010static SIMD_INLINE SIMD_NODEBUG void __tg_sincos(float x, float *sinp, float *cosp) { ::__sincosf(x, sinp, cosp); }
2011/*! @abstract Do not call this function directly; use simd::sincos instead. */
2012static SIMD_INLINE SIMD_NODEBUG void __tg_sincos(double x, double *sinp, double *cosp) { ::__sincos(x, sinp, cosp); }
2013/*! @abstract Do not call this function directly; use simd::sincospi
2014 * instead. */
2015static SIMD_INLINE SIMD_NODEBUG void __tg_sincospi(float x, float *sinp, float *cosp) { ::__sincospif(x, sinp, cosp); }
2016/*! @abstract Do not call this function directly; use simd::sincospi
2017 * instead. */
2018static SIMD_INLINE SIMD_NODEBUG void __tg_sincospi(double x, double *sinp, double *cosp) { ::__sincospi(x, sinp, cosp); }
2019#endif
2020#if SIMD_LIBRARY_VERSION >= 6
2021/*! @abstract Do not call this function directly; use simd::fabs instead. */
2022static SIMD_CPPFUNC _Float16 __tg_fabs(_Float16 x) { return ::__fabsf16(x); }
2023/*! @abstract Do not call this function directly; use simd::sqrt instead. */
2024static SIMD_CPPFUNC _Float16 __tg_sqrt(_Float16 x) { return ::__sqrtf16(x); }
2025/*! @abstract Do not call this function directly; use simd::ceil instead. */
2026static SIMD_CPPFUNC _Float16 __tg_ceil(_Float16 x) { return ::__ceilf16(x); }
2027/*! @abstract Do not call this function directly; use simd::floor instead. */
2028static SIMD_CPPFUNC _Float16 __tg_floor(_Float16 x) { return ::__floorf16(x); }
2029/*! @abstract Do not call this function directly; use simd::rint instead. */
2030static SIMD_CPPFUNC _Float16 __tg_rint(_Float16 x) { return ::__rintf16(x); }
2031/*! @abstract Do not call this function directly; use simd::trunc instead. */
2032static SIMD_CPPFUNC _Float16 __tg_trunc(_Float16 x) { return ::__truncf16(x); }
2033#endif
2034/*! @abstract Do not call this function directly; use simd::isfinite
2035 * instead. */
2036static SIMD_CPPFUNC float __tg_isfinite(float x) { return std::isfinite(x); }
2037/*! @abstract Do not call this function directly; use simd::isfinite
2038 * instead. */
2039static SIMD_CPPFUNC double __tg_isfinite(double x) { return std::isfinite(x); }
2040/*! @abstract Do not call this function directly; use simd::isinf instead. */
2041static SIMD_CPPFUNC float __tg_isinf(float x) { return std::isinf(x); }
2042/*! @abstract Do not call this function directly; use simd::isinf instead. */
2043static SIMD_CPPFUNC double __tg_isinf(double x) { return std::isinf(x); }
2044/*! @abstract Do not call this function directly; use simd::isnan instead. */
2045static SIMD_CPPFUNC float __tg_isnan(float x) { return std::isnan(x); }
2046/*! @abstract Do not call this function directly; use simd::isnan instead. */
2047static SIMD_CPPFUNC double __tg_isnan(double x) { return std::isnan(x); }
2048/*! @abstract Do not call this function directly; use simd::isnormal
2049 * instead. */
2050static SIMD_CPPFUNC float __tg_isnormal(float x) { return std::isnormal(x); }
2051/*! @abstract Do not call this function directly; use simd::isnormal
2052 * instead. */
2053static SIMD_CPPFUNC double __tg_isnormal(double x) { return std::isnormal(x); }
2054/*! @abstract Do not call this function directly; use simd::atan2 instead. */
2055static SIMD_CPPFUNC float __tg_atan2(float x, float y) { return ::atan2f(x, y); }
2056/*! @abstract Do not call this function directly; use simd::atan2 instead. */
2057static SIMD_CPPFUNC double __tg_atan2(double x, double y) { return ::atan2(x, y); }
2058/*! @abstract Do not call this function directly; use simd::hypot instead. */
2059static SIMD_CPPFUNC float __tg_hypot(float x, float y) { return ::hypotf(x, y); }
2060/*! @abstract Do not call this function directly; use simd::hypot instead. */
2061static SIMD_CPPFUNC double __tg_hypot(double x, double y) { return ::hypot(x, y); }
2062/*! @abstract Do not call this function directly; use simd::pow instead. */
2063static SIMD_CPPFUNC float __tg_pow(float x, float y) { return ::powf(x, y); }
2064/*! @abstract Do not call this function directly; use simd::pow instead. */
2065static SIMD_CPPFUNC double __tg_pow(double x, double y) { return ::pow(x, y); }
2066/*! @abstract Do not call this function directly; use simd::fmod instead. */
2067static SIMD_CPPFUNC float __tg_fmod(float x, float y) { return ::fmodf(x, y); }
2068/*! @abstract Do not call this function directly; use simd::fmod instead. */
2069static SIMD_CPPFUNC double __tg_fmod(double x, double y) { return ::fmod(x, y); }
2070/*! @abstract Do not call this function directly; use simd::remainder
2071 * instead. */
2072static SIMD_CPPFUNC float __tg_remainder(float x, float y) { return ::remainderf(x, y); }
2073/*! @abstract Do not call this function directly; use simd::remainder
2074 * instead. */
2075static SIMD_CPPFUNC double __tg_remainder(double x, double y) { return ::remainder(x, y); }
2076/*! @abstract Do not call this function directly; use simd::copysign
2077 * instead. */
2078static SIMD_CPPFUNC float __tg_copysign(float x, float y) { return ::copysignf(x, y); }
2079/*! @abstract Do not call this function directly; use simd::copysign
2080 * instead. */
2081static SIMD_CPPFUNC double __tg_copysign(double x, double y) { return ::copysign(x, y); }
2082/*! @abstract Do not call this function directly; use simd::nextafter
2083 * instead. */
2084static SIMD_CPPFUNC float __tg_nextafter(float x, float y) { return ::nextafterf(x, y); }
2085/*! @abstract Do not call this function directly; use simd::nextafter
2086 * instead. */
2087static SIMD_CPPFUNC double __tg_nextafter(double x, double y) { return ::nextafter(x, y); }
2088/*! @abstract Do not call this function directly; use simd::fdim instead. */
2089static SIMD_CPPFUNC float __tg_fdim(float x, float y) { return ::fdimf(x, y); }
2090/*! @abstract Do not call this function directly; use simd::fdim instead. */
2091static SIMD_CPPFUNC double __tg_fdim(double x, double y) { return ::fdim(x, y); }
2092/*! @abstract Do not call this function directly; use simd::fmax instead. */
2093static SIMD_CPPFUNC float __tg_fmax(float x, float y) { return ::fmaxf(x, y); }
2094/*! @abstract Do not call this function directly; use simd::fmax instead. */
2095static SIMD_CPPFUNC double __tg_fmax(double x, double y) { return ::fmax(x, y); }
2096/*! @abstract Do not call this function directly; use simd::fmin instead. */
2097static SIMD_CPPFUNC float __tg_fmin(float x, float y) { return ::fminf(x, y); }
2098/*! @abstract Do not call this function directly; use simd::fmin instead. */
2099static SIMD_CPPFUNC double __tg_fmin(double x, double y) { return ::fmin(x, y); }
2100#if SIMD_LIBRARY_VERSION >= 6
2101/*! @abstract Do not call this function directly; use simd::fmin instead. */
2102static SIMD_CPPFUNC _Float16 __tg_fmin(_Float16 x, _Float16 y) { return ::__fminf16(x, y); }
2103/*! @abstract Do not call this function directly; use simd::fmax instead. */
2104static SIMD_CPPFUNC _Float16 __tg_fmax(_Float16 x, _Float16 y) { return ::__fmaxf16(x, y); }
2105/*! @abstract Do not call this function directly; use simd::copysign
2106 * instead. */
2107static SIMD_CPPFUNC _Float16 __tg_copysign(_Float16 x, _Float16 y) { return ::__copysignf16(x, y); }
2108#endif
2109/*! @abstract Do not call this function directly; use simd::fma instead. */
2110static SIMD_CPPFUNC float __tg_fma(float x, float y, float z) { return ::fmaf(x, y, z); }
2111/*! @abstract Do not call this function directly; use simd::fma instead. */
2112static SIMD_CPPFUNC double __tg_fma(double x, double y, double z) { return ::fma(x, y, z); }
2113
2114namespace simd {
2115/*! @abstract Generalizes the <cmath> function acos to operate on vectors of
2116 * floats and doubles. */
2117 template <typename fptypeN>
2118 static SIMD_CPPFUNC fptypeN acos(fptypeN x) { return ::__tg_acos(x); }
2119
2120/*! @abstract Generalizes the <cmath> function asin to operate on vectors of
2121 * floats and doubles. */
2122 template <typename fptypeN>
2123 static SIMD_CPPFUNC fptypeN asin(fptypeN x) { return ::__tg_asin(x); }
2124
2125/*! @abstract Generalizes the <cmath> function atan to operate on vectors of
2126 * floats and doubles. */
2127 template <typename fptypeN>
2128 static SIMD_CPPFUNC fptypeN atan(fptypeN x) { return ::__tg_atan(x); }
2129
2130/*! @abstract Generalizes the <cmath> function cos to operate on vectors of
2131 * floats and doubles. */
2132 template <typename fptypeN>
2133 static SIMD_CPPFUNC fptypeN cos(fptypeN x) { return ::__tg_cos(x); }
2134
2135/*! @abstract Generalizes the <cmath> function sin to operate on vectors of
2136 * floats and doubles. */
2137 template <typename fptypeN>
2138 static SIMD_CPPFUNC fptypeN sin(fptypeN x) { return ::__tg_sin(x); }
2139
2140/*! @abstract Generalizes the <cmath> function tan to operate on vectors of
2141 * floats and doubles. */
2142 template <typename fptypeN>
2143 static SIMD_CPPFUNC fptypeN tan(fptypeN x) { return ::__tg_tan(x); }
2144
2145#if SIMD_LIBRARY_VERSION >= 1
2146/*! @abstract Generalizes the <cmath> function cospi to operate on vectors
2147 * of floats and doubles. */
2148 template <typename fptypeN>
2149 static SIMD_CPPFUNC fptypeN cospi(fptypeN x) { return ::__tg_cospi(x); }
2150#endif
2151
2152#if SIMD_LIBRARY_VERSION >= 1
2153/*! @abstract Generalizes the <cmath> function sinpi to operate on vectors
2154 * of floats and doubles. */
2155 template <typename fptypeN>
2156 static SIMD_CPPFUNC fptypeN sinpi(fptypeN x) { return ::__tg_sinpi(x); }
2157#endif
2158
2159#if SIMD_LIBRARY_VERSION >= 1
2160/*! @abstract Generalizes the <cmath> function tanpi to operate on vectors
2161 * of floats and doubles. */
2162 template <typename fptypeN>
2163 static SIMD_CPPFUNC fptypeN tanpi(fptypeN x) { return ::__tg_tanpi(x); }
2164#endif
2165
2166/*! @abstract Generalizes the <cmath> function acosh to operate on vectors
2167 * of floats and doubles. */
2168 template <typename fptypeN>
2169 static SIMD_CPPFUNC fptypeN acosh(fptypeN x) { return ::__tg_acosh(x); }
2170
2171/*! @abstract Generalizes the <cmath> function asinh to operate on vectors
2172 * of floats and doubles. */
2173 template <typename fptypeN>
2174 static SIMD_CPPFUNC fptypeN asinh(fptypeN x) { return ::__tg_asinh(x); }
2175
2176/*! @abstract Generalizes the <cmath> function atanh to operate on vectors
2177 * of floats and doubles. */
2178 template <typename fptypeN>
2179 static SIMD_CPPFUNC fptypeN atanh(fptypeN x) { return ::__tg_atanh(x); }
2180
2181/*! @abstract Generalizes the <cmath> function cosh to operate on vectors of
2182 * floats and doubles. */
2183 template <typename fptypeN>
2184 static SIMD_CPPFUNC fptypeN cosh(fptypeN x) { return ::__tg_cosh(x); }
2185
2186/*! @abstract Generalizes the <cmath> function sinh to operate on vectors of
2187 * floats and doubles. */
2188 template <typename fptypeN>
2189 static SIMD_CPPFUNC fptypeN sinh(fptypeN x) { return ::__tg_sinh(x); }
2190
2191/*! @abstract Generalizes the <cmath> function tanh to operate on vectors of
2192 * floats and doubles. */
2193 template <typename fptypeN>
2194 static SIMD_CPPFUNC fptypeN tanh(fptypeN x) { return ::__tg_tanh(x); }
2195
2196/*! @abstract Generalizes the <cmath> function exp to operate on vectors of
2197 * floats and doubles. */
2198 template <typename fptypeN>
2199 static SIMD_CPPFUNC fptypeN exp(fptypeN x) { return ::__tg_exp(x); }
2200
2201/*! @abstract Generalizes the <cmath> function exp2 to operate on vectors of
2202 * floats and doubles. */
2203 template <typename fptypeN>
2204 static SIMD_CPPFUNC fptypeN exp2(fptypeN x) { return ::__tg_exp2(x); }
2205
2206#if SIMD_LIBRARY_VERSION >= 1
2207/*! @abstract Generalizes the <cmath> function exp10 to operate on vectors
2208 * of floats and doubles. */
2209 template <typename fptypeN>
2210 static SIMD_CPPFUNC fptypeN exp10(fptypeN x) { return ::__tg_exp10(x); }
2211#endif
2212
2213/*! @abstract Generalizes the <cmath> function expm1 to operate on vectors
2214 * of floats and doubles. */
2215 template <typename fptypeN>
2216 static SIMD_CPPFUNC fptypeN expm1(fptypeN x) { return ::__tg_expm1(x); }
2217
2218/*! @abstract Generalizes the <cmath> function log to operate on vectors of
2219 * floats and doubles. */
2220 template <typename fptypeN>
2221 static SIMD_CPPFUNC fptypeN log(fptypeN x) { return ::__tg_log(x); }
2222
2223/*! @abstract Generalizes the <cmath> function log2 to operate on vectors of
2224 * floats and doubles. */
2225 template <typename fptypeN>
2226 static SIMD_CPPFUNC fptypeN log2(fptypeN x) { return ::__tg_log2(x); }
2227
2228/*! @abstract Generalizes the <cmath> function log10 to operate on vectors
2229 * of floats and doubles. */
2230 template <typename fptypeN>
2231 static SIMD_CPPFUNC fptypeN log10(fptypeN x) { return ::__tg_log10(x); }
2232
2233/*! @abstract Generalizes the <cmath> function log1p to operate on vectors
2234 * of floats and doubles. */
2235 template <typename fptypeN>
2236 static SIMD_CPPFUNC fptypeN log1p(fptypeN x) { return ::__tg_log1p(x); }
2237
2238/*! @abstract Generalizes the <cmath> function fabs to operate on vectors of
2239 * floats and doubles. */
2240 template <typename fptypeN>
2241 static SIMD_CPPFUNC fptypeN fabs(fptypeN x) { return ::__tg_fabs(x); }
2242
2243/*! @abstract Generalizes the <cmath> function cbrt to operate on vectors of
2244 * floats and doubles. */
2245 template <typename fptypeN>
2246 static SIMD_CPPFUNC fptypeN cbrt(fptypeN x) { return ::__tg_cbrt(x); }
2247
2248/*! @abstract Generalizes the <cmath> function sqrt to operate on vectors of
2249 * floats and doubles. */
2250 template <typename fptypeN>
2251 static SIMD_CPPFUNC fptypeN sqrt(fptypeN x) { return ::__tg_sqrt(x); }
2252
2253/*! @abstract Generalizes the <cmath> function erf to operate on vectors of
2254 * floats and doubles. */
2255 template <typename fptypeN>
2256 static SIMD_CPPFUNC fptypeN erf(fptypeN x) { return ::__tg_erf(x); }
2257
2258/*! @abstract Generalizes the <cmath> function erfc to operate on vectors of
2259 * floats and doubles. */
2260 template <typename fptypeN>
2261 static SIMD_CPPFUNC fptypeN erfc(fptypeN x) { return ::__tg_erfc(x); }
2262
2263/*! @abstract Generalizes the <cmath> function tgamma to operate on vectors
2264 * of floats and doubles. */
2265 template <typename fptypeN>
2266 static SIMD_CPPFUNC fptypeN tgamma(fptypeN x) { return ::__tg_tgamma(x); }
2267
2268/*! @abstract Generalizes the <cmath> function lgamma to operate on vectors
2269 * of floats and doubles. */
2270 template <typename fptypeN>
2271 static SIMD_CPPFUNC fptypeN lgamma(fptypeN x) { return ::__tg_lgamma(x); }
2272
2273/*! @abstract Generalizes the <cmath> function ceil to operate on vectors of
2274 * floats and doubles. */
2275 template <typename fptypeN>
2276 static SIMD_CPPFUNC fptypeN ceil(fptypeN x) { return ::__tg_ceil(x); }
2277
2278/*! @abstract Generalizes the <cmath> function floor to operate on vectors
2279 * of floats and doubles. */
2280 template <typename fptypeN>
2281 static SIMD_CPPFUNC fptypeN floor(fptypeN x) { return ::__tg_floor(x); }
2282
2283/*! @abstract Generalizes the <cmath> function rint to operate on vectors of
2284 * floats and doubles. */
2285 template <typename fptypeN>
2286 static SIMD_CPPFUNC fptypeN rint(fptypeN x) { return ::__tg_rint(x); }
2287
2288/*! @abstract Generalizes the <cmath> function round to operate on vectors
2289 * of floats and doubles. */
2290 template <typename fptypeN>
2291 static SIMD_CPPFUNC fptypeN round(fptypeN x) { return ::__tg_round(x); }
2292
2293/*! @abstract Generalizes the <cmath> function trunc to operate on vectors
2294 * of floats and doubles. */
2295 template <typename fptypeN>
2296 static SIMD_CPPFUNC fptypeN trunc(fptypeN x) { return ::__tg_trunc(x); }
2297
2298#if SIMD_LIBRARY_VERSION >= 5
2299/*! @abstract Computes sincos more efficiently than separate computations. */
2300 template <typename fptypeN>
2301 static SIMD_INLINE SIMD_NODEBUG void sincos(fptypeN x, fptypeN *sinp, fptypeN *cosp) { ::__tg_sincos(x, sinp, cosp); }
2302
2303/*! @abstract Computes sincospi more efficiently than separate computations. */
2304 template <typename fptypeN>
2305 static SIMD_INLINE SIMD_NODEBUG void sincospi(fptypeN x, fptypeN *sinp, fptypeN *cosp) { ::__tg_sincospi(x, sinp, cosp); }
2306
2307#endif
2308/*! @abstract Generalizes the <cmath> function isfinite to operate on
2309 * vectors of floats and doubles. */
2310 template <typename fptypeN>
2311 static SIMD_CPPFUNC
2312 typename std::enable_if<std::is_floating_point<typename traits<fptypeN>::scalar_t>::value, typename traits<fptypeN>::mask_t>::type
2313 isfinite(fptypeN x) { return ::__tg_isfinite(x); }
2314
2315/*! @abstract Generalizes the <cmath> function isinf to operate on vectors
2316 * of floats and doubles. */
2317 template <typename fptypeN>
2318 static SIMD_CPPFUNC
2319 typename std::enable_if<std::is_floating_point<typename traits<fptypeN>::scalar_t>::value, typename traits<fptypeN>::mask_t>::type
2320 isinf(fptypeN x) { return ::__tg_isinf(x); }
2321
2322/*! @abstract Generalizes the <cmath> function isnan to operate on vectors
2323 * of floats and doubles. */
2324 template <typename fptypeN>
2325 static SIMD_CPPFUNC
2326 typename std::enable_if<std::is_floating_point<typename traits<fptypeN>::scalar_t>::value, typename traits<fptypeN>::mask_t>::type
2327 isnan(fptypeN x) { return ::__tg_isnan(x); }
2328
2329/*! @abstract Generalizes the <cmath> function isnormal to operate on
2330 * vectors of floats and doubles. */
2331 template <typename fptypeN>
2332 static SIMD_CPPFUNC
2333 typename std::enable_if<std::is_floating_point<typename traits<fptypeN>::scalar_t>::value, typename traits<fptypeN>::mask_t>::type
2334 isnormal(fptypeN x) { return ::__tg_isnormal(x); }
2335
2336/*! @abstract Generalizes the <cmath> function atan2 to operate on vectors
2337 * of floats and doubles. */
2338 template <typename fptypeN>
2339 static SIMD_CPPFUNC fptypeN atan2(fptypeN y, fptypeN x) { return ::__tg_atan2(y, x); }
2340
2341/*! @abstract Generalizes the <cmath> function hypot to operate on vectors
2342 * of floats and doubles. */
2343 template <typename fptypeN>
2344 static SIMD_CPPFUNC fptypeN hypot(fptypeN x, fptypeN y) { return ::__tg_hypot(x, y); }
2345
2346/*! @abstract Generalizes the <cmath> function pow to operate on vectors of
2347 * floats and doubles. */
2348 template <typename fptypeN>
2349 static SIMD_CPPFUNC fptypeN pow(fptypeN x, fptypeN y) { return ::__tg_pow(x, y); }
2350
2351/*! @abstract Generalizes the <cmath> function fmod to operate on vectors of
2352 * floats and doubles. */
2353 template <typename fptypeN>
2354 static SIMD_CPPFUNC fptypeN fmod(fptypeN x, fptypeN y) { return ::__tg_fmod(x, y); }
2355
2356/*! @abstract Generalizes the <cmath> function remainder to operate on
2357 * vectors of floats and doubles. */
2358 template <typename fptypeN>
2359 static SIMD_CPPFUNC fptypeN remainder(fptypeN x, fptypeN y) { return ::__tg_remainder(x, y); }
2360
2361/*! @abstract Generalizes the <cmath> function copysign to operate on
2362 * vectors of floats and doubles. */
2363 template <typename fptypeN>
2364 static SIMD_CPPFUNC fptypeN copysign(fptypeN x, fptypeN y) { return ::__tg_copysign(x, y); }
2365
2366/*! @abstract Generalizes the <cmath> function nextafter to operate on
2367 * vectors of floats and doubles. */
2368 template <typename fptypeN>
2369 static SIMD_CPPFUNC fptypeN nextafter(fptypeN x, fptypeN y) { return ::__tg_nextafter(x, y); }
2370
2371/*! @abstract Generalizes the <cmath> function fdim to operate on vectors of
2372 * floats and doubles. */
2373 template <typename fptypeN>
2374 static SIMD_CPPFUNC fptypeN fdim(fptypeN x, fptypeN y) { return ::__tg_fdim(x, y); }
2375
2376/*! @abstract Generalizes the <cmath> function fmax to operate on vectors of
2377 * floats and doubles. */
2378 template <typename fptypeN>
2379 static SIMD_CPPFUNC fptypeN fmax(fptypeN x, fptypeN y) { return ::__tg_fmax(x, y); }
2380
2381/*! @abstract Generalizes the <cmath> function fmin to operate on vectors of
2382 * floats and doubles. */
2383 template <typename fptypeN>
2384 static SIMD_CPPFUNC fptypeN fmin(fptypeN x, fptypeN y) { return ::__tg_fmin(x, y); }
2385
2386/*! @abstract Generalizes the <cmath> function fma to operate on vectors of
2387 * floats and doubles. */
2388 template <typename fptypeN>
2389 static SIMD_CPPFUNC fptypeN fma(fptypeN x, fptypeN y, fptypeN z) { return ::__tg_fma(x, y, z); }
2390
2391/*! @abstract Computes x*y + z by the most efficient means available; either
2392 * a fused multiply add or separate multiply and add. */
2393 template <typename fptypeN>
2394 static SIMD_CPPFUNC fptypeN muladd(fptypeN x, fptypeN y, fptypeN z) { return ::simd_muladd(x, y, z); }
2395};
2396
2397extern "C" {
2398#else
2399#include <tgmath.h>
2400/* C and Objective-C, we need some infrastructure to piggyback on tgmath.h */
2401static SIMD_OVERLOAD simd_half2 __tg_promote(simd_half2);
2402static SIMD_OVERLOAD simd_half3 __tg_promote(simd_half3);
2403static SIMD_OVERLOAD simd_half4 __tg_promote(simd_half4);
2404static SIMD_OVERLOAD simd_half8 __tg_promote(simd_half8);
2405static SIMD_OVERLOAD simd_half16 __tg_promote(simd_half16);
2406static SIMD_OVERLOAD simd_half32 __tg_promote(simd_half32);
2407static SIMD_OVERLOAD simd_float2 __tg_promote(simd_float2);
2408static SIMD_OVERLOAD simd_float3 __tg_promote(simd_float3);
2409static SIMD_OVERLOAD simd_float4 __tg_promote(simd_float4);
2410static SIMD_OVERLOAD simd_float8 __tg_promote(simd_float8);
2411static SIMD_OVERLOAD simd_float16 __tg_promote(simd_float16);
2412static SIMD_OVERLOAD simd_double2 __tg_promote(simd_double2);
2413static SIMD_OVERLOAD simd_double3 __tg_promote(simd_double3);
2414static SIMD_OVERLOAD simd_double4 __tg_promote(simd_double4);
2415static SIMD_OVERLOAD simd_double8 __tg_promote(simd_double8);
2416
2417/* Apple extensions to <math.h>, added in macOS 10.9 and iOS 7.0 */
2418#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9 || \
2419 __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0 || \
2420 __DRIVERKIT_VERSION_MIN_REQUIRED >= __DRIVERKIT_19_0
2421static inline SIMD_CFUNC float __tg_cospi(float x) { return __cospif(x); }
2422static inline SIMD_CFUNC double __tg_cospi(double x) { return __cospi(x); }
2423#undef cospi
2424/*! @abstract `cospi(x)` computes `cos(pi * x)` without intermediate rounding.
2425 *
2426 * @discussion Both faster and more accurate than multiplying by `pi` and then
2427 * calling `cos`. Defined for `float` and `double` as well as vectors of
2428 * floats and doubles as provided by `<simd/simd.h>`. */
2429#define cospi(__x) __tg_cospi(__tg_promote1((__x))(__x))
2430
2431static inline SIMD_CFUNC float __tg_sinpi(float x) { return __sinpif(x); }
2432static inline SIMD_CFUNC double __tg_sinpi(double x) { return __sinpi(x); }
2433#undef sinpi
2434/*! @abstract `sinpi(x)` computes `sin(pi * x)` without intermediate rounding.
2435 *
2436 * @discussion Both faster and more accurate than multiplying by `pi` and then
2437 * calling `sin`. Defined for `float` and `double` as well as vectors
2438 * of floats and doubles as provided by `<simd/simd.h>`. */
2439#define sinpi(__x) __tg_sinpi(__tg_promote1((__x))(__x))
2440
2441static inline SIMD_CFUNC float __tg_tanpi(float x) { return __tanpif(x); }
2442static inline SIMD_CFUNC double __tg_tanpi(double x) { return __tanpi(x); }
2443#undef tanpi
2444/*! @abstract `tanpi(x)` computes `tan(pi * x)` without intermediate rounding.
2445 *
2446 * @discussion Both faster and more accurate than multiplying by `pi` and then
2447 * calling `tan`. Defined for `float` and `double` as well as vectors of
2448 * floats and doubles as provided by `<simd/simd.h>`. */
2449#define tanpi(__x) __tg_tanpi(__tg_promote1((__x))(__x))
2450
2451#if SIMD_LIBRARY_VERSION >= 5
2452static inline SIMD_NONCONST void __tg_sincos(float x, float *sinp, float *cosp) { __sincosf(x, sinp, cosp); }
2453static inline SIMD_NONCONST void __tg_sincos(double x, double *sinp, double *cosp) { __sincos(x, sinp, cosp); }
2454#undef sincos
2455/*! @abstract `sincos(x)` computes `sin(x)` and `cos(x)` more efficiently.
2456 *
2457 * @discussion Defined for `float` and `double` as well as vectors of
2458 * floats and doubles as provided by `<simd/simd.h>`. */
2459#define sincos(__x, __sinp, __cosp) __tg_sincos(__tg_promote1((__x))(__x), __sinp, __cosp)
2460
2461static inline SIMD_NONCONST void __tg_sincospi(float x, float *sinp, float *cosp) { __sincospif(x, sinp, cosp); }
2462static inline SIMD_NONCONST void __tg_sincospi(double x, double *sinp, double *cosp) { __sincospi(x, sinp, cosp); }
2463#undef sincospi
2464/*! @abstract `sincospi(x)` computes `sin(pi * x)` and `cos(pi * x)` more efficiently.
2465 *
2466 * @discussion Defined for `float` and `double` as well as vectors of
2467 * floats and doubles as provided by `<simd/simd.h>`. */
2468#define sincospi(__x, __sinp, __cosp) __tg_sincospi(__tg_promote1((__x))(__x), __sinp, __cosp)
2469#endif // SIMD_LIBRARY_VERSION >= 5
2470
2471static inline SIMD_CFUNC float __tg_exp10(float x) { return __exp10f(x); }
2472static inline SIMD_CFUNC double __tg_exp10(double x) { return __exp10(x); }
2473#undef exp10
2474/*! @abstract `exp10(x)` computes `10**x` more efficiently and accurately
2475 * than `pow(10, x)`.
2476 *
2477 * @discussion Defined for `float` and `double` as well as vectors of floats
2478 * and doubles as provided by `<simd/simd.h>`. */
2479#define exp10(__x) __tg_exp10(__tg_promote1((__x))(__x))
2480#endif
2481
2482
2483#if (defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__)
2484static inline SIMD_CFUNC int __tg_isfinite(float x) { return __inline_isfinitef(x); }
2485static inline SIMD_CFUNC int __tg_isfinite(double x) { return __inline_isfinited(x); }
2486static inline SIMD_CFUNC int __tg_isfinite(long double x) { return __inline_isfinitel(x); }
2487#undef isfinite
2488/*! @abstract `__tg_isfinite(x)` determines if x is a finite value.
2489 *
2490 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2491 * and doubles as provided by `<simd/simd.h>`. */
2492#define isfinite(__x) __tg_isfinite(__tg_promote1((__x))(__x))
2493
2494static inline SIMD_CFUNC int __tg_isinf(float x) { return __inline_isinff(x); }
2495static inline SIMD_CFUNC int __tg_isinf(double x) { return __inline_isinfd(x); }
2496static inline SIMD_CFUNC int __tg_isinf(long double x) { return __inline_isinfl(x); }
2497#undef isinf
2498/*! @abstract `__tg_isinf(x)` determines if x is positive or negative infinity.
2499 *
2500 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2501 * and doubles as provided by `<simd/simd.h>`. */
2502#define isinf(__x) __tg_isinf(__tg_promote1((__x))(__x))
2503
2504static inline SIMD_CFUNC int __tg_isnan(float x) { return __inline_isnanf(x); }
2505static inline SIMD_CFUNC int __tg_isnan(double x) { return __inline_isnand(x); }
2506static inline SIMD_CFUNC int __tg_isnan(long double x) { return __inline_isnanl(x); }
2507#undef isnan
2508/*! @abstract `__tg_isnan(x)` determines if x is a not-a-number (NaN) value.
2509 *
2510 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2511 * and doubles as provided by `<simd/simd.h>`. */
2512#define isnan(__x) __tg_isnan(__tg_promote1((__x))(__x))
2513
2514static inline SIMD_CFUNC int __tg_isnormal(float x) { return __inline_isnormalf(x); }
2515static inline SIMD_CFUNC int __tg_isnormal(double x) { return __inline_isnormald(x); }
2516static inline SIMD_CFUNC int __tg_isnormal(long double x) { return __inline_isnormall(x); }
2517#undef isnormal
2518/*! @abstract `__tg_isnormal(x)` determines if x is a normal value.
2519 *
2520 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2521 * and doubles as provided by `<simd/simd.h>`. */
2522#define isnormal(__x) __tg_isnormal(__tg_promote1((__x))(__x))
2523
2524#else /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */
2525
2526static inline SIMD_CFUNC int __tg_isfinite(float x) { return __isfinitef(x); }
2527static inline SIMD_CFUNC int __tg_isfinite(double x) { return __isfinited(x); }
2528static inline SIMD_CFUNC int __tg_isfinite(long double x) { return __isfinitel(x); }
2529#undef isfinite
2530/*! @abstract `__tg_isfinite(x)` determines if x is a finite value.
2531 *
2532 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2533 * and doubles as provided by `<simd/simd.h>`. */
2534#define isfinite(__x) __tg_isfinite(__tg_promote1((__x))(__x))
2535
2536static inline SIMD_CFUNC int __tg_isinf(float x) { return __isinff(x); }
2537static inline SIMD_CFUNC int __tg_isinf(double x) { return __isinfd(x); }
2538static inline SIMD_CFUNC int __tg_isinf(long double x) { return __isinfl(x); }
2539#undef isinf
2540/*! @abstract `__tg_isinf(x)` determines if x is positive or negative infinity.
2541 *
2542 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2543 * and doubles as provided by `<simd/simd.h>`. */
2544#define isinf(__x) __tg_isinf(__tg_promote1((__x))(__x))
2545
2546static inline SIMD_CFUNC int __tg_isnan(float x) { return __isnanf(x); }
2547static inline SIMD_CFUNC int __tg_isnan(double x) { return __isnand(x); }
2548static inline SIMD_CFUNC int __tg_isnan(long double x) { return __isnanl(x); }
2549#undef isnan
2550/*! @abstract `__tg_isnan(x)` determines if x is a not-a-number (NaN) value.
2551 *
2552 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2553 * and doubles as provided by `<simd/simd.h>`. */
2554#define isnan(__x) __tg_isnan(__tg_promote1((__x))(__x))
2555
2556static inline SIMD_CFUNC int __tg_isnormal(float x) { return __isnormalf(x); }
2557static inline SIMD_CFUNC int __tg_isnormal(double x) { return __isnormald(x); }
2558static inline SIMD_CFUNC int __tg_isnormal(long double x) { return __isnormall(x); }
2559#undef isnormal
2560/*! @abstract `__tg_isnormal(x)` determines if x is a normal value.
2561 *
2562 * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats
2563 * and doubles as provided by `<simd/simd.h>`. */
2564#define isnormal(__x) __tg_isnormal(__tg_promote1((__x))(__x))
2565#endif /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */
2566#endif /* !__cplusplus */
2567
2568#pragma mark - fabs implementation
2569static inline SIMD_CFUNC simd_half2 __tg_fabs(simd_half2 x) { return simd_bitselect(0.0, x, 0x7fff); }
2570static inline SIMD_CFUNC simd_half3 __tg_fabs(simd_half3 x) { return simd_bitselect(0.0, x, 0x7fff); }
2571static inline SIMD_CFUNC simd_half4 __tg_fabs(simd_half4 x) { return simd_bitselect(0.0, x, 0x7fff); }
2572static inline SIMD_CFUNC simd_half8 __tg_fabs(simd_half8 x) { return simd_bitselect(0.0, x, 0x7fff); }
2573static inline SIMD_CFUNC simd_half16 __tg_fabs(simd_half16 x) { return simd_bitselect(0.0, x, 0x7fff); }
2574static inline SIMD_CFUNC simd_half32 __tg_fabs(simd_half32 x) { return simd_bitselect(0.0, x, 0x7fff); }
2575static inline SIMD_CFUNC simd_float2 __tg_fabs(simd_float2 x) { return simd_bitselect(0.0, x, 0x7fffffff); }
2576static inline SIMD_CFUNC simd_float3 __tg_fabs(simd_float3 x) { return simd_bitselect(0.0, x, 0x7fffffff); }
2577static inline SIMD_CFUNC simd_float4 __tg_fabs(simd_float4 x) { return simd_bitselect(0.0, x, 0x7fffffff); }
2578static inline SIMD_CFUNC simd_float8 __tg_fabs(simd_float8 x) { return simd_bitselect(0.0, x, 0x7fffffff); }
2579static inline SIMD_CFUNC simd_float16 __tg_fabs(simd_float16 x) { return simd_bitselect(0.0, x, 0x7fffffff); }
2580static inline SIMD_CFUNC simd_double2 __tg_fabs(simd_double2 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); }
2581static inline SIMD_CFUNC simd_double3 __tg_fabs(simd_double3 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); }
2582static inline SIMD_CFUNC simd_double4 __tg_fabs(simd_double4 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); }
2583static inline SIMD_CFUNC simd_double8 __tg_fabs(simd_double8 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); }
2584
2585#pragma mark - isfinite implementation
2586static inline SIMD_CFUNC simd_short2 __tg_isfinite(simd_half2 x) { return x == x && __tg_fabs(x) != (simd_half2)INFINITY; }
2587static inline SIMD_CFUNC simd_short3 __tg_isfinite(simd_half3 x) { return x == x && __tg_fabs(x) != (simd_half3)INFINITY; }
2588static inline SIMD_CFUNC simd_short4 __tg_isfinite(simd_half4 x) { return x == x && __tg_fabs(x) != (simd_half4)INFINITY; }
2589static inline SIMD_CFUNC simd_short8 __tg_isfinite(simd_half8 x) { return x == x && __tg_fabs(x) != (simd_half8)INFINITY; }
2590static inline SIMD_CFUNC simd_short16 __tg_isfinite(simd_half16 x) { return x == x && __tg_fabs(x) != (simd_half16)INFINITY; }
2591static inline SIMD_CFUNC simd_short32 __tg_isfinite(simd_half32 x) { return x == x && __tg_fabs(x) != (simd_half32)INFINITY; }
2592static inline SIMD_CFUNC simd_int2 __tg_isfinite(simd_float2 x) { return x == x && __tg_fabs(x) != (simd_float2)INFINITY; }
2593static inline SIMD_CFUNC simd_int3 __tg_isfinite(simd_float3 x) { return x == x && __tg_fabs(x) != (simd_float3)INFINITY; }
2594static inline SIMD_CFUNC simd_int4 __tg_isfinite(simd_float4 x) { return x == x && __tg_fabs(x) != (simd_float4)INFINITY; }
2595static inline SIMD_CFUNC simd_int8 __tg_isfinite(simd_float8 x) { return x == x && __tg_fabs(x) != (simd_float8)INFINITY; }
2596static inline SIMD_CFUNC simd_int16 __tg_isfinite(simd_float16 x) { return x == x && __tg_fabs(x) != (simd_float16)INFINITY; }
2597static inline SIMD_CFUNC simd_long2 __tg_isfinite(simd_double2 x) { return x == x && __tg_fabs(x) != (simd_double2)INFINITY; }
2598static inline SIMD_CFUNC simd_long3 __tg_isfinite(simd_double3 x) { return x == x && __tg_fabs(x) != (simd_double3)INFINITY; }
2599static inline SIMD_CFUNC simd_long4 __tg_isfinite(simd_double4 x) { return x == x && __tg_fabs(x) != (simd_double4)INFINITY; }
2600static inline SIMD_CFUNC simd_long8 __tg_isfinite(simd_double8 x) { return x == x && __tg_fabs(x) != (simd_double8)INFINITY; }
2601
2602#pragma mark - isinf implementation
2603static inline SIMD_CFUNC simd_short2 __tg_isinf(simd_half2 x) { return __tg_fabs(x) == (simd_half2)INFINITY; }
2604static inline SIMD_CFUNC simd_short3 __tg_isinf(simd_half3 x) { return __tg_fabs(x) == (simd_half3)INFINITY; }
2605static inline SIMD_CFUNC simd_short4 __tg_isinf(simd_half4 x) { return __tg_fabs(x) == (simd_half4)INFINITY; }
2606static inline SIMD_CFUNC simd_short8 __tg_isinf(simd_half8 x) { return __tg_fabs(x) == (simd_half8)INFINITY; }
2607static inline SIMD_CFUNC simd_short16 __tg_isinf(simd_half16 x) { return __tg_fabs(x) == (simd_half16)INFINITY; }
2608static inline SIMD_CFUNC simd_short32 __tg_isinf(simd_half32 x) { return __tg_fabs(x) == (simd_half32)INFINITY; }
2609static inline SIMD_CFUNC simd_int2 __tg_isinf(simd_float2 x) { return __tg_fabs(x) == (simd_float2)INFINITY; }
2610static inline SIMD_CFUNC simd_int3 __tg_isinf(simd_float3 x) { return __tg_fabs(x) == (simd_float3)INFINITY; }
2611static inline SIMD_CFUNC simd_int4 __tg_isinf(simd_float4 x) { return __tg_fabs(x) == (simd_float4)INFINITY; }
2612static inline SIMD_CFUNC simd_int8 __tg_isinf(simd_float8 x) { return __tg_fabs(x) == (simd_float8)INFINITY; }
2613static inline SIMD_CFUNC simd_int16 __tg_isinf(simd_float16 x) { return __tg_fabs(x) == (simd_float16)INFINITY; }
2614static inline SIMD_CFUNC simd_long2 __tg_isinf(simd_double2 x) { return __tg_fabs(x) == (simd_double2)INFINITY; }
2615static inline SIMD_CFUNC simd_long3 __tg_isinf(simd_double3 x) { return __tg_fabs(x) == (simd_double3)INFINITY; }
2616static inline SIMD_CFUNC simd_long4 __tg_isinf(simd_double4 x) { return __tg_fabs(x) == (simd_double4)INFINITY; }
2617static inline SIMD_CFUNC simd_long8 __tg_isinf(simd_double8 x) { return __tg_fabs(x) == (simd_double8)INFINITY; }
2618
2619#pragma mark - isnan implementation
2620static inline SIMD_CFUNC simd_short2 __tg_isnan(simd_half2 x) { return x != x; }
2621static inline SIMD_CFUNC simd_short3 __tg_isnan(simd_half3 x) { return x != x; }
2622static inline SIMD_CFUNC simd_short4 __tg_isnan(simd_half4 x) { return x != x; }
2623static inline SIMD_CFUNC simd_short8 __tg_isnan(simd_half8 x) { return x != x; }
2624static inline SIMD_CFUNC simd_short16 __tg_isnan(simd_half16 x) { return x != x; }
2625static inline SIMD_CFUNC simd_short32 __tg_isnan(simd_half32 x) { return x != x; }
2626static inline SIMD_CFUNC simd_int2 __tg_isnan(simd_float2 x) { return x != x; }
2627static inline SIMD_CFUNC simd_int3 __tg_isnan(simd_float3 x) { return x != x; }
2628static inline SIMD_CFUNC simd_int4 __tg_isnan(simd_float4 x) { return x != x; }
2629static inline SIMD_CFUNC simd_int8 __tg_isnan(simd_float8 x) { return x != x; }
2630static inline SIMD_CFUNC simd_int16 __tg_isnan(simd_float16 x) { return x != x; }
2631static inline SIMD_CFUNC simd_long2 __tg_isnan(simd_double2 x) { return x != x; }
2632static inline SIMD_CFUNC simd_long3 __tg_isnan(simd_double3 x) { return x != x; }
2633static inline SIMD_CFUNC simd_long4 __tg_isnan(simd_double4 x) { return x != x; }
2634static inline SIMD_CFUNC simd_long8 __tg_isnan(simd_double8 x) { return x != x; }
2635
2636#pragma mark - isnormal implementation
2637static inline SIMD_CFUNC simd_short2 __tg_isnormal(simd_half2 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half2)__DBL_MIN__; }
2638static inline SIMD_CFUNC simd_short3 __tg_isnormal(simd_half3 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half3)__DBL_MIN__; }
2639static inline SIMD_CFUNC simd_short4 __tg_isnormal(simd_half4 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half4)__DBL_MIN__; }
2640static inline SIMD_CFUNC simd_short8 __tg_isnormal(simd_half8 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half8)__DBL_MIN__; }
2641static inline SIMD_CFUNC simd_short16 __tg_isnormal(simd_half16 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half16)__DBL_MIN__; }
2642static inline SIMD_CFUNC simd_short32 __tg_isnormal(simd_half32 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half32)__DBL_MIN__; }
2643static inline SIMD_CFUNC simd_int2 __tg_isnormal(simd_float2 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float2)__FLT_MIN__; }
2644static inline SIMD_CFUNC simd_int3 __tg_isnormal(simd_float3 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float3)__FLT_MIN__; }
2645static inline SIMD_CFUNC simd_int4 __tg_isnormal(simd_float4 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float4)__FLT_MIN__; }
2646static inline SIMD_CFUNC simd_int8 __tg_isnormal(simd_float8 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float8)__FLT_MIN__; }
2647static inline SIMD_CFUNC simd_int16 __tg_isnormal(simd_float16 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float16)__FLT_MIN__; }
2648static inline SIMD_CFUNC simd_long2 __tg_isnormal(simd_double2 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double2)__DBL_MIN__; }
2649static inline SIMD_CFUNC simd_long3 __tg_isnormal(simd_double3 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double3)__DBL_MIN__; }
2650static inline SIMD_CFUNC simd_long4 __tg_isnormal(simd_double4 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double4)__DBL_MIN__; }
2651static inline SIMD_CFUNC simd_long8 __tg_isnormal(simd_double8 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double8)__DBL_MIN__; }
2652
2653#pragma mark - fmin, fmax implementation
2654static SIMD_CFUNC simd_half2 __tg_fmin(simd_half2 x, simd_half2 y) {
2655 return __tg_fmin(simd_make_half4_undef(x), simd_make_half4_undef(y)).lo;
2656}
2657
2658static SIMD_CFUNC simd_half3 __tg_fmin(simd_half3 x, simd_half3 y) {
2659 return simd_make_half3(__tg_fmin(simd_make_half4_undef(x), simd_make_half4_undef(y)));
2660}
2661
2662static SIMD_CFUNC simd_half4 __tg_fmin(simd_half4 x, simd_half4 y) {
2663#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2664 return vminnm_f16(x, y);
2665#else
2666 return simd_bitselect(y, x, (x <= y) | (y != y));
2667#endif
2668}
2669
2670static SIMD_CFUNC simd_half8 __tg_fmin(simd_half8 x, simd_half8 y) {
2671#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2672 return vminnmq_f16(x, y);
2673#else
2674 return simd_make_half8(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi));
2675#endif
2676}
2677
2678static SIMD_CFUNC simd_half16 __tg_fmin(simd_half16 x, simd_half16 y) {
2679 return simd_make_half16(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi));
2680}
2681
2682static SIMD_CFUNC simd_half32 __tg_fmin(simd_half32 x, simd_half32 y) {
2683 return simd_make_half32(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi));
2684}
2685
2686static SIMD_CFUNC simd_float2 __tg_fmin(simd_float2 x, simd_float2 y) {
2687#if defined __SSE2__
2688 return simd_make_float2(__tg_fmin(simd_make_float4_undef(x), simd_make_float4_undef(y)));
2689#elif defined __arm64__ || defined __aarch64__
2690 return vminnm_f32(x, y);
2691#elif defined __arm__ && __FINITE_MATH_ONLY__
2692 return vmin_f32(x, y);
2693#else
2694 return simd_bitselect(y, x, (x <= y) | (y != y));
2695#endif
2696}
2697
2698static SIMD_CFUNC simd_float3 __tg_fmin(simd_float3 x, simd_float3 y) {
2699 return simd_make_float3(__tg_fmin(simd_make_float4_undef(x), simd_make_float4_undef(y)));
2700}
2701
2702static SIMD_CFUNC simd_float4 __tg_fmin(simd_float4 x, simd_float4 y) {
2703#if defined __AVX512DQ__ && defined __AVX512VL__ && !__FINITE_MATH_ONLY__
2704 return _mm_range_ps(x, y, 4);
2705#elif defined __SSE2__ && __FINITE_MATH_ONLY__
2706 return _mm_min_ps(x, y);
2707#elif defined __SSE2__
2708 return simd_bitselect(_mm_min_ps(x, y), x, y != y);
2709#elif defined __arm64__ || defined __aarch64__
2710 return vminnmq_f32(x, y);
2711#elif defined __arm__ && __FINITE_MATH_ONLY__
2712 return vminq_f32(x, y);
2713#else
2714 return simd_bitselect(y, x, (x <= y) | (y != y));
2715#endif
2716}
2717
2718static SIMD_CFUNC simd_float8 __tg_fmin(simd_float8 x, simd_float8 y) {
2719#if defined __AVX512DQ__ && defined __AVX512VL__ && !__FINITE_MATH_ONLY__
2720 return _mm256_range_ps(x, y, 4);
2721#elif defined __AVX__ && __FINITE_MATH_ONLY__
2722 return _mm256_min_ps(x, y);
2723#elif defined __AVX__
2724 return simd_bitselect(_mm256_min_ps(x, y), x, y != y);
2725#else
2726 return simd_make_float8(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi));
2727#endif
2728}
2729
2730static SIMD_CFUNC simd_float16 __tg_fmin(simd_float16 x, simd_float16 y) {
2731#if defined __x86_64__ && defined __AVX512DQ__ && !__FINITE_MATH_ONLY__
2732 return _mm512_range_ps(x, y, 4);
2733#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__
2734 return _mm512_min_ps(x, y);
2735#elif defined __x86_64__ && defined __AVX512F__
2736 return simd_bitselect(_mm512_min_ps(x, y), x, y != y);
2737#else
2738 return simd_make_float16(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi));
2739#endif
2740}
2741
2742static SIMD_CFUNC simd_double2 __tg_fmin(simd_double2 x, simd_double2 y) {
2743#if defined __AVX512DQ__ && defined __AVX512VL__
2744 return _mm_range_pd(x, y, 4);
2745#elif defined __SSE2__ && __FINITE_MATH_ONLY__
2746 return _mm_min_pd(x, y);
2747#elif defined __SSE2__
2748 return simd_bitselect(_mm_min_pd(x, y), x, y != y);
2749#elif defined __arm64__ || defined __aarch64__
2750 return vminnmq_f64(x, y);
2751#else
2752 return simd_bitselect(y, x, (x <= y) | (y != y));
2753#endif
2754}
2755
2756static SIMD_CFUNC simd_double3 __tg_fmin(simd_double3 x, simd_double3 y) {
2757 return simd_make_double3(__tg_fmin(simd_make_double4_undef(x), simd_make_double4_undef(y)));
2758}
2759
2760static SIMD_CFUNC simd_double4 __tg_fmin(simd_double4 x, simd_double4 y) {
2761#if defined __AVX512DQ__ && defined __AVX512VL__
2762 return _mm256_range_pd(x, y, 4);
2763#elif defined __AVX__ && __FINITE_MATH_ONLY__
2764 return _mm256_min_pd(x, y);
2765#elif defined __AVX__
2766 return simd_bitselect(_mm256_min_pd(x, y), x, y != y);
2767#else
2768 return simd_make_double4(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi));
2769#endif
2770}
2771
2772static SIMD_CFUNC simd_double8 __tg_fmin(simd_double8 x, simd_double8 y) {
2773#if defined __x86_64__ && defined __AVX512DQ__
2774 return _mm512_range_pd(x, y, 4);
2775#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__
2776 return _mm512_min_pd(x, y);
2777#elif defined __x86_64__ && defined __AVX512F__
2778 return simd_bitselect(_mm512_min_pd(x, y), x, y != y);
2779#else
2780 return simd_make_double8(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi));
2781#endif
2782}
2783
2784static SIMD_CFUNC simd_half2 __tg_fmax(simd_half2 x, simd_half2 y) {
2785 return __tg_fmax(simd_make_half4_undef(x), simd_make_half4_undef(y)).lo;
2786}
2787
2788static SIMD_CFUNC simd_half3 __tg_fmax(simd_half3 x, simd_half3 y) {
2789 return simd_make_half3(__tg_fmax(simd_make_half4_undef(x), simd_make_half4_undef(y)));
2790}
2791
2792static SIMD_CFUNC simd_half4 __tg_fmax(simd_half4 x, simd_half4 y) {
2793#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2794 return vmaxnm_f16(x, y);
2795#else
2796 return simd_bitselect(y, x, (x >= y) | (y != y));
2797#endif
2798}
2799
2800static SIMD_CFUNC simd_half8 __tg_fmax(simd_half8 x, simd_half8 y) {
2801#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2802 return vmaxnmq_f16(x, y);
2803#else
2804 return simd_make_half8(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi));
2805#endif
2806}
2807
2808static SIMD_CFUNC simd_half16 __tg_fmax(simd_half16 x, simd_half16 y) {
2809 return simd_make_half16(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi));
2810}
2811
2812static SIMD_CFUNC simd_half32 __tg_fmax(simd_half32 x, simd_half32 y) {
2813 return simd_make_half32(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi));
2814}
2815
2816static SIMD_CFUNC simd_float2 __tg_fmax(simd_float2 x, simd_float2 y) {
2817#if defined __SSE2__
2818 return simd_make_float2(__tg_fmax(simd_make_float4_undef(x), simd_make_float4_undef(y)));
2819#elif defined __arm64__ || defined __aarch64__
2820 return vmaxnm_f32(x, y);
2821#elif defined __arm__ && __FINITE_MATH_ONLY__
2822 return vmax_f32(x, y);
2823#else
2824 return simd_bitselect(y, x, (x >= y) | (y != y));
2825#endif
2826}
2827
2828static SIMD_CFUNC simd_float3 __tg_fmax(simd_float3 x, simd_float3 y) {
2829 return simd_make_float3(__tg_fmax(simd_make_float4_undef(x), simd_make_float4_undef(y)));
2830}
2831
2832static SIMD_CFUNC simd_float4 __tg_fmax(simd_float4 x, simd_float4 y) {
2833#if defined __AVX512DQ__ && defined __AVX512VL__ && !__FINITE_MATH_ONLY__
2834 return _mm_range_ps(x, y, 5);
2835#elif defined __SSE2__ && __FINITE_MATH_ONLY__
2836 return _mm_max_ps(x, y);
2837#elif defined __SSE2__
2838 return simd_bitselect(_mm_max_ps(x, y), x, y != y);
2839#elif defined __arm64__ || defined __aarch64__
2840 return vmaxnmq_f32(x, y);
2841#elif defined __arm__ && __FINITE_MATH_ONLY__
2842 return vmaxq_f32(x, y);
2843#else
2844 return simd_bitselect(y, x, (x >= y) | (y != y));
2845#endif
2846}
2847
2848static SIMD_CFUNC simd_float8 __tg_fmax(simd_float8 x, simd_float8 y) {
2849#if defined __AVX512DQ__ && defined __AVX512VL__ && !__FINITE_MATH_ONLY__
2850 return _mm256_range_ps(x, y, 5);
2851#elif defined __AVX__ && __FINITE_MATH_ONLY__
2852 return _mm256_max_ps(x, y);
2853#elif defined __AVX__
2854 return simd_bitselect(_mm256_max_ps(x, y), x, y != y);
2855#else
2856 return simd_make_float8(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi));
2857#endif
2858}
2859
2860static SIMD_CFUNC simd_float16 __tg_fmax(simd_float16 x, simd_float16 y) {
2861#if defined __x86_64__ && defined __AVX512DQ__ && !__FINITE_MATH_ONLY__
2862 return _mm512_range_ps(x, y, 5);
2863#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__
2864 return _mm512_max_ps(x, y);
2865#elif defined __x86_64__ && defined __AVX512F__
2866 return simd_bitselect(_mm512_max_ps(x, y), x, y != y);
2867#else
2868 return simd_make_float16(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi));
2869#endif
2870}
2871
2872static SIMD_CFUNC simd_double2 __tg_fmax(simd_double2 x, simd_double2 y) {
2873#if defined __AVX512DQ__ && defined __AVX512VL__
2874 return _mm_range_pd(x, y, 5);
2875#elif defined __SSE2__ && __FINITE_MATH_ONLY__
2876 return _mm_max_pd(x, y);
2877#elif defined __SSE2__
2878 return simd_bitselect(_mm_max_pd(x, y), x, y != y);
2879#elif defined __arm64__ || defined __aarch64__
2880 return vmaxnmq_f64(x, y);
2881#else
2882 return simd_bitselect(y, x, (x >= y) | (y != y));
2883#endif
2884}
2885
2886static SIMD_CFUNC simd_double3 __tg_fmax(simd_double3 x, simd_double3 y) {
2887 return simd_make_double3(__tg_fmax(simd_make_double4_undef(x), simd_make_double4_undef(y)));
2888}
2889
2890static SIMD_CFUNC simd_double4 __tg_fmax(simd_double4 x, simd_double4 y) {
2891#if defined __AVX512DQ__ && defined __AVX512VL__
2892 return _mm256_range_pd(x, y, 5);
2893#elif defined __AVX__ && __FINITE_MATH_ONLY__
2894 return _mm256_max_pd(x, y);
2895#elif defined __AVX__
2896 return simd_bitselect(_mm256_max_pd(x, y), x, y != y);
2897#else
2898 return simd_make_double4(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi));
2899#endif
2900}
2901
2902static SIMD_CFUNC simd_double8 __tg_fmax(simd_double8 x, simd_double8 y) {
2903#if defined __x86_64__ && defined __AVX512DQ__
2904 return _mm512_range_pd(x, y, 5);
2905#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__
2906 return _mm512_max_pd(x, y);
2907#elif defined __x86_64__ && defined __AVX512F__
2908 return simd_bitselect(_mm512_max_pd(x, y), x, y != y);
2909#else
2910 return simd_make_double8(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi));
2911#endif
2912}
2913
2914#pragma mark - copysign implementation
2915static inline SIMD_CFUNC simd_half2 __tg_copysign(simd_half2 x, simd_half2 y) { return simd_bitselect(y, x, 0x7fff); }
2916static inline SIMD_CFUNC simd_half3 __tg_copysign(simd_half3 x, simd_half3 y) { return simd_bitselect(y, x, 0x7fff); }
2917static inline SIMD_CFUNC simd_half4 __tg_copysign(simd_half4 x, simd_half4 y) { return simd_bitselect(y, x, 0x7fff); }
2918static inline SIMD_CFUNC simd_half8 __tg_copysign(simd_half8 x, simd_half8 y) { return simd_bitselect(y, x, 0x7fff); }
2919static inline SIMD_CFUNC simd_half16 __tg_copysign(simd_half16 x, simd_half16 y) { return simd_bitselect(y, x, 0x7fff); }
2920static inline SIMD_CFUNC simd_half32 __tg_copysign(simd_half32 x, simd_half32 y) { return simd_bitselect(y, x, 0x7fff); }
2921static inline SIMD_CFUNC simd_float2 __tg_copysign(simd_float2 x, simd_float2 y) { return simd_bitselect(y, x, 0x7fffffff); }
2922static inline SIMD_CFUNC simd_float3 __tg_copysign(simd_float3 x, simd_float3 y) { return simd_bitselect(y, x, 0x7fffffff); }
2923static inline SIMD_CFUNC simd_float4 __tg_copysign(simd_float4 x, simd_float4 y) { return simd_bitselect(y, x, 0x7fffffff); }
2924static inline SIMD_CFUNC simd_float8 __tg_copysign(simd_float8 x, simd_float8 y) { return simd_bitselect(y, x, 0x7fffffff); }
2925static inline SIMD_CFUNC simd_float16 __tg_copysign(simd_float16 x, simd_float16 y) { return simd_bitselect(y, x, 0x7fffffff); }
2926static inline SIMD_CFUNC simd_double2 __tg_copysign(simd_double2 x, simd_double2 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); }
2927static inline SIMD_CFUNC simd_double3 __tg_copysign(simd_double3 x, simd_double3 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); }
2928static inline SIMD_CFUNC simd_double4 __tg_copysign(simd_double4 x, simd_double4 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); }
2929static inline SIMD_CFUNC simd_double8 __tg_copysign(simd_double8 x, simd_double8 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); }
2930
2931#pragma mark - sqrt implementation
2932static SIMD_CFUNC simd_half2 __tg_sqrt(simd_half2 x) {
2933#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2934 return __tg_sqrt(simd_make_half4_undef(x)).lo;
2935#else
2936 return simd_make_half2(__sqrtf16(x.x), __sqrtf16(x.y));
2937#endif
2938}
2939
2940static SIMD_CFUNC simd_half3 __tg_sqrt(simd_half3 x) {
2941#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2942 return simd_make_half3(__tg_sqrt(simd_make_half4_undef(x)));
2943#else
2944 return simd_make_half3(__sqrtf16(x.x), __sqrtf16(x.y), __sqrtf16(x.z));
2945#endif
2946}
2947
2948static SIMD_CFUNC simd_half4 __tg_sqrt(simd_half4 x) {
2949#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2950 return vsqrt_f16(x);
2951#else
2952 return simd_make_half4(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
2953#endif
2954}
2955
2956static SIMD_CFUNC simd_half8 __tg_sqrt(simd_half8 x) {
2957#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
2958 return vsqrtq_f16(x);
2959#else
2960 return simd_make_half8(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
2961#endif
2962}
2963
2964static SIMD_CFUNC simd_half16 __tg_sqrt(simd_half16 x) {
2965 return simd_make_half16(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
2966}
2967
2968static SIMD_CFUNC simd_half32 __tg_sqrt(simd_half32 x) {
2969 return simd_make_half32(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
2970}
2971
2972static SIMD_CFUNC simd_float2 __tg_sqrt(simd_float2 x) {
2973#if defined __SSE2__
2974 return simd_make_float2(__tg_sqrt(simd_make_float4_undef(x)));
2975#elif defined __arm64__ || defined __aarch64__
2976 return vsqrt_f32(x);
2977#else
2978 return simd_make_float2(sqrt(x.x), sqrt(x.y));
2979#endif
2980}
2981
2982static SIMD_CFUNC simd_float3 __tg_sqrt(simd_float3 x) {
2983 return simd_make_float3(__tg_sqrt(simd_make_float4_undef(x)));
2984}
2985
2986static SIMD_CFUNC simd_float4 __tg_sqrt(simd_float4 x) {
2987#if defined __SSE2__
2988 return _mm_sqrt_ps(x);
2989#elif defined __arm64__ || defined __aarch64__
2990 return vsqrtq_f32(x);
2991#else
2992 return simd_make_float4(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
2993#endif
2994}
2995
2996static SIMD_CFUNC simd_float8 __tg_sqrt(simd_float8 x) {
2997#if defined __AVX__
2998 return _mm256_sqrt_ps(x);
2999#else
3000 return simd_make_float8(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
3001#endif
3002}
3003
3004static SIMD_CFUNC simd_float16 __tg_sqrt(simd_float16 x) {
3005#if defined __x86_64__ && defined __AVX512F__
3006 return _mm512_sqrt_ps(x);
3007#else
3008 return simd_make_float16(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
3009#endif
3010}
3011
3012static SIMD_CFUNC simd_double2 __tg_sqrt(simd_double2 x) {
3013#if defined __SSE2__
3014 return _mm_sqrt_pd(x);
3015#elif defined __arm64__ || defined __aarch64__
3016 return vsqrtq_f64(x);
3017#else
3018 return simd_make_double2(sqrt(x.x), sqrt(x.y));
3019#endif
3020}
3021
3022static SIMD_CFUNC simd_double3 __tg_sqrt(simd_double3 x) {
3023 return simd_make_double3(__tg_sqrt(simd_make_double4_undef(x)));
3024}
3025
3026static SIMD_CFUNC simd_double4 __tg_sqrt(simd_double4 x) {
3027#if defined __AVX__
3028 return _mm256_sqrt_pd(x);
3029#else
3030 return simd_make_double4(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
3031#endif
3032}
3033
3034static SIMD_CFUNC simd_double8 __tg_sqrt(simd_double8 x) {
3035#if defined __x86_64__ && defined __AVX512F__
3036 return _mm512_sqrt_pd(x);
3037#else
3038 return simd_make_double8(__tg_sqrt(x.lo), __tg_sqrt(x.hi));
3039#endif
3040}
3041
3042#pragma mark - ceil, floor, rint, trunc implementation
3043static SIMD_CFUNC simd_half2 __tg_ceil(simd_half2 x) {
3044 return simd_make_half2(__tg_ceil(simd_make_half8_undef(x)));
3045}
3046
3047static SIMD_CFUNC simd_half3 __tg_ceil(simd_half3 x) {
3048 return simd_make_half3(__tg_ceil(simd_make_half4_undef(x)));
3049}
3050
3051static SIMD_CFUNC simd_half4 __tg_ceil(simd_half4 x) {
3052#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3053 return vrndp_f16(x);
3054#else
3055 return simd_make_half4(__tg_ceil(simd_make_half8_undef(x)));
3056#endif
3057}
3058
3059static SIMD_CFUNC simd_half8 __tg_ceil(simd_half8 x) {
3060#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3061 return vrndpq_f16(x);
3062#else
3063 simd_half8 truncated = __tg_trunc(x);
3064 simd_half8 adjust = simd_bitselect((simd_half8)0, 1, truncated < x);
3065 return __tg_copysign(truncated + adjust, x);
3066#endif
3067}
3068
3069static SIMD_CFUNC simd_half16 __tg_ceil(simd_half16 x) {
3070 return simd_make_half16(__tg_ceil(x.lo), __tg_ceil(x.hi));
3071}
3072
3073static SIMD_CFUNC simd_half32 __tg_ceil(simd_half32 x) {
3074 return simd_make_half32(__tg_ceil(x.lo), __tg_ceil(x.hi));
3075}
3076
3077static SIMD_CFUNC simd_half2 __tg_floor(simd_half2 x) {
3078 return simd_make_half2(__tg_floor(simd_make_half8_undef(x)));
3079}
3080
3081static SIMD_CFUNC simd_half3 __tg_floor(simd_half3 x) {
3082 return simd_make_half3(__tg_floor(simd_make_half4_undef(x)));
3083}
3084
3085static SIMD_CFUNC simd_half4 __tg_floor(simd_half4 x) {
3086#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3087 return vrndm_f16(x);
3088#else
3089 return simd_make_half4(__tg_floor(simd_make_half8_undef(x)));
3090#endif
3091}
3092
3093static SIMD_CFUNC simd_half8 __tg_floor(simd_half8 x) {
3094#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3095 return vrndmq_f16(x);
3096#else
3097 simd_half8 truncated = __tg_trunc(x);
3098 simd_half8 adjust = simd_bitselect((simd_half8)0, 1, truncated > x);
3099 return truncated - adjust;
3100#endif
3101}
3102
3103static SIMD_CFUNC simd_half16 __tg_floor(simd_half16 x) {
3104 return simd_make_half16(__tg_floor(x.lo), __tg_floor(x.hi));
3105}
3106
3107static SIMD_CFUNC simd_half32 __tg_floor(simd_half32 x) {
3108 return simd_make_half32(__tg_floor(x.lo), __tg_floor(x.hi));
3109}
3110
3111static SIMD_CFUNC simd_half2 __tg_rint(simd_half2 x) {
3112 return simd_make_half2(__tg_rint(simd_make_half8_undef(x)));
3113}
3114
3115static SIMD_CFUNC simd_half3 __tg_rint(simd_half3 x) {
3116 return simd_make_half3(__tg_rint(simd_make_half4_undef(x)));
3117}
3118
3119static SIMD_CFUNC simd_half4 __tg_rint(simd_half4 x) {
3120#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3121 return vrndx_f16(x);
3122#else
3123 return simd_make_half4(__tg_rint(simd_make_half8_undef(x)));
3124#endif
3125}
3126
3127static SIMD_CFUNC simd_half8 __tg_rint(simd_half8 x) {
3128#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3129 return vrndxq_f16(x);
3130#else
3131 simd_half8 magic = __tg_copysign(0x1.0p10, x);
3132 simd_short8 x_is_small = __tg_fabs(x) < 0x1.0p10;
3133 return simd_bitselect(x, (x + magic) - magic, x_is_small & 0x7fff);
3134#endif
3135}
3136
3137static SIMD_CFUNC simd_half16 __tg_rint(simd_half16 x) {
3138 return simd_make_half16(__tg_rint(x.lo), __tg_rint(x.hi));
3139}
3140
3141static SIMD_CFUNC simd_half32 __tg_rint(simd_half32 x) {
3142 return simd_make_half32(__tg_rint(x.lo), __tg_rint(x.hi));
3143}
3144
3145static SIMD_CFUNC simd_half2 __tg_trunc(simd_half2 x) {
3146 return simd_make_half2(__tg_trunc(simd_make_half8_undef(x)));
3147}
3148
3149static SIMD_CFUNC simd_half3 __tg_trunc(simd_half3 x) {
3150 return simd_make_half3(__tg_trunc(simd_make_half4_undef(x)));
3151}
3152
3153static SIMD_CFUNC simd_half4 __tg_trunc(simd_half4 x) {
3154#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3155 return vrnd_f16(x);
3156#else
3157 return simd_make_half4(__tg_trunc(simd_make_half8_undef(x)));
3158#endif
3159}
3160
3161static SIMD_CFUNC simd_half8 __tg_trunc(simd_half8 x) {
3162#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
3163 return vrndq_f16(x);
3164#else
3165 simd_half8 binade = simd_bitselect(0, x, 0x3c00);
3166 simd_short8 mask = (simd_short8)__tg_fmin(-2*binade + 1, -0);
3167 simd_half8 result = simd_bitselect(0, x, mask);
3168 return simd_bitselect(x, result, binade < 0x1.0p10);
3169#endif
3170}
3171
3172static SIMD_CFUNC simd_half16 __tg_trunc(simd_half16 x) {
3173 return simd_make_half16(__tg_trunc(x.lo), __tg_trunc(x.hi));
3174}
3175
3176static SIMD_CFUNC simd_half32 __tg_trunc(simd_half32 x) {
3177 return simd_make_half32(__tg_trunc(x.lo), __tg_trunc(x.hi));
3178}
3179
3180static SIMD_CFUNC simd_float2 __tg_ceil(simd_float2 x) {
3181#if defined __arm64__ || defined __aarch64__
3182 return vrndp_f32(x);
3183#else
3184 return simd_make_float2(__tg_ceil(simd_make_float4_undef(x)));
3185#endif
3186}
3187
3188static SIMD_CFUNC simd_float3 __tg_ceil(simd_float3 x) {
3189 return simd_make_float3(__tg_ceil(simd_make_float4_undef(x)));
3190}
3191
3192#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3193extern simd_float4 _simd_ceil_f4(simd_float4 x);
3194#endif
3195
3196static SIMD_CFUNC simd_float4 __tg_ceil(simd_float4 x) {
3197#if defined __SSE4_1__
3198 return _mm_round_ps(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
3199#elif defined __arm64__ || defined __aarch64__
3200 return vrndpq_f32(x);
3201#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3202 return _simd_ceil_f4(x);
3203#else
3204 simd_float4 truncated = __tg_trunc(x);
3205 simd_float4 adjust = simd_bitselect((simd_float4)0, 1, truncated < x);
3206 return __tg_copysign(truncated + adjust, x);
3207#endif
3208}
3209
3210static SIMD_CFUNC simd_float8 __tg_ceil(simd_float8 x) {
3211#if defined __AVX__
3212 return _mm256_round_ps(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
3213#else
3214 return simd_make_float8(__tg_ceil(x.lo), __tg_ceil(x.hi));
3215#endif
3216}
3217
3218static SIMD_CFUNC simd_float16 __tg_ceil(simd_float16 x) {
3219#if defined __x86_64__ && defined __AVX512F__
3220 return _mm512_roundscale_ps(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
3221#else
3222 return simd_make_float16(__tg_ceil(x.lo), __tg_ceil(x.hi));
3223#endif
3224}
3225
3226#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3227extern simd_double2 _simd_ceil_d2(simd_double2 x);
3228#endif
3229
3230static SIMD_CFUNC simd_double2 __tg_ceil(simd_double2 x) {
3231#if defined __SSE4_1__
3232 return _mm_round_pd(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
3233#elif defined __arm64__ || defined __aarch64__
3234 return vrndpq_f64(x);
3235#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3236 return _simd_ceil_d2(x);
3237#else
3238 simd_double2 truncated = __tg_trunc(x);
3239 simd_double2 adjust = simd_bitselect((simd_double2)0, 1, truncated < x);
3240 return __tg_copysign(truncated + adjust, x);
3241#endif
3242}
3243
3244static SIMD_CFUNC simd_double3 __tg_ceil(simd_double3 x) {
3245 return simd_make_double3(__tg_ceil(simd_make_double4_undef(x)));
3246}
3247
3248static SIMD_CFUNC simd_double4 __tg_ceil(simd_double4 x) {
3249#if defined __AVX__
3250 return _mm256_round_pd(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
3251#else
3252 return simd_make_double4(__tg_ceil(x.lo), __tg_ceil(x.hi));
3253#endif
3254}
3255
3256static SIMD_CFUNC simd_double8 __tg_ceil(simd_double8 x) {
3257#if defined __x86_64__ && defined __AVX512F__
3258 return _mm512_roundscale_pd(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
3259#else
3260 return simd_make_double8(__tg_ceil(x.lo), __tg_ceil(x.hi));
3261#endif
3262}
3263
3264static SIMD_CFUNC simd_float2 __tg_floor(simd_float2 x) {
3265#if defined __arm64__ || defined __aarch64__
3266 return vrndm_f32(x);
3267#else
3268 return simd_make_float2(__tg_floor(simd_make_float4_undef(x)));
3269#endif
3270}
3271
3272static SIMD_CFUNC simd_float3 __tg_floor(simd_float3 x) {
3273 return simd_make_float3(__tg_floor(simd_make_float4_undef(x)));
3274}
3275
3276#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3277extern simd_float4 _simd_floor_f4(simd_float4 x);
3278#endif
3279
3280static SIMD_CFUNC simd_float4 __tg_floor(simd_float4 x) {
3281#if defined __SSE4_1__
3282 return _mm_round_ps(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
3283#elif defined __arm64__ || defined __aarch64__
3284 return vrndmq_f32(x);
3285#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3286 return _simd_floor_f4(x);
3287#else
3288 simd_float4 truncated = __tg_trunc(x);
3289 simd_float4 adjust = simd_bitselect((simd_float4)0, 1, truncated > x);
3290 return truncated - adjust;
3291#endif
3292}
3293
3294static SIMD_CFUNC simd_float8 __tg_floor(simd_float8 x) {
3295#if defined __AVX__
3296 return _mm256_round_ps(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
3297#else
3298 return simd_make_float8(__tg_floor(x.lo), __tg_floor(x.hi));
3299#endif
3300}
3301
3302static SIMD_CFUNC simd_float16 __tg_floor(simd_float16 x) {
3303#if defined __x86_64__ && defined __AVX512F__
3304 return _mm512_roundscale_ps(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
3305#else
3306 return simd_make_float16(__tg_floor(x.lo), __tg_floor(x.hi));
3307#endif
3308}
3309
3310#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3311extern simd_double2 _simd_floor_d2(simd_double2 x);
3312#endif
3313
3314static SIMD_CFUNC simd_double2 __tg_floor(simd_double2 x) {
3315#if defined __SSE4_1__
3316 return _mm_round_pd(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
3317#elif defined __arm64__ || defined __aarch64__
3318 return vrndmq_f64(x);
3319#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3320 return _simd_floor_d2(x);
3321#else
3322 simd_double2 truncated = __tg_trunc(x);
3323 simd_double2 adjust = simd_bitselect((simd_double2)0, 1, truncated > x);
3324 return truncated - adjust;
3325#endif
3326}
3327
3328static SIMD_CFUNC simd_double3 __tg_floor(simd_double3 x) {
3329 return simd_make_double3(__tg_floor(simd_make_double4_undef(x)));
3330}
3331
3332static SIMD_CFUNC simd_double4 __tg_floor(simd_double4 x) {
3333#if defined __AVX__
3334 return _mm256_round_pd(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
3335#else
3336 return simd_make_double4(__tg_floor(x.lo), __tg_floor(x.hi));
3337#endif
3338}
3339
3340static SIMD_CFUNC simd_double8 __tg_floor(simd_double8 x) {
3341#if defined __x86_64__ && defined __AVX512F__
3342 return _mm512_roundscale_pd(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
3343#else
3344 return simd_make_double8(__tg_floor(x.lo), __tg_floor(x.hi));
3345#endif
3346}
3347
3348static SIMD_CFUNC simd_float2 __tg_rint(simd_float2 x) {
3349#if defined __arm64__ || defined __aarch64__
3350 return vrndx_f32(x);
3351#else
3352 return simd_make_float2(__tg_rint(simd_make_float4_undef(x)));
3353#endif
3354}
3355
3356static SIMD_CFUNC simd_float3 __tg_rint(simd_float3 x) {
3357 return simd_make_float3(__tg_rint(simd_make_float4_undef(x)));
3358}
3359
3360#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3361extern simd_float4 _simd_rint_f4(simd_float4 x);
3362#endif
3363
3364static SIMD_CFUNC simd_float4 __tg_rint(simd_float4 x) {
3365#if defined __SSE4_1__
3366 return _mm_round_ps(x, _MM_FROUND_RINT);
3367#elif defined __arm64__ || defined __aarch64__
3368 return vrndxq_f32(x);
3369#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3370 return _simd_rint_f4(x);
3371#else
3372 simd_float4 magic = __tg_copysign(0x1.0p23, x);
3373 simd_int4 x_is_small = __tg_fabs(x) < 0x1.0p23;
3374 return simd_bitselect(x, (x + magic) - magic, x_is_small & 0x7fffffff);
3375#endif
3376}
3377
3378static SIMD_CFUNC simd_float8 __tg_rint(simd_float8 x) {
3379#if defined __AVX__
3380 return _mm256_round_ps(x, _MM_FROUND_RINT);
3381#else
3382 return simd_make_float8(__tg_rint(x.lo), __tg_rint(x.hi));
3383#endif
3384}
3385
3386static SIMD_CFUNC simd_float16 __tg_rint(simd_float16 x) {
3387#if defined __x86_64__ && defined __AVX512F__
3388 return _mm512_roundscale_ps(x, _MM_FROUND_RINT);
3389#else
3390 return simd_make_float16(__tg_rint(x.lo), __tg_rint(x.hi));
3391#endif
3392}
3393
3394#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3395extern simd_double2 _simd_rint_d2(simd_double2 x);
3396#endif
3397
3398static SIMD_CFUNC simd_double2 __tg_rint(simd_double2 x) {
3399#if defined __SSE4_1__
3400 return _mm_round_pd(x, _MM_FROUND_RINT);
3401#elif defined __arm64__ || defined __aarch64__
3402 return vrndxq_f64(x);
3403#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3404 return _simd_rint_d2(x);
3405#else
3406 simd_double2 magic = __tg_copysign(0x1.0p52, x);
3407 simd_long2 x_is_small = __tg_fabs(x) < 0x1.0p52;
3408 return simd_bitselect(x, (x + magic) - magic, x_is_small & 0x7fffffffffffffff);
3409#endif
3410}
3411
3412static SIMD_CFUNC simd_double3 __tg_rint(simd_double3 x) {
3413 return simd_make_double3(__tg_rint(simd_make_double4_undef(x)));
3414}
3415
3416static SIMD_CFUNC simd_double4 __tg_rint(simd_double4 x) {
3417#if defined __AVX__
3418 return _mm256_round_pd(x, _MM_FROUND_RINT);
3419#else
3420 return simd_make_double4(__tg_rint(x.lo), __tg_rint(x.hi));
3421#endif
3422}
3423
3424static SIMD_CFUNC simd_double8 __tg_rint(simd_double8 x) {
3425#if defined __x86_64__ && defined __AVX512F__
3426 return _mm512_roundscale_pd(x, _MM_FROUND_RINT);
3427#else
3428 return simd_make_double8(__tg_rint(x.lo), __tg_rint(x.hi));
3429#endif
3430}
3431
3432static SIMD_CFUNC simd_float2 __tg_trunc(simd_float2 x) {
3433#if defined __arm64__ || defined __aarch64__
3434 return vrnd_f32(x);
3435#else
3436 return simd_make_float2(__tg_trunc(simd_make_float4_undef(x)));
3437#endif
3438}
3439
3440static SIMD_CFUNC simd_float3 __tg_trunc(simd_float3 x) {
3441 return simd_make_float3(__tg_trunc(simd_make_float4_undef(x)));
3442}
3443
3444#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3445extern simd_float4 _simd_trunc_f4(simd_float4 x);
3446#endif
3447
3448static SIMD_CFUNC simd_float4 __tg_trunc(simd_float4 x) {
3449#if defined __SSE4_1__
3450 return _mm_round_ps(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
3451#elif defined __arm64__ || defined __aarch64__
3452 return vrndq_f32(x);
3453#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3454 return _simd_trunc_f4(x);
3455#else
3456 simd_float4 binade = simd_bitselect(0, x, 0x7f800000);
3457 simd_int4 mask = (simd_int4)__tg_fmin(-2*binade + 1, -0);
3458 simd_float4 result = simd_bitselect(0, x, mask);
3459 return simd_bitselect(x, result, binade < 0x1.0p23);
3460#endif
3461}
3462
3463static SIMD_CFUNC simd_float8 __tg_trunc(simd_float8 x) {
3464#if defined __AVX__
3465 return _mm256_round_ps(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
3466#else
3467 return simd_make_float8(__tg_trunc(x.lo), __tg_trunc(x.hi));
3468#endif
3469}
3470
3471static SIMD_CFUNC simd_float16 __tg_trunc(simd_float16 x) {
3472#if defined __x86_64__ && defined __AVX512F__
3473 return _mm512_roundscale_ps(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
3474#else
3475 return simd_make_float16(__tg_trunc(x.lo), __tg_trunc(x.hi));
3476#endif
3477}
3478
3479#if defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3480extern simd_double2 _simd_trunc_d2(simd_double2 x);
3481#endif
3482
3483static SIMD_CFUNC simd_double2 __tg_trunc(simd_double2 x) {
3484#if defined __SSE4_1__
3485 return _mm_round_pd(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
3486#elif defined __arm64__ || defined __aarch64__
3487 return vrndq_f64(x);
3488#elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3
3489 return _simd_trunc_d2(x);
3490#else
3491 simd_double2 binade = simd_bitselect(0, x, 0x7ff0000000000000);
3492 simd_long2 mask = (simd_long2)__tg_fmin(-2*binade + 1, -0);
3493 simd_double2 result = simd_bitselect(0, x, mask);
3494 return simd_bitselect(x, result, binade < 0x1.0p52);
3495#endif
3496}
3497
3498static SIMD_CFUNC simd_double3 __tg_trunc(simd_double3 x) {
3499 return simd_make_double3(__tg_trunc(simd_make_double4_undef(x)));
3500}
3501
3502static SIMD_CFUNC simd_double4 __tg_trunc(simd_double4 x) {
3503#if defined __AVX__
3504 return _mm256_round_pd(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
3505#else
3506 return simd_make_double4(__tg_trunc(x.lo), __tg_trunc(x.hi));
3507#endif
3508}
3509
3510static SIMD_CFUNC simd_double8 __tg_trunc(simd_double8 x) {
3511#if defined __x86_64__ && defined __AVX512F__
3512 return _mm512_roundscale_pd(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
3513#else
3514 return simd_make_double8(__tg_trunc(x.lo), __tg_trunc(x.hi));
3515#endif
3516}
3517
3518#pragma mark - sine, cosine implementation
3519static inline SIMD_CFUNC simd_float2 __tg_sin(simd_float2 x) {
3520 return simd_make_float2(__tg_sin(simd_make_float4(x)));
3521}
3522
3523static inline SIMD_CFUNC simd_float3 __tg_sin(simd_float3 x) {
3524 return simd_make_float3(__tg_sin(simd_make_float4(x)));
3525}
3526
3527#if SIMD_LIBRARY_VERSION >= 3
3528extern simd_float4 _simd_sin_f4(simd_float4 x);
3529static inline SIMD_CFUNC simd_float4 __tg_sin(simd_float4 x) {
3530 return _simd_sin_f4(x);
3531}
3532#elif SIMD_LIBRARY_VERSION == 1
3533extern simd_float4 __sin_f4(simd_float4 x);
3534static inline SIMD_CFUNC simd_float4 __tg_sin(simd_float4 x) {
3535 return __sin_f4(x);
3536}
3537#else
3538static inline SIMD_CFUNC simd_float4 __tg_sin(simd_float4 x) {
3539 return simd_make_float4(sin(x.x), sin(x.y), sin(x.z), sin(x.w));
3540}
3541#endif
3542
3543#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3544extern simd_float8 _simd_sin_f8(simd_float8 x);
3545static inline SIMD_CFUNC simd_float8 __tg_sin(simd_float8 x) {
3546 return _simd_sin_f8(x);
3547}
3548#else
3549static inline SIMD_CFUNC simd_float8 __tg_sin(simd_float8 x) {
3550 return simd_make_float8(__tg_sin(x.lo), __tg_sin(x.hi));
3551}
3552#endif
3553
3554#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3555extern simd_float16 _simd_sin_f16(simd_float16 x);
3556static inline SIMD_CFUNC simd_float16 __tg_sin(simd_float16 x) {
3557 return _simd_sin_f16(x);
3558}
3559#else
3560static inline SIMD_CFUNC simd_float16 __tg_sin(simd_float16 x) {
3561 return simd_make_float16(__tg_sin(x.lo), __tg_sin(x.hi));
3562}
3563#endif
3564
3565#if SIMD_LIBRARY_VERSION >= 3
3566extern simd_double2 _simd_sin_d2(simd_double2 x);
3567static inline SIMD_CFUNC simd_double2 __tg_sin(simd_double2 x) {
3568 return _simd_sin_d2(x);
3569}
3570#elif SIMD_LIBRARY_VERSION == 1
3571extern simd_double2 __sin_d2(simd_double2 x);
3572static inline SIMD_CFUNC simd_double2 __tg_sin(simd_double2 x) {
3573 return __sin_d2(x);
3574}
3575#else
3576static inline SIMD_CFUNC simd_double2 __tg_sin(simd_double2 x) {
3577 return simd_make_double2(sin(x.x), sin(x.y));
3578}
3579#endif
3580
3581static inline SIMD_CFUNC simd_double3 __tg_sin(simd_double3 x) {
3582 return simd_make_double3(__tg_sin(simd_make_double4(x)));
3583}
3584
3585#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3586extern simd_double4 _simd_sin_d4(simd_double4 x);
3587static inline SIMD_CFUNC simd_double4 __tg_sin(simd_double4 x) {
3588 return _simd_sin_d4(x);
3589}
3590#else
3591static inline SIMD_CFUNC simd_double4 __tg_sin(simd_double4 x) {
3592 return simd_make_double4(__tg_sin(x.lo), __tg_sin(x.hi));
3593}
3594#endif
3595
3596#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3597extern simd_double8 _simd_sin_d8(simd_double8 x);
3598static inline SIMD_CFUNC simd_double8 __tg_sin(simd_double8 x) {
3599 return _simd_sin_d8(x);
3600}
3601#else
3602static inline SIMD_CFUNC simd_double8 __tg_sin(simd_double8 x) {
3603 return simd_make_double8(__tg_sin(x.lo), __tg_sin(x.hi));
3604}
3605#endif
3606
3607static inline SIMD_CFUNC simd_float2 __tg_cos(simd_float2 x) {
3608 return simd_make_float2(__tg_cos(simd_make_float4(x)));
3609}
3610
3611static inline SIMD_CFUNC simd_float3 __tg_cos(simd_float3 x) {
3612 return simd_make_float3(__tg_cos(simd_make_float4(x)));
3613}
3614
3615#if SIMD_LIBRARY_VERSION >= 3
3616extern simd_float4 _simd_cos_f4(simd_float4 x);
3617static inline SIMD_CFUNC simd_float4 __tg_cos(simd_float4 x) {
3618 return _simd_cos_f4(x);
3619}
3620#elif SIMD_LIBRARY_VERSION == 1
3621extern simd_float4 __cos_f4(simd_float4 x);
3622static inline SIMD_CFUNC simd_float4 __tg_cos(simd_float4 x) {
3623 return __cos_f4(x);
3624}
3625#else
3626static inline SIMD_CFUNC simd_float4 __tg_cos(simd_float4 x) {
3627 return simd_make_float4(cos(x.x), cos(x.y), cos(x.z), cos(x.w));
3628}
3629#endif
3630
3631#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3632extern simd_float8 _simd_cos_f8(simd_float8 x);
3633static inline SIMD_CFUNC simd_float8 __tg_cos(simd_float8 x) {
3634 return _simd_cos_f8(x);
3635}
3636#else
3637static inline SIMD_CFUNC simd_float8 __tg_cos(simd_float8 x) {
3638 return simd_make_float8(__tg_cos(x.lo), __tg_cos(x.hi));
3639}
3640#endif
3641
3642#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3643extern simd_float16 _simd_cos_f16(simd_float16 x);
3644static inline SIMD_CFUNC simd_float16 __tg_cos(simd_float16 x) {
3645 return _simd_cos_f16(x);
3646}
3647#else
3648static inline SIMD_CFUNC simd_float16 __tg_cos(simd_float16 x) {
3649 return simd_make_float16(__tg_cos(x.lo), __tg_cos(x.hi));
3650}
3651#endif
3652
3653#if SIMD_LIBRARY_VERSION >= 3
3654extern simd_double2 _simd_cos_d2(simd_double2 x);
3655static inline SIMD_CFUNC simd_double2 __tg_cos(simd_double2 x) {
3656 return _simd_cos_d2(x);
3657}
3658#elif SIMD_LIBRARY_VERSION == 1
3659extern simd_double2 __cos_d2(simd_double2 x);
3660static inline SIMD_CFUNC simd_double2 __tg_cos(simd_double2 x) {
3661 return __cos_d2(x);
3662}
3663#else
3664static inline SIMD_CFUNC simd_double2 __tg_cos(simd_double2 x) {
3665 return simd_make_double2(cos(x.x), cos(x.y));
3666}
3667#endif
3668
3669static inline SIMD_CFUNC simd_double3 __tg_cos(simd_double3 x) {
3670 return simd_make_double3(__tg_cos(simd_make_double4(x)));
3671}
3672
3673#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3674extern simd_double4 _simd_cos_d4(simd_double4 x);
3675static inline SIMD_CFUNC simd_double4 __tg_cos(simd_double4 x) {
3676 return _simd_cos_d4(x);
3677}
3678#else
3679static inline SIMD_CFUNC simd_double4 __tg_cos(simd_double4 x) {
3680 return simd_make_double4(__tg_cos(x.lo), __tg_cos(x.hi));
3681}
3682#endif
3683
3684#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3685extern simd_double8 _simd_cos_d8(simd_double8 x);
3686static inline SIMD_CFUNC simd_double8 __tg_cos(simd_double8 x) {
3687 return _simd_cos_d8(x);
3688}
3689#else
3690static inline SIMD_CFUNC simd_double8 __tg_cos(simd_double8 x) {
3691 return simd_make_double8(__tg_cos(x.lo), __tg_cos(x.hi));
3692}
3693#endif
3694
3695
3696#pragma mark - acos implementation
3697static inline SIMD_CFUNC simd_float2 __tg_acos(simd_float2 x) {
3698 return simd_make_float2(__tg_acos(simd_make_float4(x)));
3699}
3700
3701static inline SIMD_CFUNC simd_float3 __tg_acos(simd_float3 x) {
3702 return simd_make_float3(__tg_acos(simd_make_float4(x)));
3703}
3704
3705#if SIMD_LIBRARY_VERSION >= 3
3706extern simd_float4 _simd_acos_f4(simd_float4 x);
3707static inline SIMD_CFUNC simd_float4 __tg_acos(simd_float4 x) {
3708 return _simd_acos_f4(x);
3709}
3710#else
3711static inline SIMD_CFUNC simd_float4 __tg_acos(simd_float4 x) {
3712 return simd_make_float4(acos(x.x), acos(x.y), acos(x.z), acos(x.w));
3713}
3714#endif
3715
3716#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3717extern simd_float8 _simd_acos_f8(simd_float8 x);
3718static inline SIMD_CFUNC simd_float8 __tg_acos(simd_float8 x) {
3719 return _simd_acos_f8(x);
3720}
3721#else
3722static inline SIMD_CFUNC simd_float8 __tg_acos(simd_float8 x) {
3723 return simd_make_float8(__tg_acos(x.lo), __tg_acos(x.hi));
3724}
3725#endif
3726
3727#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3728extern simd_float16 _simd_acos_f16(simd_float16 x);
3729static inline SIMD_CFUNC simd_float16 __tg_acos(simd_float16 x) {
3730 return _simd_acos_f16(x);
3731}
3732#else
3733static inline SIMD_CFUNC simd_float16 __tg_acos(simd_float16 x) {
3734 return simd_make_float16(__tg_acos(x.lo), __tg_acos(x.hi));
3735}
3736#endif
3737
3738#if SIMD_LIBRARY_VERSION >= 3
3739extern simd_double2 _simd_acos_d2(simd_double2 x);
3740static inline SIMD_CFUNC simd_double2 __tg_acos(simd_double2 x) {
3741 return _simd_acos_d2(x);
3742}
3743#else
3744static inline SIMD_CFUNC simd_double2 __tg_acos(simd_double2 x) {
3745 return simd_make_double2(acos(x.x), acos(x.y));
3746}
3747#endif
3748
3749static inline SIMD_CFUNC simd_double3 __tg_acos(simd_double3 x) {
3750 return simd_make_double3(__tg_acos(simd_make_double4(x)));
3751}
3752
3753#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3754extern simd_double4 _simd_acos_d4(simd_double4 x);
3755static inline SIMD_CFUNC simd_double4 __tg_acos(simd_double4 x) {
3756 return _simd_acos_d4(x);
3757}
3758#else
3759static inline SIMD_CFUNC simd_double4 __tg_acos(simd_double4 x) {
3760 return simd_make_double4(__tg_acos(x.lo), __tg_acos(x.hi));
3761}
3762#endif
3763
3764#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3765extern simd_double8 _simd_acos_d8(simd_double8 x);
3766static inline SIMD_CFUNC simd_double8 __tg_acos(simd_double8 x) {
3767 return _simd_acos_d8(x);
3768}
3769#else
3770static inline SIMD_CFUNC simd_double8 __tg_acos(simd_double8 x) {
3771 return simd_make_double8(__tg_acos(x.lo), __tg_acos(x.hi));
3772}
3773#endif
3774
3775#pragma mark - asin implementation
3776static inline SIMD_CFUNC simd_float2 __tg_asin(simd_float2 x) {
3777 return simd_make_float2(__tg_asin(simd_make_float4(x)));
3778}
3779
3780static inline SIMD_CFUNC simd_float3 __tg_asin(simd_float3 x) {
3781 return simd_make_float3(__tg_asin(simd_make_float4(x)));
3782}
3783
3784#if SIMD_LIBRARY_VERSION >= 3
3785extern simd_float4 _simd_asin_f4(simd_float4 x);
3786static inline SIMD_CFUNC simd_float4 __tg_asin(simd_float4 x) {
3787 return _simd_asin_f4(x);
3788}
3789#else
3790static inline SIMD_CFUNC simd_float4 __tg_asin(simd_float4 x) {
3791 return simd_make_float4(asin(x.x), asin(x.y), asin(x.z), asin(x.w));
3792}
3793#endif
3794
3795#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3796extern simd_float8 _simd_asin_f8(simd_float8 x);
3797static inline SIMD_CFUNC simd_float8 __tg_asin(simd_float8 x) {
3798 return _simd_asin_f8(x);
3799}
3800#else
3801static inline SIMD_CFUNC simd_float8 __tg_asin(simd_float8 x) {
3802 return simd_make_float8(__tg_asin(x.lo), __tg_asin(x.hi));
3803}
3804#endif
3805
3806#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3807extern simd_float16 _simd_asin_f16(simd_float16 x);
3808static inline SIMD_CFUNC simd_float16 __tg_asin(simd_float16 x) {
3809 return _simd_asin_f16(x);
3810}
3811#else
3812static inline SIMD_CFUNC simd_float16 __tg_asin(simd_float16 x) {
3813 return simd_make_float16(__tg_asin(x.lo), __tg_asin(x.hi));
3814}
3815#endif
3816
3817#if SIMD_LIBRARY_VERSION >= 3
3818extern simd_double2 _simd_asin_d2(simd_double2 x);
3819static inline SIMD_CFUNC simd_double2 __tg_asin(simd_double2 x) {
3820 return _simd_asin_d2(x);
3821}
3822#else
3823static inline SIMD_CFUNC simd_double2 __tg_asin(simd_double2 x) {
3824 return simd_make_double2(asin(x.x), asin(x.y));
3825}
3826#endif
3827
3828static inline SIMD_CFUNC simd_double3 __tg_asin(simd_double3 x) {
3829 return simd_make_double3(__tg_asin(simd_make_double4(x)));
3830}
3831
3832#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3833extern simd_double4 _simd_asin_d4(simd_double4 x);
3834static inline SIMD_CFUNC simd_double4 __tg_asin(simd_double4 x) {
3835 return _simd_asin_d4(x);
3836}
3837#else
3838static inline SIMD_CFUNC simd_double4 __tg_asin(simd_double4 x) {
3839 return simd_make_double4(__tg_asin(x.lo), __tg_asin(x.hi));
3840}
3841#endif
3842
3843#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3844extern simd_double8 _simd_asin_d8(simd_double8 x);
3845static inline SIMD_CFUNC simd_double8 __tg_asin(simd_double8 x) {
3846 return _simd_asin_d8(x);
3847}
3848#else
3849static inline SIMD_CFUNC simd_double8 __tg_asin(simd_double8 x) {
3850 return simd_make_double8(__tg_asin(x.lo), __tg_asin(x.hi));
3851}
3852#endif
3853
3854#pragma mark - atan implementation
3855static inline SIMD_CFUNC simd_float2 __tg_atan(simd_float2 x) {
3856 return simd_make_float2(__tg_atan(simd_make_float4(x)));
3857}
3858
3859static inline SIMD_CFUNC simd_float3 __tg_atan(simd_float3 x) {
3860 return simd_make_float3(__tg_atan(simd_make_float4(x)));
3861}
3862
3863#if SIMD_LIBRARY_VERSION >= 3
3864extern simd_float4 _simd_atan_f4(simd_float4 x);
3865static inline SIMD_CFUNC simd_float4 __tg_atan(simd_float4 x) {
3866 return _simd_atan_f4(x);
3867}
3868#else
3869static inline SIMD_CFUNC simd_float4 __tg_atan(simd_float4 x) {
3870 return simd_make_float4(atan(x.x), atan(x.y), atan(x.z), atan(x.w));
3871}
3872#endif
3873
3874#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3875extern simd_float8 _simd_atan_f8(simd_float8 x);
3876static inline SIMD_CFUNC simd_float8 __tg_atan(simd_float8 x) {
3877 return _simd_atan_f8(x);
3878}
3879#else
3880static inline SIMD_CFUNC simd_float8 __tg_atan(simd_float8 x) {
3881 return simd_make_float8(__tg_atan(x.lo), __tg_atan(x.hi));
3882}
3883#endif
3884
3885#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3886extern simd_float16 _simd_atan_f16(simd_float16 x);
3887static inline SIMD_CFUNC simd_float16 __tg_atan(simd_float16 x) {
3888 return _simd_atan_f16(x);
3889}
3890#else
3891static inline SIMD_CFUNC simd_float16 __tg_atan(simd_float16 x) {
3892 return simd_make_float16(__tg_atan(x.lo), __tg_atan(x.hi));
3893}
3894#endif
3895
3896#if SIMD_LIBRARY_VERSION >= 3
3897extern simd_double2 _simd_atan_d2(simd_double2 x);
3898static inline SIMD_CFUNC simd_double2 __tg_atan(simd_double2 x) {
3899 return _simd_atan_d2(x);
3900}
3901#else
3902static inline SIMD_CFUNC simd_double2 __tg_atan(simd_double2 x) {
3903 return simd_make_double2(atan(x.x), atan(x.y));
3904}
3905#endif
3906
3907static inline SIMD_CFUNC simd_double3 __tg_atan(simd_double3 x) {
3908 return simd_make_double3(__tg_atan(simd_make_double4(x)));
3909}
3910
3911#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3912extern simd_double4 _simd_atan_d4(simd_double4 x);
3913static inline SIMD_CFUNC simd_double4 __tg_atan(simd_double4 x) {
3914 return _simd_atan_d4(x);
3915}
3916#else
3917static inline SIMD_CFUNC simd_double4 __tg_atan(simd_double4 x) {
3918 return simd_make_double4(__tg_atan(x.lo), __tg_atan(x.hi));
3919}
3920#endif
3921
3922#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3923extern simd_double8 _simd_atan_d8(simd_double8 x);
3924static inline SIMD_CFUNC simd_double8 __tg_atan(simd_double8 x) {
3925 return _simd_atan_d8(x);
3926}
3927#else
3928static inline SIMD_CFUNC simd_double8 __tg_atan(simd_double8 x) {
3929 return simd_make_double8(__tg_atan(x.lo), __tg_atan(x.hi));
3930}
3931#endif
3932
3933#pragma mark - tan implementation
3934static inline SIMD_CFUNC simd_float2 __tg_tan(simd_float2 x) {
3935 return simd_make_float2(__tg_tan(simd_make_float4(x)));
3936}
3937
3938static inline SIMD_CFUNC simd_float3 __tg_tan(simd_float3 x) {
3939 return simd_make_float3(__tg_tan(simd_make_float4(x)));
3940}
3941
3942#if SIMD_LIBRARY_VERSION >= 3
3943extern simd_float4 _simd_tan_f4(simd_float4 x);
3944static inline SIMD_CFUNC simd_float4 __tg_tan(simd_float4 x) {
3945 return _simd_tan_f4(x);
3946}
3947#else
3948static inline SIMD_CFUNC simd_float4 __tg_tan(simd_float4 x) {
3949 return simd_make_float4(tan(x.x), tan(x.y), tan(x.z), tan(x.w));
3950}
3951#endif
3952
3953#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3954extern simd_float8 _simd_tan_f8(simd_float8 x);
3955static inline SIMD_CFUNC simd_float8 __tg_tan(simd_float8 x) {
3956 return _simd_tan_f8(x);
3957}
3958#else
3959static inline SIMD_CFUNC simd_float8 __tg_tan(simd_float8 x) {
3960 return simd_make_float8(__tg_tan(x.lo), __tg_tan(x.hi));
3961}
3962#endif
3963
3964#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
3965extern simd_float16 _simd_tan_f16(simd_float16 x);
3966static inline SIMD_CFUNC simd_float16 __tg_tan(simd_float16 x) {
3967 return _simd_tan_f16(x);
3968}
3969#else
3970static inline SIMD_CFUNC simd_float16 __tg_tan(simd_float16 x) {
3971 return simd_make_float16(__tg_tan(x.lo), __tg_tan(x.hi));
3972}
3973#endif
3974
3975#if SIMD_LIBRARY_VERSION >= 3
3976extern simd_double2 _simd_tan_d2(simd_double2 x);
3977static inline SIMD_CFUNC simd_double2 __tg_tan(simd_double2 x) {
3978 return _simd_tan_d2(x);
3979}
3980#else
3981static inline SIMD_CFUNC simd_double2 __tg_tan(simd_double2 x) {
3982 return simd_make_double2(tan(x.x), tan(x.y));
3983}
3984#endif
3985
3986static inline SIMD_CFUNC simd_double3 __tg_tan(simd_double3 x) {
3987 return simd_make_double3(__tg_tan(simd_make_double4(x)));
3988}
3989
3990#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
3991extern simd_double4 _simd_tan_d4(simd_double4 x);
3992static inline SIMD_CFUNC simd_double4 __tg_tan(simd_double4 x) {
3993 return _simd_tan_d4(x);
3994}
3995#else
3996static inline SIMD_CFUNC simd_double4 __tg_tan(simd_double4 x) {
3997 return simd_make_double4(__tg_tan(x.lo), __tg_tan(x.hi));
3998}
3999#endif
4000
4001#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4002extern simd_double8 _simd_tan_d8(simd_double8 x);
4003static inline SIMD_CFUNC simd_double8 __tg_tan(simd_double8 x) {
4004 return _simd_tan_d8(x);
4005}
4006#else
4007static inline SIMD_CFUNC simd_double8 __tg_tan(simd_double8 x) {
4008 return simd_make_double8(__tg_tan(x.lo), __tg_tan(x.hi));
4009}
4010#endif
4011
4012#pragma mark - cospi implementation
4013#if SIMD_LIBRARY_VERSION >= 1
4014static inline SIMD_CFUNC simd_float2 __tg_cospi(simd_float2 x) {
4015 return simd_make_float2(__tg_cospi(simd_make_float4(x)));
4016}
4017
4018static inline SIMD_CFUNC simd_float3 __tg_cospi(simd_float3 x) {
4019 return simd_make_float3(__tg_cospi(simd_make_float4(x)));
4020}
4021
4022#if SIMD_LIBRARY_VERSION >= 3
4023extern simd_float4 _simd_cospi_f4(simd_float4 x);
4024static inline SIMD_CFUNC simd_float4 __tg_cospi(simd_float4 x) {
4025 return _simd_cospi_f4(x);
4026}
4027#else
4028static inline SIMD_CFUNC simd_float4 __tg_cospi(simd_float4 x) {
4029 return simd_make_float4(__cospi(x.x), __cospi(x.y), __cospi(x.z), __cospi(x.w));
4030}
4031#endif
4032
4033#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4034extern simd_float8 _simd_cospi_f8(simd_float8 x);
4035static inline SIMD_CFUNC simd_float8 __tg_cospi(simd_float8 x) {
4036 return _simd_cospi_f8(x);
4037}
4038#else
4039static inline SIMD_CFUNC simd_float8 __tg_cospi(simd_float8 x) {
4040 return simd_make_float8(__tg_cospi(x.lo), __tg_cospi(x.hi));
4041}
4042#endif
4043
4044#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4045extern simd_float16 _simd_cospi_f16(simd_float16 x);
4046static inline SIMD_CFUNC simd_float16 __tg_cospi(simd_float16 x) {
4047 return _simd_cospi_f16(x);
4048}
4049#else
4050static inline SIMD_CFUNC simd_float16 __tg_cospi(simd_float16 x) {
4051 return simd_make_float16(__tg_cospi(x.lo), __tg_cospi(x.hi));
4052}
4053#endif
4054
4055#if SIMD_LIBRARY_VERSION >= 3
4056extern simd_double2 _simd_cospi_d2(simd_double2 x);
4057static inline SIMD_CFUNC simd_double2 __tg_cospi(simd_double2 x) {
4058 return _simd_cospi_d2(x);
4059}
4060#else
4061static inline SIMD_CFUNC simd_double2 __tg_cospi(simd_double2 x) {
4062 return simd_make_double2(__cospi(x.x), __cospi(x.y));
4063}
4064#endif
4065
4066static inline SIMD_CFUNC simd_double3 __tg_cospi(simd_double3 x) {
4067 return simd_make_double3(__tg_cospi(simd_make_double4(x)));
4068}
4069
4070#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4071extern simd_double4 _simd_cospi_d4(simd_double4 x);
4072static inline SIMD_CFUNC simd_double4 __tg_cospi(simd_double4 x) {
4073 return _simd_cospi_d4(x);
4074}
4075#else
4076static inline SIMD_CFUNC simd_double4 __tg_cospi(simd_double4 x) {
4077 return simd_make_double4(__tg_cospi(x.lo), __tg_cospi(x.hi));
4078}
4079#endif
4080
4081#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4082extern simd_double8 _simd_cospi_d8(simd_double8 x);
4083static inline SIMD_CFUNC simd_double8 __tg_cospi(simd_double8 x) {
4084 return _simd_cospi_d8(x);
4085}
4086#else
4087static inline SIMD_CFUNC simd_double8 __tg_cospi(simd_double8 x) {
4088 return simd_make_double8(__tg_cospi(x.lo), __tg_cospi(x.hi));
4089}
4090#endif
4091
4092#endif /* SIMD_LIBRARY_VERSION */
4093#pragma mark - sinpi implementation
4094#if SIMD_LIBRARY_VERSION >= 1
4095static inline SIMD_CFUNC simd_float2 __tg_sinpi(simd_float2 x) {
4096 return simd_make_float2(__tg_sinpi(simd_make_float4(x)));
4097}
4098
4099static inline SIMD_CFUNC simd_float3 __tg_sinpi(simd_float3 x) {
4100 return simd_make_float3(__tg_sinpi(simd_make_float4(x)));
4101}
4102
4103#if SIMD_LIBRARY_VERSION >= 3
4104extern simd_float4 _simd_sinpi_f4(simd_float4 x);
4105static inline SIMD_CFUNC simd_float4 __tg_sinpi(simd_float4 x) {
4106 return _simd_sinpi_f4(x);
4107}
4108#else
4109static inline SIMD_CFUNC simd_float4 __tg_sinpi(simd_float4 x) {
4110 return simd_make_float4(__sinpi(x.x), __sinpi(x.y), __sinpi(x.z), __sinpi(x.w));
4111}
4112#endif
4113
4114#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4115extern simd_float8 _simd_sinpi_f8(simd_float8 x);
4116static inline SIMD_CFUNC simd_float8 __tg_sinpi(simd_float8 x) {
4117 return _simd_sinpi_f8(x);
4118}
4119#else
4120static inline SIMD_CFUNC simd_float8 __tg_sinpi(simd_float8 x) {
4121 return simd_make_float8(__tg_sinpi(x.lo), __tg_sinpi(x.hi));
4122}
4123#endif
4124
4125#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4126extern simd_float16 _simd_sinpi_f16(simd_float16 x);
4127static inline SIMD_CFUNC simd_float16 __tg_sinpi(simd_float16 x) {
4128 return _simd_sinpi_f16(x);
4129}
4130#else
4131static inline SIMD_CFUNC simd_float16 __tg_sinpi(simd_float16 x) {
4132 return simd_make_float16(__tg_sinpi(x.lo), __tg_sinpi(x.hi));
4133}
4134#endif
4135
4136#if SIMD_LIBRARY_VERSION >= 3
4137extern simd_double2 _simd_sinpi_d2(simd_double2 x);
4138static inline SIMD_CFUNC simd_double2 __tg_sinpi(simd_double2 x) {
4139 return _simd_sinpi_d2(x);
4140}
4141#else
4142static inline SIMD_CFUNC simd_double2 __tg_sinpi(simd_double2 x) {
4143 return simd_make_double2(__sinpi(x.x), __sinpi(x.y));
4144}
4145#endif
4146
4147static inline SIMD_CFUNC simd_double3 __tg_sinpi(simd_double3 x) {
4148 return simd_make_double3(__tg_sinpi(simd_make_double4(x)));
4149}
4150
4151#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4152extern simd_double4 _simd_sinpi_d4(simd_double4 x);
4153static inline SIMD_CFUNC simd_double4 __tg_sinpi(simd_double4 x) {
4154 return _simd_sinpi_d4(x);
4155}
4156#else
4157static inline SIMD_CFUNC simd_double4 __tg_sinpi(simd_double4 x) {
4158 return simd_make_double4(__tg_sinpi(x.lo), __tg_sinpi(x.hi));
4159}
4160#endif
4161
4162#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4163extern simd_double8 _simd_sinpi_d8(simd_double8 x);
4164static inline SIMD_CFUNC simd_double8 __tg_sinpi(simd_double8 x) {
4165 return _simd_sinpi_d8(x);
4166}
4167#else
4168static inline SIMD_CFUNC simd_double8 __tg_sinpi(simd_double8 x) {
4169 return simd_make_double8(__tg_sinpi(x.lo), __tg_sinpi(x.hi));
4170}
4171#endif
4172
4173#endif /* SIMD_LIBRARY_VERSION */
4174#pragma mark - tanpi implementation
4175#if SIMD_LIBRARY_VERSION >= 1
4176static inline SIMD_CFUNC simd_float2 __tg_tanpi(simd_float2 x) {
4177 return simd_make_float2(__tg_tanpi(simd_make_float4(x)));
4178}
4179
4180static inline SIMD_CFUNC simd_float3 __tg_tanpi(simd_float3 x) {
4181 return simd_make_float3(__tg_tanpi(simd_make_float4(x)));
4182}
4183
4184#if SIMD_LIBRARY_VERSION >= 3
4185extern simd_float4 _simd_tanpi_f4(simd_float4 x);
4186static inline SIMD_CFUNC simd_float4 __tg_tanpi(simd_float4 x) {
4187 return _simd_tanpi_f4(x);
4188}
4189#else
4190static inline SIMD_CFUNC simd_float4 __tg_tanpi(simd_float4 x) {
4191 return simd_make_float4(__tanpi(x.x), __tanpi(x.y), __tanpi(x.z), __tanpi(x.w));
4192}
4193#endif
4194
4195#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4196extern simd_float8 _simd_tanpi_f8(simd_float8 x);
4197static inline SIMD_CFUNC simd_float8 __tg_tanpi(simd_float8 x) {
4198 return _simd_tanpi_f8(x);
4199}
4200#else
4201static inline SIMD_CFUNC simd_float8 __tg_tanpi(simd_float8 x) {
4202 return simd_make_float8(__tg_tanpi(x.lo), __tg_tanpi(x.hi));
4203}
4204#endif
4205
4206#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4207extern simd_float16 _simd_tanpi_f16(simd_float16 x);
4208static inline SIMD_CFUNC simd_float16 __tg_tanpi(simd_float16 x) {
4209 return _simd_tanpi_f16(x);
4210}
4211#else
4212static inline SIMD_CFUNC simd_float16 __tg_tanpi(simd_float16 x) {
4213 return simd_make_float16(__tg_tanpi(x.lo), __tg_tanpi(x.hi));
4214}
4215#endif
4216
4217#if SIMD_LIBRARY_VERSION >= 3
4218extern simd_double2 _simd_tanpi_d2(simd_double2 x);
4219static inline SIMD_CFUNC simd_double2 __tg_tanpi(simd_double2 x) {
4220 return _simd_tanpi_d2(x);
4221}
4222#else
4223static inline SIMD_CFUNC simd_double2 __tg_tanpi(simd_double2 x) {
4224 return simd_make_double2(__tanpi(x.x), __tanpi(x.y));
4225}
4226#endif
4227
4228static inline SIMD_CFUNC simd_double3 __tg_tanpi(simd_double3 x) {
4229 return simd_make_double3(__tg_tanpi(simd_make_double4(x)));
4230}
4231
4232#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4233extern simd_double4 _simd_tanpi_d4(simd_double4 x);
4234static inline SIMD_CFUNC simd_double4 __tg_tanpi(simd_double4 x) {
4235 return _simd_tanpi_d4(x);
4236}
4237#else
4238static inline SIMD_CFUNC simd_double4 __tg_tanpi(simd_double4 x) {
4239 return simd_make_double4(__tg_tanpi(x.lo), __tg_tanpi(x.hi));
4240}
4241#endif
4242
4243#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4244extern simd_double8 _simd_tanpi_d8(simd_double8 x);
4245static inline SIMD_CFUNC simd_double8 __tg_tanpi(simd_double8 x) {
4246 return _simd_tanpi_d8(x);
4247}
4248#else
4249static inline SIMD_CFUNC simd_double8 __tg_tanpi(simd_double8 x) {
4250 return simd_make_double8(__tg_tanpi(x.lo), __tg_tanpi(x.hi));
4251}
4252#endif
4253
4254#endif /* SIMD_LIBRARY_VERSION */
4255#pragma mark - acosh implementation
4256static inline SIMD_CFUNC simd_float2 __tg_acosh(simd_float2 x) {
4257 return simd_make_float2(__tg_acosh(simd_make_float4(x)));
4258}
4259
4260static inline SIMD_CFUNC simd_float3 __tg_acosh(simd_float3 x) {
4261 return simd_make_float3(__tg_acosh(simd_make_float4(x)));
4262}
4263
4264#if SIMD_LIBRARY_VERSION >= 3
4265extern simd_float4 _simd_acosh_f4(simd_float4 x);
4266static inline SIMD_CFUNC simd_float4 __tg_acosh(simd_float4 x) {
4267 return _simd_acosh_f4(x);
4268}
4269#else
4270static inline SIMD_CFUNC simd_float4 __tg_acosh(simd_float4 x) {
4271 return simd_make_float4(acosh(x.x), acosh(x.y), acosh(x.z), acosh(x.w));
4272}
4273#endif
4274
4275#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4276extern simd_float8 _simd_acosh_f8(simd_float8 x);
4277static inline SIMD_CFUNC simd_float8 __tg_acosh(simd_float8 x) {
4278 return _simd_acosh_f8(x);
4279}
4280#else
4281static inline SIMD_CFUNC simd_float8 __tg_acosh(simd_float8 x) {
4282 return simd_make_float8(__tg_acosh(x.lo), __tg_acosh(x.hi));
4283}
4284#endif
4285
4286#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4287extern simd_float16 _simd_acosh_f16(simd_float16 x);
4288static inline SIMD_CFUNC simd_float16 __tg_acosh(simd_float16 x) {
4289 return _simd_acosh_f16(x);
4290}
4291#else
4292static inline SIMD_CFUNC simd_float16 __tg_acosh(simd_float16 x) {
4293 return simd_make_float16(__tg_acosh(x.lo), __tg_acosh(x.hi));
4294}
4295#endif
4296
4297#if SIMD_LIBRARY_VERSION >= 3
4298extern simd_double2 _simd_acosh_d2(simd_double2 x);
4299static inline SIMD_CFUNC simd_double2 __tg_acosh(simd_double2 x) {
4300 return _simd_acosh_d2(x);
4301}
4302#else
4303static inline SIMD_CFUNC simd_double2 __tg_acosh(simd_double2 x) {
4304 return simd_make_double2(acosh(x.x), acosh(x.y));
4305}
4306#endif
4307
4308static inline SIMD_CFUNC simd_double3 __tg_acosh(simd_double3 x) {
4309 return simd_make_double3(__tg_acosh(simd_make_double4(x)));
4310}
4311
4312#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4313extern simd_double4 _simd_acosh_d4(simd_double4 x);
4314static inline SIMD_CFUNC simd_double4 __tg_acosh(simd_double4 x) {
4315 return _simd_acosh_d4(x);
4316}
4317#else
4318static inline SIMD_CFUNC simd_double4 __tg_acosh(simd_double4 x) {
4319 return simd_make_double4(__tg_acosh(x.lo), __tg_acosh(x.hi));
4320}
4321#endif
4322
4323#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4324extern simd_double8 _simd_acosh_d8(simd_double8 x);
4325static inline SIMD_CFUNC simd_double8 __tg_acosh(simd_double8 x) {
4326 return _simd_acosh_d8(x);
4327}
4328#else
4329static inline SIMD_CFUNC simd_double8 __tg_acosh(simd_double8 x) {
4330 return simd_make_double8(__tg_acosh(x.lo), __tg_acosh(x.hi));
4331}
4332#endif
4333
4334#pragma mark - asinh implementation
4335static inline SIMD_CFUNC simd_float2 __tg_asinh(simd_float2 x) {
4336 return simd_make_float2(__tg_asinh(simd_make_float4(x)));
4337}
4338
4339static inline SIMD_CFUNC simd_float3 __tg_asinh(simd_float3 x) {
4340 return simd_make_float3(__tg_asinh(simd_make_float4(x)));
4341}
4342
4343#if SIMD_LIBRARY_VERSION >= 3
4344extern simd_float4 _simd_asinh_f4(simd_float4 x);
4345static inline SIMD_CFUNC simd_float4 __tg_asinh(simd_float4 x) {
4346 return _simd_asinh_f4(x);
4347}
4348#else
4349static inline SIMD_CFUNC simd_float4 __tg_asinh(simd_float4 x) {
4350 return simd_make_float4(asinh(x.x), asinh(x.y), asinh(x.z), asinh(x.w));
4351}
4352#endif
4353
4354#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4355extern simd_float8 _simd_asinh_f8(simd_float8 x);
4356static inline SIMD_CFUNC simd_float8 __tg_asinh(simd_float8 x) {
4357 return _simd_asinh_f8(x);
4358}
4359#else
4360static inline SIMD_CFUNC simd_float8 __tg_asinh(simd_float8 x) {
4361 return simd_make_float8(__tg_asinh(x.lo), __tg_asinh(x.hi));
4362}
4363#endif
4364
4365#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4366extern simd_float16 _simd_asinh_f16(simd_float16 x);
4367static inline SIMD_CFUNC simd_float16 __tg_asinh(simd_float16 x) {
4368 return _simd_asinh_f16(x);
4369}
4370#else
4371static inline SIMD_CFUNC simd_float16 __tg_asinh(simd_float16 x) {
4372 return simd_make_float16(__tg_asinh(x.lo), __tg_asinh(x.hi));
4373}
4374#endif
4375
4376#if SIMD_LIBRARY_VERSION >= 3
4377extern simd_double2 _simd_asinh_d2(simd_double2 x);
4378static inline SIMD_CFUNC simd_double2 __tg_asinh(simd_double2 x) {
4379 return _simd_asinh_d2(x);
4380}
4381#else
4382static inline SIMD_CFUNC simd_double2 __tg_asinh(simd_double2 x) {
4383 return simd_make_double2(asinh(x.x), asinh(x.y));
4384}
4385#endif
4386
4387static inline SIMD_CFUNC simd_double3 __tg_asinh(simd_double3 x) {
4388 return simd_make_double3(__tg_asinh(simd_make_double4(x)));
4389}
4390
4391#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4392extern simd_double4 _simd_asinh_d4(simd_double4 x);
4393static inline SIMD_CFUNC simd_double4 __tg_asinh(simd_double4 x) {
4394 return _simd_asinh_d4(x);
4395}
4396#else
4397static inline SIMD_CFUNC simd_double4 __tg_asinh(simd_double4 x) {
4398 return simd_make_double4(__tg_asinh(x.lo), __tg_asinh(x.hi));
4399}
4400#endif
4401
4402#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4403extern simd_double8 _simd_asinh_d8(simd_double8 x);
4404static inline SIMD_CFUNC simd_double8 __tg_asinh(simd_double8 x) {
4405 return _simd_asinh_d8(x);
4406}
4407#else
4408static inline SIMD_CFUNC simd_double8 __tg_asinh(simd_double8 x) {
4409 return simd_make_double8(__tg_asinh(x.lo), __tg_asinh(x.hi));
4410}
4411#endif
4412
4413#pragma mark - atanh implementation
4414static inline SIMD_CFUNC simd_float2 __tg_atanh(simd_float2 x) {
4415 return simd_make_float2(__tg_atanh(simd_make_float4(x)));
4416}
4417
4418static inline SIMD_CFUNC simd_float3 __tg_atanh(simd_float3 x) {
4419 return simd_make_float3(__tg_atanh(simd_make_float4(x)));
4420}
4421
4422#if SIMD_LIBRARY_VERSION >= 3
4423extern simd_float4 _simd_atanh_f4(simd_float4 x);
4424static inline SIMD_CFUNC simd_float4 __tg_atanh(simd_float4 x) {
4425 return _simd_atanh_f4(x);
4426}
4427#else
4428static inline SIMD_CFUNC simd_float4 __tg_atanh(simd_float4 x) {
4429 return simd_make_float4(atanh(x.x), atanh(x.y), atanh(x.z), atanh(x.w));
4430}
4431#endif
4432
4433#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4434extern simd_float8 _simd_atanh_f8(simd_float8 x);
4435static inline SIMD_CFUNC simd_float8 __tg_atanh(simd_float8 x) {
4436 return _simd_atanh_f8(x);
4437}
4438#else
4439static inline SIMD_CFUNC simd_float8 __tg_atanh(simd_float8 x) {
4440 return simd_make_float8(__tg_atanh(x.lo), __tg_atanh(x.hi));
4441}
4442#endif
4443
4444#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4445extern simd_float16 _simd_atanh_f16(simd_float16 x);
4446static inline SIMD_CFUNC simd_float16 __tg_atanh(simd_float16 x) {
4447 return _simd_atanh_f16(x);
4448}
4449#else
4450static inline SIMD_CFUNC simd_float16 __tg_atanh(simd_float16 x) {
4451 return simd_make_float16(__tg_atanh(x.lo), __tg_atanh(x.hi));
4452}
4453#endif
4454
4455#if SIMD_LIBRARY_VERSION >= 3
4456extern simd_double2 _simd_atanh_d2(simd_double2 x);
4457static inline SIMD_CFUNC simd_double2 __tg_atanh(simd_double2 x) {
4458 return _simd_atanh_d2(x);
4459}
4460#else
4461static inline SIMD_CFUNC simd_double2 __tg_atanh(simd_double2 x) {
4462 return simd_make_double2(atanh(x.x), atanh(x.y));
4463}
4464#endif
4465
4466static inline SIMD_CFUNC simd_double3 __tg_atanh(simd_double3 x) {
4467 return simd_make_double3(__tg_atanh(simd_make_double4(x)));
4468}
4469
4470#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4471extern simd_double4 _simd_atanh_d4(simd_double4 x);
4472static inline SIMD_CFUNC simd_double4 __tg_atanh(simd_double4 x) {
4473 return _simd_atanh_d4(x);
4474}
4475#else
4476static inline SIMD_CFUNC simd_double4 __tg_atanh(simd_double4 x) {
4477 return simd_make_double4(__tg_atanh(x.lo), __tg_atanh(x.hi));
4478}
4479#endif
4480
4481#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4482extern simd_double8 _simd_atanh_d8(simd_double8 x);
4483static inline SIMD_CFUNC simd_double8 __tg_atanh(simd_double8 x) {
4484 return _simd_atanh_d8(x);
4485}
4486#else
4487static inline SIMD_CFUNC simd_double8 __tg_atanh(simd_double8 x) {
4488 return simd_make_double8(__tg_atanh(x.lo), __tg_atanh(x.hi));
4489}
4490#endif
4491
4492#pragma mark - cosh implementation
4493static inline SIMD_CFUNC simd_float2 __tg_cosh(simd_float2 x) {
4494 return simd_make_float2(__tg_cosh(simd_make_float4(x)));
4495}
4496
4497static inline SIMD_CFUNC simd_float3 __tg_cosh(simd_float3 x) {
4498 return simd_make_float3(__tg_cosh(simd_make_float4(x)));
4499}
4500
4501#if SIMD_LIBRARY_VERSION >= 3
4502extern simd_float4 _simd_cosh_f4(simd_float4 x);
4503static inline SIMD_CFUNC simd_float4 __tg_cosh(simd_float4 x) {
4504 return _simd_cosh_f4(x);
4505}
4506#else
4507static inline SIMD_CFUNC simd_float4 __tg_cosh(simd_float4 x) {
4508 return simd_make_float4(cosh(x.x), cosh(x.y), cosh(x.z), cosh(x.w));
4509}
4510#endif
4511
4512#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4513extern simd_float8 _simd_cosh_f8(simd_float8 x);
4514static inline SIMD_CFUNC simd_float8 __tg_cosh(simd_float8 x) {
4515 return _simd_cosh_f8(x);
4516}
4517#else
4518static inline SIMD_CFUNC simd_float8 __tg_cosh(simd_float8 x) {
4519 return simd_make_float8(__tg_cosh(x.lo), __tg_cosh(x.hi));
4520}
4521#endif
4522
4523#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4524extern simd_float16 _simd_cosh_f16(simd_float16 x);
4525static inline SIMD_CFUNC simd_float16 __tg_cosh(simd_float16 x) {
4526 return _simd_cosh_f16(x);
4527}
4528#else
4529static inline SIMD_CFUNC simd_float16 __tg_cosh(simd_float16 x) {
4530 return simd_make_float16(__tg_cosh(x.lo), __tg_cosh(x.hi));
4531}
4532#endif
4533
4534#if SIMD_LIBRARY_VERSION >= 3
4535extern simd_double2 _simd_cosh_d2(simd_double2 x);
4536static inline SIMD_CFUNC simd_double2 __tg_cosh(simd_double2 x) {
4537 return _simd_cosh_d2(x);
4538}
4539#else
4540static inline SIMD_CFUNC simd_double2 __tg_cosh(simd_double2 x) {
4541 return simd_make_double2(cosh(x.x), cosh(x.y));
4542}
4543#endif
4544
4545static inline SIMD_CFUNC simd_double3 __tg_cosh(simd_double3 x) {
4546 return simd_make_double3(__tg_cosh(simd_make_double4(x)));
4547}
4548
4549#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4550extern simd_double4 _simd_cosh_d4(simd_double4 x);
4551static inline SIMD_CFUNC simd_double4 __tg_cosh(simd_double4 x) {
4552 return _simd_cosh_d4(x);
4553}
4554#else
4555static inline SIMD_CFUNC simd_double4 __tg_cosh(simd_double4 x) {
4556 return simd_make_double4(__tg_cosh(x.lo), __tg_cosh(x.hi));
4557}
4558#endif
4559
4560#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4561extern simd_double8 _simd_cosh_d8(simd_double8 x);
4562static inline SIMD_CFUNC simd_double8 __tg_cosh(simd_double8 x) {
4563 return _simd_cosh_d8(x);
4564}
4565#else
4566static inline SIMD_CFUNC simd_double8 __tg_cosh(simd_double8 x) {
4567 return simd_make_double8(__tg_cosh(x.lo), __tg_cosh(x.hi));
4568}
4569#endif
4570
4571#pragma mark - sinh implementation
4572static inline SIMD_CFUNC simd_float2 __tg_sinh(simd_float2 x) {
4573 return simd_make_float2(__tg_sinh(simd_make_float4(x)));
4574}
4575
4576static inline SIMD_CFUNC simd_float3 __tg_sinh(simd_float3 x) {
4577 return simd_make_float3(__tg_sinh(simd_make_float4(x)));
4578}
4579
4580#if SIMD_LIBRARY_VERSION >= 3
4581extern simd_float4 _simd_sinh_f4(simd_float4 x);
4582static inline SIMD_CFUNC simd_float4 __tg_sinh(simd_float4 x) {
4583 return _simd_sinh_f4(x);
4584}
4585#else
4586static inline SIMD_CFUNC simd_float4 __tg_sinh(simd_float4 x) {
4587 return simd_make_float4(sinh(x.x), sinh(x.y), sinh(x.z), sinh(x.w));
4588}
4589#endif
4590
4591#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4592extern simd_float8 _simd_sinh_f8(simd_float8 x);
4593static inline SIMD_CFUNC simd_float8 __tg_sinh(simd_float8 x) {
4594 return _simd_sinh_f8(x);
4595}
4596#else
4597static inline SIMD_CFUNC simd_float8 __tg_sinh(simd_float8 x) {
4598 return simd_make_float8(__tg_sinh(x.lo), __tg_sinh(x.hi));
4599}
4600#endif
4601
4602#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4603extern simd_float16 _simd_sinh_f16(simd_float16 x);
4604static inline SIMD_CFUNC simd_float16 __tg_sinh(simd_float16 x) {
4605 return _simd_sinh_f16(x);
4606}
4607#else
4608static inline SIMD_CFUNC simd_float16 __tg_sinh(simd_float16 x) {
4609 return simd_make_float16(__tg_sinh(x.lo), __tg_sinh(x.hi));
4610}
4611#endif
4612
4613#if SIMD_LIBRARY_VERSION >= 3
4614extern simd_double2 _simd_sinh_d2(simd_double2 x);
4615static inline SIMD_CFUNC simd_double2 __tg_sinh(simd_double2 x) {
4616 return _simd_sinh_d2(x);
4617}
4618#else
4619static inline SIMD_CFUNC simd_double2 __tg_sinh(simd_double2 x) {
4620 return simd_make_double2(sinh(x.x), sinh(x.y));
4621}
4622#endif
4623
4624static inline SIMD_CFUNC simd_double3 __tg_sinh(simd_double3 x) {
4625 return simd_make_double3(__tg_sinh(simd_make_double4(x)));
4626}
4627
4628#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4629extern simd_double4 _simd_sinh_d4(simd_double4 x);
4630static inline SIMD_CFUNC simd_double4 __tg_sinh(simd_double4 x) {
4631 return _simd_sinh_d4(x);
4632}
4633#else
4634static inline SIMD_CFUNC simd_double4 __tg_sinh(simd_double4 x) {
4635 return simd_make_double4(__tg_sinh(x.lo), __tg_sinh(x.hi));
4636}
4637#endif
4638
4639#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4640extern simd_double8 _simd_sinh_d8(simd_double8 x);
4641static inline SIMD_CFUNC simd_double8 __tg_sinh(simd_double8 x) {
4642 return _simd_sinh_d8(x);
4643}
4644#else
4645static inline SIMD_CFUNC simd_double8 __tg_sinh(simd_double8 x) {
4646 return simd_make_double8(__tg_sinh(x.lo), __tg_sinh(x.hi));
4647}
4648#endif
4649
4650#pragma mark - tanh implementation
4651static inline SIMD_CFUNC simd_float2 __tg_tanh(simd_float2 x) {
4652 return simd_make_float2(__tg_tanh(simd_make_float4(x)));
4653}
4654
4655static inline SIMD_CFUNC simd_float3 __tg_tanh(simd_float3 x) {
4656 return simd_make_float3(__tg_tanh(simd_make_float4(x)));
4657}
4658
4659#if SIMD_LIBRARY_VERSION >= 3
4660extern simd_float4 _simd_tanh_f4(simd_float4 x);
4661static inline SIMD_CFUNC simd_float4 __tg_tanh(simd_float4 x) {
4662 return _simd_tanh_f4(x);
4663}
4664#else
4665static inline SIMD_CFUNC simd_float4 __tg_tanh(simd_float4 x) {
4666 return simd_make_float4(tanh(x.x), tanh(x.y), tanh(x.z), tanh(x.w));
4667}
4668#endif
4669
4670#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4671extern simd_float8 _simd_tanh_f8(simd_float8 x);
4672static inline SIMD_CFUNC simd_float8 __tg_tanh(simd_float8 x) {
4673 return _simd_tanh_f8(x);
4674}
4675#else
4676static inline SIMD_CFUNC simd_float8 __tg_tanh(simd_float8 x) {
4677 return simd_make_float8(__tg_tanh(x.lo), __tg_tanh(x.hi));
4678}
4679#endif
4680
4681#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4682extern simd_float16 _simd_tanh_f16(simd_float16 x);
4683static inline SIMD_CFUNC simd_float16 __tg_tanh(simd_float16 x) {
4684 return _simd_tanh_f16(x);
4685}
4686#else
4687static inline SIMD_CFUNC simd_float16 __tg_tanh(simd_float16 x) {
4688 return simd_make_float16(__tg_tanh(x.lo), __tg_tanh(x.hi));
4689}
4690#endif
4691
4692#if SIMD_LIBRARY_VERSION >= 3
4693extern simd_double2 _simd_tanh_d2(simd_double2 x);
4694static inline SIMD_CFUNC simd_double2 __tg_tanh(simd_double2 x) {
4695 return _simd_tanh_d2(x);
4696}
4697#else
4698static inline SIMD_CFUNC simd_double2 __tg_tanh(simd_double2 x) {
4699 return simd_make_double2(tanh(x.x), tanh(x.y));
4700}
4701#endif
4702
4703static inline SIMD_CFUNC simd_double3 __tg_tanh(simd_double3 x) {
4704 return simd_make_double3(__tg_tanh(simd_make_double4(x)));
4705}
4706
4707#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4708extern simd_double4 _simd_tanh_d4(simd_double4 x);
4709static inline SIMD_CFUNC simd_double4 __tg_tanh(simd_double4 x) {
4710 return _simd_tanh_d4(x);
4711}
4712#else
4713static inline SIMD_CFUNC simd_double4 __tg_tanh(simd_double4 x) {
4714 return simd_make_double4(__tg_tanh(x.lo), __tg_tanh(x.hi));
4715}
4716#endif
4717
4718#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4719extern simd_double8 _simd_tanh_d8(simd_double8 x);
4720static inline SIMD_CFUNC simd_double8 __tg_tanh(simd_double8 x) {
4721 return _simd_tanh_d8(x);
4722}
4723#else
4724static inline SIMD_CFUNC simd_double8 __tg_tanh(simd_double8 x) {
4725 return simd_make_double8(__tg_tanh(x.lo), __tg_tanh(x.hi));
4726}
4727#endif
4728
4729#pragma mark - exp implementation
4730static inline SIMD_CFUNC simd_float2 __tg_exp(simd_float2 x) {
4731 return simd_make_float2(__tg_exp(simd_make_float4(x)));
4732}
4733
4734static inline SIMD_CFUNC simd_float3 __tg_exp(simd_float3 x) {
4735 return simd_make_float3(__tg_exp(simd_make_float4(x)));
4736}
4737
4738#if SIMD_LIBRARY_VERSION >= 3
4739extern simd_float4 _simd_exp_f4(simd_float4 x);
4740static inline SIMD_CFUNC simd_float4 __tg_exp(simd_float4 x) {
4741 return _simd_exp_f4(x);
4742}
4743#else
4744static inline SIMD_CFUNC simd_float4 __tg_exp(simd_float4 x) {
4745 return simd_make_float4(exp(x.x), exp(x.y), exp(x.z), exp(x.w));
4746}
4747#endif
4748
4749#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4750extern simd_float8 _simd_exp_f8(simd_float8 x);
4751static inline SIMD_CFUNC simd_float8 __tg_exp(simd_float8 x) {
4752 return _simd_exp_f8(x);
4753}
4754#else
4755static inline SIMD_CFUNC simd_float8 __tg_exp(simd_float8 x) {
4756 return simd_make_float8(__tg_exp(x.lo), __tg_exp(x.hi));
4757}
4758#endif
4759
4760#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4761extern simd_float16 _simd_exp_f16(simd_float16 x);
4762static inline SIMD_CFUNC simd_float16 __tg_exp(simd_float16 x) {
4763 return _simd_exp_f16(x);
4764}
4765#else
4766static inline SIMD_CFUNC simd_float16 __tg_exp(simd_float16 x) {
4767 return simd_make_float16(__tg_exp(x.lo), __tg_exp(x.hi));
4768}
4769#endif
4770
4771#if SIMD_LIBRARY_VERSION >= 3
4772extern simd_double2 _simd_exp_d2(simd_double2 x);
4773static inline SIMD_CFUNC simd_double2 __tg_exp(simd_double2 x) {
4774 return _simd_exp_d2(x);
4775}
4776#else
4777static inline SIMD_CFUNC simd_double2 __tg_exp(simd_double2 x) {
4778 return simd_make_double2(exp(x.x), exp(x.y));
4779}
4780#endif
4781
4782static inline SIMD_CFUNC simd_double3 __tg_exp(simd_double3 x) {
4783 return simd_make_double3(__tg_exp(simd_make_double4(x)));
4784}
4785
4786#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4787extern simd_double4 _simd_exp_d4(simd_double4 x);
4788static inline SIMD_CFUNC simd_double4 __tg_exp(simd_double4 x) {
4789 return _simd_exp_d4(x);
4790}
4791#else
4792static inline SIMD_CFUNC simd_double4 __tg_exp(simd_double4 x) {
4793 return simd_make_double4(__tg_exp(x.lo), __tg_exp(x.hi));
4794}
4795#endif
4796
4797#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4798extern simd_double8 _simd_exp_d8(simd_double8 x);
4799static inline SIMD_CFUNC simd_double8 __tg_exp(simd_double8 x) {
4800 return _simd_exp_d8(x);
4801}
4802#else
4803static inline SIMD_CFUNC simd_double8 __tg_exp(simd_double8 x) {
4804 return simd_make_double8(__tg_exp(x.lo), __tg_exp(x.hi));
4805}
4806#endif
4807
4808#pragma mark - exp2 implementation
4809static inline SIMD_CFUNC simd_float2 __tg_exp2(simd_float2 x) {
4810 return simd_make_float2(__tg_exp2(simd_make_float4(x)));
4811}
4812
4813static inline SIMD_CFUNC simd_float3 __tg_exp2(simd_float3 x) {
4814 return simd_make_float3(__tg_exp2(simd_make_float4(x)));
4815}
4816
4817#if SIMD_LIBRARY_VERSION >= 3
4818extern simd_float4 _simd_exp2_f4(simd_float4 x);
4819static inline SIMD_CFUNC simd_float4 __tg_exp2(simd_float4 x) {
4820 return _simd_exp2_f4(x);
4821}
4822#else
4823static inline SIMD_CFUNC simd_float4 __tg_exp2(simd_float4 x) {
4824 return simd_make_float4(exp2(x.x), exp2(x.y), exp2(x.z), exp2(x.w));
4825}
4826#endif
4827
4828#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4829extern simd_float8 _simd_exp2_f8(simd_float8 x);
4830static inline SIMD_CFUNC simd_float8 __tg_exp2(simd_float8 x) {
4831 return _simd_exp2_f8(x);
4832}
4833#else
4834static inline SIMD_CFUNC simd_float8 __tg_exp2(simd_float8 x) {
4835 return simd_make_float8(__tg_exp2(x.lo), __tg_exp2(x.hi));
4836}
4837#endif
4838
4839#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4840extern simd_float16 _simd_exp2_f16(simd_float16 x);
4841static inline SIMD_CFUNC simd_float16 __tg_exp2(simd_float16 x) {
4842 return _simd_exp2_f16(x);
4843}
4844#else
4845static inline SIMD_CFUNC simd_float16 __tg_exp2(simd_float16 x) {
4846 return simd_make_float16(__tg_exp2(x.lo), __tg_exp2(x.hi));
4847}
4848#endif
4849
4850#if SIMD_LIBRARY_VERSION >= 3
4851extern simd_double2 _simd_exp2_d2(simd_double2 x);
4852static inline SIMD_CFUNC simd_double2 __tg_exp2(simd_double2 x) {
4853 return _simd_exp2_d2(x);
4854}
4855#else
4856static inline SIMD_CFUNC simd_double2 __tg_exp2(simd_double2 x) {
4857 return simd_make_double2(exp2(x.x), exp2(x.y));
4858}
4859#endif
4860
4861static inline SIMD_CFUNC simd_double3 __tg_exp2(simd_double3 x) {
4862 return simd_make_double3(__tg_exp2(simd_make_double4(x)));
4863}
4864
4865#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4866extern simd_double4 _simd_exp2_d4(simd_double4 x);
4867static inline SIMD_CFUNC simd_double4 __tg_exp2(simd_double4 x) {
4868 return _simd_exp2_d4(x);
4869}
4870#else
4871static inline SIMD_CFUNC simd_double4 __tg_exp2(simd_double4 x) {
4872 return simd_make_double4(__tg_exp2(x.lo), __tg_exp2(x.hi));
4873}
4874#endif
4875
4876#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4877extern simd_double8 _simd_exp2_d8(simd_double8 x);
4878static inline SIMD_CFUNC simd_double8 __tg_exp2(simd_double8 x) {
4879 return _simd_exp2_d8(x);
4880}
4881#else
4882static inline SIMD_CFUNC simd_double8 __tg_exp2(simd_double8 x) {
4883 return simd_make_double8(__tg_exp2(x.lo), __tg_exp2(x.hi));
4884}
4885#endif
4886
4887#pragma mark - exp10 implementation
4888#if SIMD_LIBRARY_VERSION >= 1
4889static inline SIMD_CFUNC simd_float2 __tg_exp10(simd_float2 x) {
4890 return simd_make_float2(__tg_exp10(simd_make_float4(x)));
4891}
4892
4893static inline SIMD_CFUNC simd_float3 __tg_exp10(simd_float3 x) {
4894 return simd_make_float3(__tg_exp10(simd_make_float4(x)));
4895}
4896
4897#if SIMD_LIBRARY_VERSION >= 3
4898extern simd_float4 _simd_exp10_f4(simd_float4 x);
4899static inline SIMD_CFUNC simd_float4 __tg_exp10(simd_float4 x) {
4900 return _simd_exp10_f4(x);
4901}
4902#else
4903static inline SIMD_CFUNC simd_float4 __tg_exp10(simd_float4 x) {
4904 return simd_make_float4(__exp10(x.x), __exp10(x.y), __exp10(x.z), __exp10(x.w));
4905}
4906#endif
4907
4908#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4909extern simd_float8 _simd_exp10_f8(simd_float8 x);
4910static inline SIMD_CFUNC simd_float8 __tg_exp10(simd_float8 x) {
4911 return _simd_exp10_f8(x);
4912}
4913#else
4914static inline SIMD_CFUNC simd_float8 __tg_exp10(simd_float8 x) {
4915 return simd_make_float8(__tg_exp10(x.lo), __tg_exp10(x.hi));
4916}
4917#endif
4918
4919#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4920extern simd_float16 _simd_exp10_f16(simd_float16 x);
4921static inline SIMD_CFUNC simd_float16 __tg_exp10(simd_float16 x) {
4922 return _simd_exp10_f16(x);
4923}
4924#else
4925static inline SIMD_CFUNC simd_float16 __tg_exp10(simd_float16 x) {
4926 return simd_make_float16(__tg_exp10(x.lo), __tg_exp10(x.hi));
4927}
4928#endif
4929
4930#if SIMD_LIBRARY_VERSION >= 3
4931extern simd_double2 _simd_exp10_d2(simd_double2 x);
4932static inline SIMD_CFUNC simd_double2 __tg_exp10(simd_double2 x) {
4933 return _simd_exp10_d2(x);
4934}
4935#else
4936static inline SIMD_CFUNC simd_double2 __tg_exp10(simd_double2 x) {
4937 return simd_make_double2(__exp10(x.x), __exp10(x.y));
4938}
4939#endif
4940
4941static inline SIMD_CFUNC simd_double3 __tg_exp10(simd_double3 x) {
4942 return simd_make_double3(__tg_exp10(simd_make_double4(x)));
4943}
4944
4945#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4946extern simd_double4 _simd_exp10_d4(simd_double4 x);
4947static inline SIMD_CFUNC simd_double4 __tg_exp10(simd_double4 x) {
4948 return _simd_exp10_d4(x);
4949}
4950#else
4951static inline SIMD_CFUNC simd_double4 __tg_exp10(simd_double4 x) {
4952 return simd_make_double4(__tg_exp10(x.lo), __tg_exp10(x.hi));
4953}
4954#endif
4955
4956#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
4957extern simd_double8 _simd_exp10_d8(simd_double8 x);
4958static inline SIMD_CFUNC simd_double8 __tg_exp10(simd_double8 x) {
4959 return _simd_exp10_d8(x);
4960}
4961#else
4962static inline SIMD_CFUNC simd_double8 __tg_exp10(simd_double8 x) {
4963 return simd_make_double8(__tg_exp10(x.lo), __tg_exp10(x.hi));
4964}
4965#endif
4966
4967#endif /* SIMD_LIBRARY_VERSION */
4968#pragma mark - expm1 implementation
4969static inline SIMD_CFUNC simd_float2 __tg_expm1(simd_float2 x) {
4970 return simd_make_float2(__tg_expm1(simd_make_float4(x)));
4971}
4972
4973static inline SIMD_CFUNC simd_float3 __tg_expm1(simd_float3 x) {
4974 return simd_make_float3(__tg_expm1(simd_make_float4(x)));
4975}
4976
4977#if SIMD_LIBRARY_VERSION >= 3
4978extern simd_float4 _simd_expm1_f4(simd_float4 x);
4979static inline SIMD_CFUNC simd_float4 __tg_expm1(simd_float4 x) {
4980 return _simd_expm1_f4(x);
4981}
4982#else
4983static inline SIMD_CFUNC simd_float4 __tg_expm1(simd_float4 x) {
4984 return simd_make_float4(expm1(x.x), expm1(x.y), expm1(x.z), expm1(x.w));
4985}
4986#endif
4987
4988#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
4989extern simd_float8 _simd_expm1_f8(simd_float8 x);
4990static inline SIMD_CFUNC simd_float8 __tg_expm1(simd_float8 x) {
4991 return _simd_expm1_f8(x);
4992}
4993#else
4994static inline SIMD_CFUNC simd_float8 __tg_expm1(simd_float8 x) {
4995 return simd_make_float8(__tg_expm1(x.lo), __tg_expm1(x.hi));
4996}
4997#endif
4998
4999#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5000extern simd_float16 _simd_expm1_f16(simd_float16 x);
5001static inline SIMD_CFUNC simd_float16 __tg_expm1(simd_float16 x) {
5002 return _simd_expm1_f16(x);
5003}
5004#else
5005static inline SIMD_CFUNC simd_float16 __tg_expm1(simd_float16 x) {
5006 return simd_make_float16(__tg_expm1(x.lo), __tg_expm1(x.hi));
5007}
5008#endif
5009
5010#if SIMD_LIBRARY_VERSION >= 3
5011extern simd_double2 _simd_expm1_d2(simd_double2 x);
5012static inline SIMD_CFUNC simd_double2 __tg_expm1(simd_double2 x) {
5013 return _simd_expm1_d2(x);
5014}
5015#else
5016static inline SIMD_CFUNC simd_double2 __tg_expm1(simd_double2 x) {
5017 return simd_make_double2(expm1(x.x), expm1(x.y));
5018}
5019#endif
5020
5021static inline SIMD_CFUNC simd_double3 __tg_expm1(simd_double3 x) {
5022 return simd_make_double3(__tg_expm1(simd_make_double4(x)));
5023}
5024
5025#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5026extern simd_double4 _simd_expm1_d4(simd_double4 x);
5027static inline SIMD_CFUNC simd_double4 __tg_expm1(simd_double4 x) {
5028 return _simd_expm1_d4(x);
5029}
5030#else
5031static inline SIMD_CFUNC simd_double4 __tg_expm1(simd_double4 x) {
5032 return simd_make_double4(__tg_expm1(x.lo), __tg_expm1(x.hi));
5033}
5034#endif
5035
5036#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5037extern simd_double8 _simd_expm1_d8(simd_double8 x);
5038static inline SIMD_CFUNC simd_double8 __tg_expm1(simd_double8 x) {
5039 return _simd_expm1_d8(x);
5040}
5041#else
5042static inline SIMD_CFUNC simd_double8 __tg_expm1(simd_double8 x) {
5043 return simd_make_double8(__tg_expm1(x.lo), __tg_expm1(x.hi));
5044}
5045#endif
5046
5047#pragma mark - log implementation
5048static inline SIMD_CFUNC simd_float2 __tg_log(simd_float2 x) {
5049 return simd_make_float2(__tg_log(simd_make_float4(x)));
5050}
5051
5052static inline SIMD_CFUNC simd_float3 __tg_log(simd_float3 x) {
5053 return simd_make_float3(__tg_log(simd_make_float4(x)));
5054}
5055
5056#if SIMD_LIBRARY_VERSION >= 3
5057extern simd_float4 _simd_log_f4(simd_float4 x);
5058static inline SIMD_CFUNC simd_float4 __tg_log(simd_float4 x) {
5059 return _simd_log_f4(x);
5060}
5061#else
5062static inline SIMD_CFUNC simd_float4 __tg_log(simd_float4 x) {
5063 return simd_make_float4(log(x.x), log(x.y), log(x.z), log(x.w));
5064}
5065#endif
5066
5067#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5068extern simd_float8 _simd_log_f8(simd_float8 x);
5069static inline SIMD_CFUNC simd_float8 __tg_log(simd_float8 x) {
5070 return _simd_log_f8(x);
5071}
5072#else
5073static inline SIMD_CFUNC simd_float8 __tg_log(simd_float8 x) {
5074 return simd_make_float8(__tg_log(x.lo), __tg_log(x.hi));
5075}
5076#endif
5077
5078#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5079extern simd_float16 _simd_log_f16(simd_float16 x);
5080static inline SIMD_CFUNC simd_float16 __tg_log(simd_float16 x) {
5081 return _simd_log_f16(x);
5082}
5083#else
5084static inline SIMD_CFUNC simd_float16 __tg_log(simd_float16 x) {
5085 return simd_make_float16(__tg_log(x.lo), __tg_log(x.hi));
5086}
5087#endif
5088
5089#if SIMD_LIBRARY_VERSION >= 3
5090extern simd_double2 _simd_log_d2(simd_double2 x);
5091static inline SIMD_CFUNC simd_double2 __tg_log(simd_double2 x) {
5092 return _simd_log_d2(x);
5093}
5094#else
5095static inline SIMD_CFUNC simd_double2 __tg_log(simd_double2 x) {
5096 return simd_make_double2(log(x.x), log(x.y));
5097}
5098#endif
5099
5100static inline SIMD_CFUNC simd_double3 __tg_log(simd_double3 x) {
5101 return simd_make_double3(__tg_log(simd_make_double4(x)));
5102}
5103
5104#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5105extern simd_double4 _simd_log_d4(simd_double4 x);
5106static inline SIMD_CFUNC simd_double4 __tg_log(simd_double4 x) {
5107 return _simd_log_d4(x);
5108}
5109#else
5110static inline SIMD_CFUNC simd_double4 __tg_log(simd_double4 x) {
5111 return simd_make_double4(__tg_log(x.lo), __tg_log(x.hi));
5112}
5113#endif
5114
5115#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5116extern simd_double8 _simd_log_d8(simd_double8 x);
5117static inline SIMD_CFUNC simd_double8 __tg_log(simd_double8 x) {
5118 return _simd_log_d8(x);
5119}
5120#else
5121static inline SIMD_CFUNC simd_double8 __tg_log(simd_double8 x) {
5122 return simd_make_double8(__tg_log(x.lo), __tg_log(x.hi));
5123}
5124#endif
5125
5126#pragma mark - log2 implementation
5127static inline SIMD_CFUNC simd_float2 __tg_log2(simd_float2 x) {
5128 return simd_make_float2(__tg_log2(simd_make_float4(x)));
5129}
5130
5131static inline SIMD_CFUNC simd_float3 __tg_log2(simd_float3 x) {
5132 return simd_make_float3(__tg_log2(simd_make_float4(x)));
5133}
5134
5135#if SIMD_LIBRARY_VERSION >= 3
5136extern simd_float4 _simd_log2_f4(simd_float4 x);
5137static inline SIMD_CFUNC simd_float4 __tg_log2(simd_float4 x) {
5138 return _simd_log2_f4(x);
5139}
5140#else
5141static inline SIMD_CFUNC simd_float4 __tg_log2(simd_float4 x) {
5142 return simd_make_float4(log2(x.x), log2(x.y), log2(x.z), log2(x.w));
5143}
5144#endif
5145
5146#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5147extern simd_float8 _simd_log2_f8(simd_float8 x);
5148static inline SIMD_CFUNC simd_float8 __tg_log2(simd_float8 x) {
5149 return _simd_log2_f8(x);
5150}
5151#else
5152static inline SIMD_CFUNC simd_float8 __tg_log2(simd_float8 x) {
5153 return simd_make_float8(__tg_log2(x.lo), __tg_log2(x.hi));
5154}
5155#endif
5156
5157#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5158extern simd_float16 _simd_log2_f16(simd_float16 x);
5159static inline SIMD_CFUNC simd_float16 __tg_log2(simd_float16 x) {
5160 return _simd_log2_f16(x);
5161}
5162#else
5163static inline SIMD_CFUNC simd_float16 __tg_log2(simd_float16 x) {
5164 return simd_make_float16(__tg_log2(x.lo), __tg_log2(x.hi));
5165}
5166#endif
5167
5168#if SIMD_LIBRARY_VERSION >= 3
5169extern simd_double2 _simd_log2_d2(simd_double2 x);
5170static inline SIMD_CFUNC simd_double2 __tg_log2(simd_double2 x) {
5171 return _simd_log2_d2(x);
5172}
5173#else
5174static inline SIMD_CFUNC simd_double2 __tg_log2(simd_double2 x) {
5175 return simd_make_double2(log2(x.x), log2(x.y));
5176}
5177#endif
5178
5179static inline SIMD_CFUNC simd_double3 __tg_log2(simd_double3 x) {
5180 return simd_make_double3(__tg_log2(simd_make_double4(x)));
5181}
5182
5183#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5184extern simd_double4 _simd_log2_d4(simd_double4 x);
5185static inline SIMD_CFUNC simd_double4 __tg_log2(simd_double4 x) {
5186 return _simd_log2_d4(x);
5187}
5188#else
5189static inline SIMD_CFUNC simd_double4 __tg_log2(simd_double4 x) {
5190 return simd_make_double4(__tg_log2(x.lo), __tg_log2(x.hi));
5191}
5192#endif
5193
5194#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5195extern simd_double8 _simd_log2_d8(simd_double8 x);
5196static inline SIMD_CFUNC simd_double8 __tg_log2(simd_double8 x) {
5197 return _simd_log2_d8(x);
5198}
5199#else
5200static inline SIMD_CFUNC simd_double8 __tg_log2(simd_double8 x) {
5201 return simd_make_double8(__tg_log2(x.lo), __tg_log2(x.hi));
5202}
5203#endif
5204
5205#pragma mark - log10 implementation
5206static inline SIMD_CFUNC simd_float2 __tg_log10(simd_float2 x) {
5207 return simd_make_float2(__tg_log10(simd_make_float4(x)));
5208}
5209
5210static inline SIMD_CFUNC simd_float3 __tg_log10(simd_float3 x) {
5211 return simd_make_float3(__tg_log10(simd_make_float4(x)));
5212}
5213
5214#if SIMD_LIBRARY_VERSION >= 3
5215extern simd_float4 _simd_log10_f4(simd_float4 x);
5216static inline SIMD_CFUNC simd_float4 __tg_log10(simd_float4 x) {
5217 return _simd_log10_f4(x);
5218}
5219#else
5220static inline SIMD_CFUNC simd_float4 __tg_log10(simd_float4 x) {
5221 return simd_make_float4(log10(x.x), log10(x.y), log10(x.z), log10(x.w));
5222}
5223#endif
5224
5225#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5226extern simd_float8 _simd_log10_f8(simd_float8 x);
5227static inline SIMD_CFUNC simd_float8 __tg_log10(simd_float8 x) {
5228 return _simd_log10_f8(x);
5229}
5230#else
5231static inline SIMD_CFUNC simd_float8 __tg_log10(simd_float8 x) {
5232 return simd_make_float8(__tg_log10(x.lo), __tg_log10(x.hi));
5233}
5234#endif
5235
5236#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5237extern simd_float16 _simd_log10_f16(simd_float16 x);
5238static inline SIMD_CFUNC simd_float16 __tg_log10(simd_float16 x) {
5239 return _simd_log10_f16(x);
5240}
5241#else
5242static inline SIMD_CFUNC simd_float16 __tg_log10(simd_float16 x) {
5243 return simd_make_float16(__tg_log10(x.lo), __tg_log10(x.hi));
5244}
5245#endif
5246
5247#if SIMD_LIBRARY_VERSION >= 3
5248extern simd_double2 _simd_log10_d2(simd_double2 x);
5249static inline SIMD_CFUNC simd_double2 __tg_log10(simd_double2 x) {
5250 return _simd_log10_d2(x);
5251}
5252#else
5253static inline SIMD_CFUNC simd_double2 __tg_log10(simd_double2 x) {
5254 return simd_make_double2(log10(x.x), log10(x.y));
5255}
5256#endif
5257
5258static inline SIMD_CFUNC simd_double3 __tg_log10(simd_double3 x) {
5259 return simd_make_double3(__tg_log10(simd_make_double4(x)));
5260}
5261
5262#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5263extern simd_double4 _simd_log10_d4(simd_double4 x);
5264static inline SIMD_CFUNC simd_double4 __tg_log10(simd_double4 x) {
5265 return _simd_log10_d4(x);
5266}
5267#else
5268static inline SIMD_CFUNC simd_double4 __tg_log10(simd_double4 x) {
5269 return simd_make_double4(__tg_log10(x.lo), __tg_log10(x.hi));
5270}
5271#endif
5272
5273#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5274extern simd_double8 _simd_log10_d8(simd_double8 x);
5275static inline SIMD_CFUNC simd_double8 __tg_log10(simd_double8 x) {
5276 return _simd_log10_d8(x);
5277}
5278#else
5279static inline SIMD_CFUNC simd_double8 __tg_log10(simd_double8 x) {
5280 return simd_make_double8(__tg_log10(x.lo), __tg_log10(x.hi));
5281}
5282#endif
5283
5284#pragma mark - log1p implementation
5285static inline SIMD_CFUNC simd_float2 __tg_log1p(simd_float2 x) {
5286 return simd_make_float2(__tg_log1p(simd_make_float4(x)));
5287}
5288
5289static inline SIMD_CFUNC simd_float3 __tg_log1p(simd_float3 x) {
5290 return simd_make_float3(__tg_log1p(simd_make_float4(x)));
5291}
5292
5293#if SIMD_LIBRARY_VERSION >= 3
5294extern simd_float4 _simd_log1p_f4(simd_float4 x);
5295static inline SIMD_CFUNC simd_float4 __tg_log1p(simd_float4 x) {
5296 return _simd_log1p_f4(x);
5297}
5298#else
5299static inline SIMD_CFUNC simd_float4 __tg_log1p(simd_float4 x) {
5300 return simd_make_float4(log1p(x.x), log1p(x.y), log1p(x.z), log1p(x.w));
5301}
5302#endif
5303
5304#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5305extern simd_float8 _simd_log1p_f8(simd_float8 x);
5306static inline SIMD_CFUNC simd_float8 __tg_log1p(simd_float8 x) {
5307 return _simd_log1p_f8(x);
5308}
5309#else
5310static inline SIMD_CFUNC simd_float8 __tg_log1p(simd_float8 x) {
5311 return simd_make_float8(__tg_log1p(x.lo), __tg_log1p(x.hi));
5312}
5313#endif
5314
5315#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5316extern simd_float16 _simd_log1p_f16(simd_float16 x);
5317static inline SIMD_CFUNC simd_float16 __tg_log1p(simd_float16 x) {
5318 return _simd_log1p_f16(x);
5319}
5320#else
5321static inline SIMD_CFUNC simd_float16 __tg_log1p(simd_float16 x) {
5322 return simd_make_float16(__tg_log1p(x.lo), __tg_log1p(x.hi));
5323}
5324#endif
5325
5326#if SIMD_LIBRARY_VERSION >= 3
5327extern simd_double2 _simd_log1p_d2(simd_double2 x);
5328static inline SIMD_CFUNC simd_double2 __tg_log1p(simd_double2 x) {
5329 return _simd_log1p_d2(x);
5330}
5331#else
5332static inline SIMD_CFUNC simd_double2 __tg_log1p(simd_double2 x) {
5333 return simd_make_double2(log1p(x.x), log1p(x.y));
5334}
5335#endif
5336
5337static inline SIMD_CFUNC simd_double3 __tg_log1p(simd_double3 x) {
5338 return simd_make_double3(__tg_log1p(simd_make_double4(x)));
5339}
5340
5341#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5342extern simd_double4 _simd_log1p_d4(simd_double4 x);
5343static inline SIMD_CFUNC simd_double4 __tg_log1p(simd_double4 x) {
5344 return _simd_log1p_d4(x);
5345}
5346#else
5347static inline SIMD_CFUNC simd_double4 __tg_log1p(simd_double4 x) {
5348 return simd_make_double4(__tg_log1p(x.lo), __tg_log1p(x.hi));
5349}
5350#endif
5351
5352#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5353extern simd_double8 _simd_log1p_d8(simd_double8 x);
5354static inline SIMD_CFUNC simd_double8 __tg_log1p(simd_double8 x) {
5355 return _simd_log1p_d8(x);
5356}
5357#else
5358static inline SIMD_CFUNC simd_double8 __tg_log1p(simd_double8 x) {
5359 return simd_make_double8(__tg_log1p(x.lo), __tg_log1p(x.hi));
5360}
5361#endif
5362
5363#pragma mark - cbrt implementation
5364static inline SIMD_CFUNC simd_float2 __tg_cbrt(simd_float2 x) {
5365 return simd_make_float2(__tg_cbrt(simd_make_float4(x)));
5366}
5367
5368static inline SIMD_CFUNC simd_float3 __tg_cbrt(simd_float3 x) {
5369 return simd_make_float3(__tg_cbrt(simd_make_float4(x)));
5370}
5371
5372#if SIMD_LIBRARY_VERSION >= 3
5373extern simd_float4 _simd_cbrt_f4(simd_float4 x);
5374static inline SIMD_CFUNC simd_float4 __tg_cbrt(simd_float4 x) {
5375 return _simd_cbrt_f4(x);
5376}
5377#else
5378static inline SIMD_CFUNC simd_float4 __tg_cbrt(simd_float4 x) {
5379 return simd_make_float4(cbrt(x.x), cbrt(x.y), cbrt(x.z), cbrt(x.w));
5380}
5381#endif
5382
5383#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5384extern simd_float8 _simd_cbrt_f8(simd_float8 x);
5385static inline SIMD_CFUNC simd_float8 __tg_cbrt(simd_float8 x) {
5386 return _simd_cbrt_f8(x);
5387}
5388#else
5389static inline SIMD_CFUNC simd_float8 __tg_cbrt(simd_float8 x) {
5390 return simd_make_float8(__tg_cbrt(x.lo), __tg_cbrt(x.hi));
5391}
5392#endif
5393
5394#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5395extern simd_float16 _simd_cbrt_f16(simd_float16 x);
5396static inline SIMD_CFUNC simd_float16 __tg_cbrt(simd_float16 x) {
5397 return _simd_cbrt_f16(x);
5398}
5399#else
5400static inline SIMD_CFUNC simd_float16 __tg_cbrt(simd_float16 x) {
5401 return simd_make_float16(__tg_cbrt(x.lo), __tg_cbrt(x.hi));
5402}
5403#endif
5404
5405#if SIMD_LIBRARY_VERSION >= 3
5406extern simd_double2 _simd_cbrt_d2(simd_double2 x);
5407static inline SIMD_CFUNC simd_double2 __tg_cbrt(simd_double2 x) {
5408 return _simd_cbrt_d2(x);
5409}
5410#else
5411static inline SIMD_CFUNC simd_double2 __tg_cbrt(simd_double2 x) {
5412 return simd_make_double2(cbrt(x.x), cbrt(x.y));
5413}
5414#endif
5415
5416static inline SIMD_CFUNC simd_double3 __tg_cbrt(simd_double3 x) {
5417 return simd_make_double3(__tg_cbrt(simd_make_double4(x)));
5418}
5419
5420#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5421extern simd_double4 _simd_cbrt_d4(simd_double4 x);
5422static inline SIMD_CFUNC simd_double4 __tg_cbrt(simd_double4 x) {
5423 return _simd_cbrt_d4(x);
5424}
5425#else
5426static inline SIMD_CFUNC simd_double4 __tg_cbrt(simd_double4 x) {
5427 return simd_make_double4(__tg_cbrt(x.lo), __tg_cbrt(x.hi));
5428}
5429#endif
5430
5431#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5432extern simd_double8 _simd_cbrt_d8(simd_double8 x);
5433static inline SIMD_CFUNC simd_double8 __tg_cbrt(simd_double8 x) {
5434 return _simd_cbrt_d8(x);
5435}
5436#else
5437static inline SIMD_CFUNC simd_double8 __tg_cbrt(simd_double8 x) {
5438 return simd_make_double8(__tg_cbrt(x.lo), __tg_cbrt(x.hi));
5439}
5440#endif
5441
5442#pragma mark - erf implementation
5443static inline SIMD_CFUNC simd_float2 __tg_erf(simd_float2 x) {
5444 return simd_make_float2(__tg_erf(simd_make_float4(x)));
5445}
5446
5447static inline SIMD_CFUNC simd_float3 __tg_erf(simd_float3 x) {
5448 return simd_make_float3(__tg_erf(simd_make_float4(x)));
5449}
5450
5451#if SIMD_LIBRARY_VERSION >= 3
5452extern simd_float4 _simd_erf_f4(simd_float4 x);
5453static inline SIMD_CFUNC simd_float4 __tg_erf(simd_float4 x) {
5454 return _simd_erf_f4(x);
5455}
5456#else
5457static inline SIMD_CFUNC simd_float4 __tg_erf(simd_float4 x) {
5458 return simd_make_float4(erf(x.x), erf(x.y), erf(x.z), erf(x.w));
5459}
5460#endif
5461
5462#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5463extern simd_float8 _simd_erf_f8(simd_float8 x);
5464static inline SIMD_CFUNC simd_float8 __tg_erf(simd_float8 x) {
5465 return _simd_erf_f8(x);
5466}
5467#else
5468static inline SIMD_CFUNC simd_float8 __tg_erf(simd_float8 x) {
5469 return simd_make_float8(__tg_erf(x.lo), __tg_erf(x.hi));
5470}
5471#endif
5472
5473#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5474extern simd_float16 _simd_erf_f16(simd_float16 x);
5475static inline SIMD_CFUNC simd_float16 __tg_erf(simd_float16 x) {
5476 return _simd_erf_f16(x);
5477}
5478#else
5479static inline SIMD_CFUNC simd_float16 __tg_erf(simd_float16 x) {
5480 return simd_make_float16(__tg_erf(x.lo), __tg_erf(x.hi));
5481}
5482#endif
5483
5484#if SIMD_LIBRARY_VERSION >= 3
5485extern simd_double2 _simd_erf_d2(simd_double2 x);
5486static inline SIMD_CFUNC simd_double2 __tg_erf(simd_double2 x) {
5487 return _simd_erf_d2(x);
5488}
5489#else
5490static inline SIMD_CFUNC simd_double2 __tg_erf(simd_double2 x) {
5491 return simd_make_double2(erf(x.x), erf(x.y));
5492}
5493#endif
5494
5495static inline SIMD_CFUNC simd_double3 __tg_erf(simd_double3 x) {
5496 return simd_make_double3(__tg_erf(simd_make_double4(x)));
5497}
5498
5499#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5500extern simd_double4 _simd_erf_d4(simd_double4 x);
5501static inline SIMD_CFUNC simd_double4 __tg_erf(simd_double4 x) {
5502 return _simd_erf_d4(x);
5503}
5504#else
5505static inline SIMD_CFUNC simd_double4 __tg_erf(simd_double4 x) {
5506 return simd_make_double4(__tg_erf(x.lo), __tg_erf(x.hi));
5507}
5508#endif
5509
5510#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5511extern simd_double8 _simd_erf_d8(simd_double8 x);
5512static inline SIMD_CFUNC simd_double8 __tg_erf(simd_double8 x) {
5513 return _simd_erf_d8(x);
5514}
5515#else
5516static inline SIMD_CFUNC simd_double8 __tg_erf(simd_double8 x) {
5517 return simd_make_double8(__tg_erf(x.lo), __tg_erf(x.hi));
5518}
5519#endif
5520
5521#pragma mark - erfc implementation
5522static inline SIMD_CFUNC simd_float2 __tg_erfc(simd_float2 x) {
5523 return simd_make_float2(__tg_erfc(simd_make_float4(x)));
5524}
5525
5526static inline SIMD_CFUNC simd_float3 __tg_erfc(simd_float3 x) {
5527 return simd_make_float3(__tg_erfc(simd_make_float4(x)));
5528}
5529
5530#if SIMD_LIBRARY_VERSION >= 3
5531extern simd_float4 _simd_erfc_f4(simd_float4 x);
5532static inline SIMD_CFUNC simd_float4 __tg_erfc(simd_float4 x) {
5533 return _simd_erfc_f4(x);
5534}
5535#else
5536static inline SIMD_CFUNC simd_float4 __tg_erfc(simd_float4 x) {
5537 return simd_make_float4(erfc(x.x), erfc(x.y), erfc(x.z), erfc(x.w));
5538}
5539#endif
5540
5541#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5542extern simd_float8 _simd_erfc_f8(simd_float8 x);
5543static inline SIMD_CFUNC simd_float8 __tg_erfc(simd_float8 x) {
5544 return _simd_erfc_f8(x);
5545}
5546#else
5547static inline SIMD_CFUNC simd_float8 __tg_erfc(simd_float8 x) {
5548 return simd_make_float8(__tg_erfc(x.lo), __tg_erfc(x.hi));
5549}
5550#endif
5551
5552#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5553extern simd_float16 _simd_erfc_f16(simd_float16 x);
5554static inline SIMD_CFUNC simd_float16 __tg_erfc(simd_float16 x) {
5555 return _simd_erfc_f16(x);
5556}
5557#else
5558static inline SIMD_CFUNC simd_float16 __tg_erfc(simd_float16 x) {
5559 return simd_make_float16(__tg_erfc(x.lo), __tg_erfc(x.hi));
5560}
5561#endif
5562
5563#if SIMD_LIBRARY_VERSION >= 3
5564extern simd_double2 _simd_erfc_d2(simd_double2 x);
5565static inline SIMD_CFUNC simd_double2 __tg_erfc(simd_double2 x) {
5566 return _simd_erfc_d2(x);
5567}
5568#else
5569static inline SIMD_CFUNC simd_double2 __tg_erfc(simd_double2 x) {
5570 return simd_make_double2(erfc(x.x), erfc(x.y));
5571}
5572#endif
5573
5574static inline SIMD_CFUNC simd_double3 __tg_erfc(simd_double3 x) {
5575 return simd_make_double3(__tg_erfc(simd_make_double4(x)));
5576}
5577
5578#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5579extern simd_double4 _simd_erfc_d4(simd_double4 x);
5580static inline SIMD_CFUNC simd_double4 __tg_erfc(simd_double4 x) {
5581 return _simd_erfc_d4(x);
5582}
5583#else
5584static inline SIMD_CFUNC simd_double4 __tg_erfc(simd_double4 x) {
5585 return simd_make_double4(__tg_erfc(x.lo), __tg_erfc(x.hi));
5586}
5587#endif
5588
5589#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5590extern simd_double8 _simd_erfc_d8(simd_double8 x);
5591static inline SIMD_CFUNC simd_double8 __tg_erfc(simd_double8 x) {
5592 return _simd_erfc_d8(x);
5593}
5594#else
5595static inline SIMD_CFUNC simd_double8 __tg_erfc(simd_double8 x) {
5596 return simd_make_double8(__tg_erfc(x.lo), __tg_erfc(x.hi));
5597}
5598#endif
5599
5600#pragma mark - tgamma implementation
5601static inline SIMD_CFUNC simd_float2 __tg_tgamma(simd_float2 x) {
5602 return simd_make_float2(__tg_tgamma(simd_make_float4(x)));
5603}
5604
5605static inline SIMD_CFUNC simd_float3 __tg_tgamma(simd_float3 x) {
5606 return simd_make_float3(__tg_tgamma(simd_make_float4(x)));
5607}
5608
5609#if SIMD_LIBRARY_VERSION >= 3
5610extern simd_float4 _simd_tgamma_f4(simd_float4 x);
5611static inline SIMD_CFUNC simd_float4 __tg_tgamma(simd_float4 x) {
5612 return _simd_tgamma_f4(x);
5613}
5614#else
5615static inline SIMD_CFUNC simd_float4 __tg_tgamma(simd_float4 x) {
5616 return simd_make_float4(tgamma(x.x), tgamma(x.y), tgamma(x.z), tgamma(x.w));
5617}
5618#endif
5619
5620#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5621extern simd_float8 _simd_tgamma_f8(simd_float8 x);
5622static inline SIMD_CFUNC simd_float8 __tg_tgamma(simd_float8 x) {
5623 return _simd_tgamma_f8(x);
5624}
5625#else
5626static inline SIMD_CFUNC simd_float8 __tg_tgamma(simd_float8 x) {
5627 return simd_make_float8(__tg_tgamma(x.lo), __tg_tgamma(x.hi));
5628}
5629#endif
5630
5631#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5632extern simd_float16 _simd_tgamma_f16(simd_float16 x);
5633static inline SIMD_CFUNC simd_float16 __tg_tgamma(simd_float16 x) {
5634 return _simd_tgamma_f16(x);
5635}
5636#else
5637static inline SIMD_CFUNC simd_float16 __tg_tgamma(simd_float16 x) {
5638 return simd_make_float16(__tg_tgamma(x.lo), __tg_tgamma(x.hi));
5639}
5640#endif
5641
5642#if SIMD_LIBRARY_VERSION >= 3
5643extern simd_double2 _simd_tgamma_d2(simd_double2 x);
5644static inline SIMD_CFUNC simd_double2 __tg_tgamma(simd_double2 x) {
5645 return _simd_tgamma_d2(x);
5646}
5647#else
5648static inline SIMD_CFUNC simd_double2 __tg_tgamma(simd_double2 x) {
5649 return simd_make_double2(tgamma(x.x), tgamma(x.y));
5650}
5651#endif
5652
5653static inline SIMD_CFUNC simd_double3 __tg_tgamma(simd_double3 x) {
5654 return simd_make_double3(__tg_tgamma(simd_make_double4(x)));
5655}
5656
5657#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5658extern simd_double4 _simd_tgamma_d4(simd_double4 x);
5659static inline SIMD_CFUNC simd_double4 __tg_tgamma(simd_double4 x) {
5660 return _simd_tgamma_d4(x);
5661}
5662#else
5663static inline SIMD_CFUNC simd_double4 __tg_tgamma(simd_double4 x) {
5664 return simd_make_double4(__tg_tgamma(x.lo), __tg_tgamma(x.hi));
5665}
5666#endif
5667
5668#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5669extern simd_double8 _simd_tgamma_d8(simd_double8 x);
5670static inline SIMD_CFUNC simd_double8 __tg_tgamma(simd_double8 x) {
5671 return _simd_tgamma_d8(x);
5672}
5673#else
5674static inline SIMD_CFUNC simd_double8 __tg_tgamma(simd_double8 x) {
5675 return simd_make_double8(__tg_tgamma(x.lo), __tg_tgamma(x.hi));
5676}
5677#endif
5678
5679#pragma mark - round implementation
5680static inline SIMD_CFUNC simd_float2 __tg_round(simd_float2 x) {
5681 return simd_make_float2(__tg_round(simd_make_float4(x)));
5682}
5683
5684static inline SIMD_CFUNC simd_float3 __tg_round(simd_float3 x) {
5685 return simd_make_float3(__tg_round(simd_make_float4(x)));
5686}
5687
5688#if SIMD_LIBRARY_VERSION >= 3
5689extern simd_float4 _simd_round_f4(simd_float4 x);
5690static inline SIMD_CFUNC simd_float4 __tg_round(simd_float4 x) {
5691#if defined __arm64__ || defined __aarch64__
5692 return vrndaq_f32(x);
5693#else
5694 return _simd_round_f4(x);
5695#endif
5696}
5697#else
5698static inline SIMD_CFUNC simd_float4 __tg_round(simd_float4 x) {
5699 return simd_make_float4(round(x.x), round(x.y), round(x.z), round(x.w));
5700}
5701#endif
5702
5703#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5704extern simd_float8 _simd_round_f8(simd_float8 x);
5705static inline SIMD_CFUNC simd_float8 __tg_round(simd_float8 x) {
5706 return _simd_round_f8(x);
5707}
5708#else
5709static inline SIMD_CFUNC simd_float8 __tg_round(simd_float8 x) {
5710 return simd_make_float8(__tg_round(x.lo), __tg_round(x.hi));
5711}
5712#endif
5713
5714#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5715extern simd_float16 _simd_round_f16(simd_float16 x);
5716static inline SIMD_CFUNC simd_float16 __tg_round(simd_float16 x) {
5717 return _simd_round_f16(x);
5718}
5719#else
5720static inline SIMD_CFUNC simd_float16 __tg_round(simd_float16 x) {
5721 return simd_make_float16(__tg_round(x.lo), __tg_round(x.hi));
5722}
5723#endif
5724
5725#if SIMD_LIBRARY_VERSION >= 3
5726extern simd_double2 _simd_round_d2(simd_double2 x);
5727static inline SIMD_CFUNC simd_double2 __tg_round(simd_double2 x) {
5728#if defined __arm64__ || defined __aarch64__
5729 return vrndaq_f64(x);
5730#else
5731 return _simd_round_d2(x);
5732#endif
5733}
5734#else
5735static inline SIMD_CFUNC simd_double2 __tg_round(simd_double2 x) {
5736 return simd_make_double2(round(x.x), round(x.y));
5737}
5738#endif
5739
5740static inline SIMD_CFUNC simd_double3 __tg_round(simd_double3 x) {
5741 return simd_make_double3(__tg_round(simd_make_double4(x)));
5742}
5743
5744#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5745extern simd_double4 _simd_round_d4(simd_double4 x);
5746static inline SIMD_CFUNC simd_double4 __tg_round(simd_double4 x) {
5747 return _simd_round_d4(x);
5748}
5749#else
5750static inline SIMD_CFUNC simd_double4 __tg_round(simd_double4 x) {
5751 return simd_make_double4(__tg_round(x.lo), __tg_round(x.hi));
5752}
5753#endif
5754
5755#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5756extern simd_double8 _simd_round_d8(simd_double8 x);
5757static inline SIMD_CFUNC simd_double8 __tg_round(simd_double8 x) {
5758 return _simd_round_d8(x);
5759}
5760#else
5761static inline SIMD_CFUNC simd_double8 __tg_round(simd_double8 x) {
5762 return simd_make_double8(__tg_round(x.lo), __tg_round(x.hi));
5763}
5764#endif
5765
5766#pragma mark - atan2 implementation
5767static inline SIMD_CFUNC simd_float2 __tg_atan2(simd_float2 y, simd_float2 x) {
5768 return simd_make_float2(__tg_atan2(simd_make_float4(y), simd_make_float4(x)));
5769}
5770
5771static inline SIMD_CFUNC simd_float3 __tg_atan2(simd_float3 y, simd_float3 x) {
5772 return simd_make_float3(__tg_atan2(simd_make_float4(y), simd_make_float4(x)));
5773}
5774
5775#if SIMD_LIBRARY_VERSION >= 3
5776extern simd_float4 _simd_atan2_f4(simd_float4 y, simd_float4 x);
5777static inline SIMD_CFUNC simd_float4 __tg_atan2(simd_float4 y, simd_float4 x) {
5778 return _simd_atan2_f4(y, x);
5779}
5780#else
5781static inline SIMD_CFUNC simd_float4 __tg_atan2(simd_float4 y, simd_float4 x) {
5782 return simd_make_float4(atan2(y.x, x.x), atan2(y.y, x.y), atan2(y.z, x.z), atan2(y.w, x.w));
5783}
5784#endif
5785
5786#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5787extern simd_float8 _simd_atan2_f8(simd_float8 y, simd_float8 x);
5788static inline SIMD_CFUNC simd_float8 __tg_atan2(simd_float8 y, simd_float8 x) {
5789 return _simd_atan2_f8(y, x);
5790}
5791#else
5792static inline SIMD_CFUNC simd_float8 __tg_atan2(simd_float8 y, simd_float8 x) {
5793 return simd_make_float8(__tg_atan2(y.lo, x.lo), __tg_atan2(y.hi, x.hi));
5794}
5795#endif
5796
5797#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5798extern simd_float16 _simd_atan2_f16(simd_float16 y, simd_float16 x);
5799static inline SIMD_CFUNC simd_float16 __tg_atan2(simd_float16 y, simd_float16 x) {
5800 return _simd_atan2_f16(y, x);
5801}
5802#else
5803static inline SIMD_CFUNC simd_float16 __tg_atan2(simd_float16 y, simd_float16 x) {
5804 return simd_make_float16(__tg_atan2(y.lo, x.lo), __tg_atan2(y.hi, x.hi));
5805}
5806#endif
5807
5808#if SIMD_LIBRARY_VERSION >= 3
5809extern simd_double2 _simd_atan2_d2(simd_double2 y, simd_double2 x);
5810static inline SIMD_CFUNC simd_double2 __tg_atan2(simd_double2 y, simd_double2 x) {
5811 return _simd_atan2_d2(y, x);
5812}
5813#else
5814static inline SIMD_CFUNC simd_double2 __tg_atan2(simd_double2 y, simd_double2 x) {
5815 return simd_make_double2(atan2(y.x, x.x), atan2(y.y, x.y));
5816}
5817#endif
5818
5819static inline SIMD_CFUNC simd_double3 __tg_atan2(simd_double3 y, simd_double3 x) {
5820 return simd_make_double3(__tg_atan2(simd_make_double4(y), simd_make_double4(x)));
5821}
5822
5823#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5824extern simd_double4 _simd_atan2_d4(simd_double4 y, simd_double4 x);
5825static inline SIMD_CFUNC simd_double4 __tg_atan2(simd_double4 y, simd_double4 x) {
5826 return _simd_atan2_d4(y, x);
5827}
5828#else
5829static inline SIMD_CFUNC simd_double4 __tg_atan2(simd_double4 y, simd_double4 x) {
5830 return simd_make_double4(__tg_atan2(y.lo, x.lo), __tg_atan2(y.hi, x.hi));
5831}
5832#endif
5833
5834#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5835extern simd_double8 _simd_atan2_d8(simd_double8 y, simd_double8 x);
5836static inline SIMD_CFUNC simd_double8 __tg_atan2(simd_double8 y, simd_double8 x) {
5837 return _simd_atan2_d8(y, x);
5838}
5839#else
5840static inline SIMD_CFUNC simd_double8 __tg_atan2(simd_double8 y, simd_double8 x) {
5841 return simd_make_double8(__tg_atan2(y.lo, x.lo), __tg_atan2(y.hi, x.hi));
5842}
5843#endif
5844
5845#pragma mark - hypot implementation
5846static inline SIMD_CFUNC simd_float2 __tg_hypot(simd_float2 x, simd_float2 y) {
5847 return simd_make_float2(__tg_hypot(simd_make_float4(x), simd_make_float4(y)));
5848}
5849
5850static inline SIMD_CFUNC simd_float3 __tg_hypot(simd_float3 x, simd_float3 y) {
5851 return simd_make_float3(__tg_hypot(simd_make_float4(x), simd_make_float4(y)));
5852}
5853
5854#if SIMD_LIBRARY_VERSION >= 3
5855extern simd_float4 _simd_hypot_f4(simd_float4 x, simd_float4 y);
5856static inline SIMD_CFUNC simd_float4 __tg_hypot(simd_float4 x, simd_float4 y) {
5857 return _simd_hypot_f4(x, y);
5858}
5859#else
5860static inline SIMD_CFUNC simd_float4 __tg_hypot(simd_float4 x, simd_float4 y) {
5861 return simd_make_float4(hypot(x.x, y.x), hypot(x.y, y.y), hypot(x.z, y.z), hypot(x.w, y.w));
5862}
5863#endif
5864
5865#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5866extern simd_float8 _simd_hypot_f8(simd_float8 x, simd_float8 y);
5867static inline SIMD_CFUNC simd_float8 __tg_hypot(simd_float8 x, simd_float8 y) {
5868 return _simd_hypot_f8(x, y);
5869}
5870#else
5871static inline SIMD_CFUNC simd_float8 __tg_hypot(simd_float8 x, simd_float8 y) {
5872 return simd_make_float8(__tg_hypot(x.lo, y.lo), __tg_hypot(x.hi, y.hi));
5873}
5874#endif
5875
5876#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5877extern simd_float16 _simd_hypot_f16(simd_float16 x, simd_float16 y);
5878static inline SIMD_CFUNC simd_float16 __tg_hypot(simd_float16 x, simd_float16 y) {
5879 return _simd_hypot_f16(x, y);
5880}
5881#else
5882static inline SIMD_CFUNC simd_float16 __tg_hypot(simd_float16 x, simd_float16 y) {
5883 return simd_make_float16(__tg_hypot(x.lo, y.lo), __tg_hypot(x.hi, y.hi));
5884}
5885#endif
5886
5887#if SIMD_LIBRARY_VERSION >= 3
5888extern simd_double2 _simd_hypot_d2(simd_double2 x, simd_double2 y);
5889static inline SIMD_CFUNC simd_double2 __tg_hypot(simd_double2 x, simd_double2 y) {
5890 return _simd_hypot_d2(x, y);
5891}
5892#else
5893static inline SIMD_CFUNC simd_double2 __tg_hypot(simd_double2 x, simd_double2 y) {
5894 return simd_make_double2(hypot(x.x, y.x), hypot(x.y, y.y));
5895}
5896#endif
5897
5898static inline SIMD_CFUNC simd_double3 __tg_hypot(simd_double3 x, simd_double3 y) {
5899 return simd_make_double3(__tg_hypot(simd_make_double4(x), simd_make_double4(y)));
5900}
5901
5902#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5903extern simd_double4 _simd_hypot_d4(simd_double4 x, simd_double4 y);
5904static inline SIMD_CFUNC simd_double4 __tg_hypot(simd_double4 x, simd_double4 y) {
5905 return _simd_hypot_d4(x, y);
5906}
5907#else
5908static inline SIMD_CFUNC simd_double4 __tg_hypot(simd_double4 x, simd_double4 y) {
5909 return simd_make_double4(__tg_hypot(x.lo, y.lo), __tg_hypot(x.hi, y.hi));
5910}
5911#endif
5912
5913#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5914extern simd_double8 _simd_hypot_d8(simd_double8 x, simd_double8 y);
5915static inline SIMD_CFUNC simd_double8 __tg_hypot(simd_double8 x, simd_double8 y) {
5916 return _simd_hypot_d8(x, y);
5917}
5918#else
5919static inline SIMD_CFUNC simd_double8 __tg_hypot(simd_double8 x, simd_double8 y) {
5920 return simd_make_double8(__tg_hypot(x.lo, y.lo), __tg_hypot(x.hi, y.hi));
5921}
5922#endif
5923
5924#pragma mark - pow implementation
5925static inline SIMD_CFUNC simd_float2 __tg_pow(simd_float2 x, simd_float2 y) {
5926 return simd_make_float2(__tg_pow(simd_make_float4(x), simd_make_float4(y)));
5927}
5928
5929static inline SIMD_CFUNC simd_float3 __tg_pow(simd_float3 x, simd_float3 y) {
5930 return simd_make_float3(__tg_pow(simd_make_float4(x), simd_make_float4(y)));
5931}
5932
5933#if SIMD_LIBRARY_VERSION >= 3
5934extern simd_float4 _simd_pow_f4(simd_float4 x, simd_float4 y);
5935static inline SIMD_CFUNC simd_float4 __tg_pow(simd_float4 x, simd_float4 y) {
5936 return _simd_pow_f4(x, y);
5937}
5938#else
5939static inline SIMD_CFUNC simd_float4 __tg_pow(simd_float4 x, simd_float4 y) {
5940 return simd_make_float4(pow(x.x, y.x), pow(x.y, y.y), pow(x.z, y.z), pow(x.w, y.w));
5941}
5942#endif
5943
5944#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5945extern simd_float8 _simd_pow_f8(simd_float8 x, simd_float8 y);
5946static inline SIMD_CFUNC simd_float8 __tg_pow(simd_float8 x, simd_float8 y) {
5947 return _simd_pow_f8(x, y);
5948}
5949#else
5950static inline SIMD_CFUNC simd_float8 __tg_pow(simd_float8 x, simd_float8 y) {
5951 return simd_make_float8(__tg_pow(x.lo, y.lo), __tg_pow(x.hi, y.hi));
5952}
5953#endif
5954
5955#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5956extern simd_float16 _simd_pow_f16(simd_float16 x, simd_float16 y);
5957static inline SIMD_CFUNC simd_float16 __tg_pow(simd_float16 x, simd_float16 y) {
5958 return _simd_pow_f16(x, y);
5959}
5960#else
5961static inline SIMD_CFUNC simd_float16 __tg_pow(simd_float16 x, simd_float16 y) {
5962 return simd_make_float16(__tg_pow(x.lo, y.lo), __tg_pow(x.hi, y.hi));
5963}
5964#endif
5965
5966#if SIMD_LIBRARY_VERSION >= 3
5967extern simd_double2 _simd_pow_d2(simd_double2 x, simd_double2 y);
5968static inline SIMD_CFUNC simd_double2 __tg_pow(simd_double2 x, simd_double2 y) {
5969 return _simd_pow_d2(x, y);
5970}
5971#else
5972static inline SIMD_CFUNC simd_double2 __tg_pow(simd_double2 x, simd_double2 y) {
5973 return simd_make_double2(pow(x.x, y.x), pow(x.y, y.y));
5974}
5975#endif
5976
5977static inline SIMD_CFUNC simd_double3 __tg_pow(simd_double3 x, simd_double3 y) {
5978 return simd_make_double3(__tg_pow(simd_make_double4(x), simd_make_double4(y)));
5979}
5980
5981#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
5982extern simd_double4 _simd_pow_d4(simd_double4 x, simd_double4 y);
5983static inline SIMD_CFUNC simd_double4 __tg_pow(simd_double4 x, simd_double4 y) {
5984 return _simd_pow_d4(x, y);
5985}
5986#else
5987static inline SIMD_CFUNC simd_double4 __tg_pow(simd_double4 x, simd_double4 y) {
5988 return simd_make_double4(__tg_pow(x.lo, y.lo), __tg_pow(x.hi, y.hi));
5989}
5990#endif
5991
5992#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
5993extern simd_double8 _simd_pow_d8(simd_double8 x, simd_double8 y);
5994static inline SIMD_CFUNC simd_double8 __tg_pow(simd_double8 x, simd_double8 y) {
5995 return _simd_pow_d8(x, y);
5996}
5997#else
5998static inline SIMD_CFUNC simd_double8 __tg_pow(simd_double8 x, simd_double8 y) {
5999 return simd_make_double8(__tg_pow(x.lo, y.lo), __tg_pow(x.hi, y.hi));
6000}
6001#endif
6002
6003#pragma mark - fmod implementation
6004static inline SIMD_CFUNC simd_float2 __tg_fmod(simd_float2 x, simd_float2 y) {
6005 return simd_make_float2(__tg_fmod(simd_make_float4(x), simd_make_float4(y)));
6006}
6007
6008static inline SIMD_CFUNC simd_float3 __tg_fmod(simd_float3 x, simd_float3 y) {
6009 return simd_make_float3(__tg_fmod(simd_make_float4(x), simd_make_float4(y)));
6010}
6011
6012#if SIMD_LIBRARY_VERSION >= 3
6013extern simd_float4 _simd_fmod_f4(simd_float4 x, simd_float4 y);
6014static inline SIMD_CFUNC simd_float4 __tg_fmod(simd_float4 x, simd_float4 y) {
6015 return _simd_fmod_f4(x, y);
6016}
6017#else
6018static inline SIMD_CFUNC simd_float4 __tg_fmod(simd_float4 x, simd_float4 y) {
6019 return simd_make_float4(fmod(x.x, y.x), fmod(x.y, y.y), fmod(x.z, y.z), fmod(x.w, y.w));
6020}
6021#endif
6022
6023#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
6024extern simd_float8 _simd_fmod_f8(simd_float8 x, simd_float8 y);
6025static inline SIMD_CFUNC simd_float8 __tg_fmod(simd_float8 x, simd_float8 y) {
6026 return _simd_fmod_f8(x, y);
6027}
6028#else
6029static inline SIMD_CFUNC simd_float8 __tg_fmod(simd_float8 x, simd_float8 y) {
6030 return simd_make_float8(__tg_fmod(x.lo, y.lo), __tg_fmod(x.hi, y.hi));
6031}
6032#endif
6033
6034#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
6035extern simd_float16 _simd_fmod_f16(simd_float16 x, simd_float16 y);
6036static inline SIMD_CFUNC simd_float16 __tg_fmod(simd_float16 x, simd_float16 y) {
6037 return _simd_fmod_f16(x, y);
6038}
6039#else
6040static inline SIMD_CFUNC simd_float16 __tg_fmod(simd_float16 x, simd_float16 y) {
6041 return simd_make_float16(__tg_fmod(x.lo, y.lo), __tg_fmod(x.hi, y.hi));
6042}
6043#endif
6044
6045#if SIMD_LIBRARY_VERSION >= 3
6046extern simd_double2 _simd_fmod_d2(simd_double2 x, simd_double2 y);
6047static inline SIMD_CFUNC simd_double2 __tg_fmod(simd_double2 x, simd_double2 y) {
6048 return _simd_fmod_d2(x, y);
6049}
6050#else
6051static inline SIMD_CFUNC simd_double2 __tg_fmod(simd_double2 x, simd_double2 y) {
6052 return simd_make_double2(fmod(x.x, y.x), fmod(x.y, y.y));
6053}
6054#endif
6055
6056static inline SIMD_CFUNC simd_double3 __tg_fmod(simd_double3 x, simd_double3 y) {
6057 return simd_make_double3(__tg_fmod(simd_make_double4(x), simd_make_double4(y)));
6058}
6059
6060#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
6061extern simd_double4 _simd_fmod_d4(simd_double4 x, simd_double4 y);
6062static inline SIMD_CFUNC simd_double4 __tg_fmod(simd_double4 x, simd_double4 y) {
6063 return _simd_fmod_d4(x, y);
6064}
6065#else
6066static inline SIMD_CFUNC simd_double4 __tg_fmod(simd_double4 x, simd_double4 y) {
6067 return simd_make_double4(__tg_fmod(x.lo, y.lo), __tg_fmod(x.hi, y.hi));
6068}
6069#endif
6070
6071#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
6072extern simd_double8 _simd_fmod_d8(simd_double8 x, simd_double8 y);
6073static inline SIMD_CFUNC simd_double8 __tg_fmod(simd_double8 x, simd_double8 y) {
6074 return _simd_fmod_d8(x, y);
6075}
6076#else
6077static inline SIMD_CFUNC simd_double8 __tg_fmod(simd_double8 x, simd_double8 y) {
6078 return simd_make_double8(__tg_fmod(x.lo, y.lo), __tg_fmod(x.hi, y.hi));
6079}
6080#endif
6081
6082#pragma mark - remainder implementation
6083static inline SIMD_CFUNC simd_float2 __tg_remainder(simd_float2 x, simd_float2 y) {
6084 return simd_make_float2(__tg_remainder(simd_make_float4(x), simd_make_float4(y)));
6085}
6086
6087static inline SIMD_CFUNC simd_float3 __tg_remainder(simd_float3 x, simd_float3 y) {
6088 return simd_make_float3(__tg_remainder(simd_make_float4(x), simd_make_float4(y)));
6089}
6090
6091#if SIMD_LIBRARY_VERSION >= 3
6092extern simd_float4 _simd_remainder_f4(simd_float4 x, simd_float4 y);
6093static inline SIMD_CFUNC simd_float4 __tg_remainder(simd_float4 x, simd_float4 y) {
6094 return _simd_remainder_f4(x, y);
6095}
6096#else
6097static inline SIMD_CFUNC simd_float4 __tg_remainder(simd_float4 x, simd_float4 y) {
6098 return simd_make_float4(remainder(x.x, y.x), remainder(x.y, y.y), remainder(x.z, y.z), remainder(x.w, y.w));
6099}
6100#endif
6101
6102#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
6103extern simd_float8 _simd_remainder_f8(simd_float8 x, simd_float8 y);
6104static inline SIMD_CFUNC simd_float8 __tg_remainder(simd_float8 x, simd_float8 y) {
6105 return _simd_remainder_f8(x, y);
6106}
6107#else
6108static inline SIMD_CFUNC simd_float8 __tg_remainder(simd_float8 x, simd_float8 y) {
6109 return simd_make_float8(__tg_remainder(x.lo, y.lo), __tg_remainder(x.hi, y.hi));
6110}
6111#endif
6112
6113#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
6114extern simd_float16 _simd_remainder_f16(simd_float16 x, simd_float16 y);
6115static inline SIMD_CFUNC simd_float16 __tg_remainder(simd_float16 x, simd_float16 y) {
6116 return _simd_remainder_f16(x, y);
6117}
6118#else
6119static inline SIMD_CFUNC simd_float16 __tg_remainder(simd_float16 x, simd_float16 y) {
6120 return simd_make_float16(__tg_remainder(x.lo, y.lo), __tg_remainder(x.hi, y.hi));
6121}
6122#endif
6123
6124#if SIMD_LIBRARY_VERSION >= 3
6125extern simd_double2 _simd_remainder_d2(simd_double2 x, simd_double2 y);
6126static inline SIMD_CFUNC simd_double2 __tg_remainder(simd_double2 x, simd_double2 y) {
6127 return _simd_remainder_d2(x, y);
6128}
6129#else
6130static inline SIMD_CFUNC simd_double2 __tg_remainder(simd_double2 x, simd_double2 y) {
6131 return simd_make_double2(remainder(x.x, y.x), remainder(x.y, y.y));
6132}
6133#endif
6134
6135static inline SIMD_CFUNC simd_double3 __tg_remainder(simd_double3 x, simd_double3 y) {
6136 return simd_make_double3(__tg_remainder(simd_make_double4(x), simd_make_double4(y)));
6137}
6138
6139#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
6140extern simd_double4 _simd_remainder_d4(simd_double4 x, simd_double4 y);
6141static inline SIMD_CFUNC simd_double4 __tg_remainder(simd_double4 x, simd_double4 y) {
6142 return _simd_remainder_d4(x, y);
6143}
6144#else
6145static inline SIMD_CFUNC simd_double4 __tg_remainder(simd_double4 x, simd_double4 y) {
6146 return simd_make_double4(__tg_remainder(x.lo, y.lo), __tg_remainder(x.hi, y.hi));
6147}
6148#endif
6149
6150#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
6151extern simd_double8 _simd_remainder_d8(simd_double8 x, simd_double8 y);
6152static inline SIMD_CFUNC simd_double8 __tg_remainder(simd_double8 x, simd_double8 y) {
6153 return _simd_remainder_d8(x, y);
6154}
6155#else
6156static inline SIMD_CFUNC simd_double8 __tg_remainder(simd_double8 x, simd_double8 y) {
6157 return simd_make_double8(__tg_remainder(x.lo, y.lo), __tg_remainder(x.hi, y.hi));
6158}
6159#endif
6160
6161#pragma mark - nextafter implementation
6162static inline SIMD_CFUNC simd_float2 __tg_nextafter(simd_float2 x, simd_float2 y) {
6163 return simd_make_float2(__tg_nextafter(simd_make_float4(x), simd_make_float4(y)));
6164}
6165
6166static inline SIMD_CFUNC simd_float3 __tg_nextafter(simd_float3 x, simd_float3 y) {
6167 return simd_make_float3(__tg_nextafter(simd_make_float4(x), simd_make_float4(y)));
6168}
6169
6170#if SIMD_LIBRARY_VERSION >= 3
6171extern simd_float4 _simd_nextafter_f4(simd_float4 x, simd_float4 y);
6172static inline SIMD_CFUNC simd_float4 __tg_nextafter(simd_float4 x, simd_float4 y) {
6173 return _simd_nextafter_f4(x, y);
6174}
6175#else
6176static inline SIMD_CFUNC simd_float4 __tg_nextafter(simd_float4 x, simd_float4 y) {
6177 return simd_make_float4(nextafter(x.x, y.x), nextafter(x.y, y.y), nextafter(x.z, y.z), nextafter(x.w, y.w));
6178}
6179#endif
6180
6181#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
6182extern simd_float8 _simd_nextafter_f8(simd_float8 x, simd_float8 y);
6183static inline SIMD_CFUNC simd_float8 __tg_nextafter(simd_float8 x, simd_float8 y) {
6184 return _simd_nextafter_f8(x, y);
6185}
6186#else
6187static inline SIMD_CFUNC simd_float8 __tg_nextafter(simd_float8 x, simd_float8 y) {
6188 return simd_make_float8(__tg_nextafter(x.lo, y.lo), __tg_nextafter(x.hi, y.hi));
6189}
6190#endif
6191
6192#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
6193extern simd_float16 _simd_nextafter_f16(simd_float16 x, simd_float16 y);
6194static inline SIMD_CFUNC simd_float16 __tg_nextafter(simd_float16 x, simd_float16 y) {
6195 return _simd_nextafter_f16(x, y);
6196}
6197#else
6198static inline SIMD_CFUNC simd_float16 __tg_nextafter(simd_float16 x, simd_float16 y) {
6199 return simd_make_float16(__tg_nextafter(x.lo, y.lo), __tg_nextafter(x.hi, y.hi));
6200}
6201#endif
6202
6203#if SIMD_LIBRARY_VERSION >= 3
6204extern simd_double2 _simd_nextafter_d2(simd_double2 x, simd_double2 y);
6205static inline SIMD_CFUNC simd_double2 __tg_nextafter(simd_double2 x, simd_double2 y) {
6206 return _simd_nextafter_d2(x, y);
6207}
6208#else
6209static inline SIMD_CFUNC simd_double2 __tg_nextafter(simd_double2 x, simd_double2 y) {
6210 return simd_make_double2(nextafter(x.x, y.x), nextafter(x.y, y.y));
6211}
6212#endif
6213
6214static inline SIMD_CFUNC simd_double3 __tg_nextafter(simd_double3 x, simd_double3 y) {
6215 return simd_make_double3(__tg_nextafter(simd_make_double4(x), simd_make_double4(y)));
6216}
6217
6218#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__
6219extern simd_double4 _simd_nextafter_d4(simd_double4 x, simd_double4 y);
6220static inline SIMD_CFUNC simd_double4 __tg_nextafter(simd_double4 x, simd_double4 y) {
6221 return _simd_nextafter_d4(x, y);
6222}
6223#else
6224static inline SIMD_CFUNC simd_double4 __tg_nextafter(simd_double4 x, simd_double4 y) {
6225 return simd_make_double4(__tg_nextafter(x.lo, y.lo), __tg_nextafter(x.hi, y.hi));
6226}
6227#endif
6228
6229#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__
6230extern simd_double8 _simd_nextafter_d8(simd_double8 x, simd_double8 y);
6231static inline SIMD_CFUNC simd_double8 __tg_nextafter(simd_double8 x, simd_double8 y) {
6232 return _simd_nextafter_d8(x, y);
6233}
6234#else
6235static inline SIMD_CFUNC simd_double8 __tg_nextafter(simd_double8 x, simd_double8 y) {
6236 return simd_make_double8(__tg_nextafter(x.lo, y.lo), __tg_nextafter(x.hi, y.hi));
6237}
6238#endif
6239
6240#if SIMD_LIBRARY_VERSION >= 5
6241#pragma mark - sincos implementation
6242static inline SIMD_NONCONST void __tg_sincos(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp) {
6243 simd_float4 sin_val;
6244 simd_float4 cos_val;
6245 __tg_sincos(simd_make_float4(x), &sin_val, &cos_val);
6246 *sinp = simd_make_float2(sin_val);
6247 *cosp = simd_make_float2(cos_val);
6248}
6249
6250static inline SIMD_NONCONST void __tg_sincos(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp) {
6251 simd_float4 sin_val;
6252 simd_float4 cos_val;
6253 __tg_sincos(simd_make_float4(x), &sin_val, &cos_val);
6254 *sinp = simd_make_float3(sin_val);
6255 *cosp = simd_make_float3(cos_val);
6256}
6257
6258extern void _simd_sincos_f4(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp);
6259static inline SIMD_NONCONST void __tg_sincos(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp) {
6260 return _simd_sincos_f4(x, sinp, cosp);
6261}
6262
6263static inline SIMD_NONCONST void __tg_sincos(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp) {
6264 __tg_sincos(x.lo, (simd_float4 *)sinp+0, (simd_float4 *)cosp+0);
6265 __tg_sincos(x.hi, (simd_float4 *)sinp+1, (simd_float4 *)cosp+1);
6266}
6267
6268static inline SIMD_NONCONST void __tg_sincos(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp) {
6269 __tg_sincos(x.lo, (simd_float8 *)sinp+0, (simd_float8 *)cosp+0);
6270 __tg_sincos(x.hi, (simd_float8 *)sinp+1, (simd_float8 *)cosp+1);
6271}
6272
6273extern void _simd_sincos_d2(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp);
6274static inline SIMD_NONCONST void __tg_sincos(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp) {
6275 return _simd_sincos_d2(x, sinp, cosp);
6276}
6277
6278static inline SIMD_NONCONST void __tg_sincos(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp) {
6279 simd_double4 sin_val;
6280 simd_double4 cos_val;
6281 __tg_sincos(simd_make_double4(x), &sin_val, &cos_val);
6282 *sinp = simd_make_double3(sin_val);
6283 *cosp = simd_make_double3(cos_val);
6284}
6285
6286static inline SIMD_NONCONST void __tg_sincos(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp) {
6287 __tg_sincos(x.lo, (simd_double2 *)sinp+0, (simd_double2 *)cosp+0);
6288 __tg_sincos(x.hi, (simd_double2 *)sinp+1, (simd_double2 *)cosp+1);
6289}
6290
6291static inline SIMD_NONCONST void __tg_sincos(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp) {
6292 __tg_sincos(x.lo, (simd_double4 *)sinp+0, (simd_double4 *)cosp+0);
6293 __tg_sincos(x.hi, (simd_double4 *)sinp+1, (simd_double4 *)cosp+1);
6294}
6295
6296#pragma mark - sincospi implementation
6297static inline SIMD_NONCONST void __tg_sincospi(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp) {
6298 simd_float4 sin_val;
6299 simd_float4 cos_val;
6300 __tg_sincospi(simd_make_float4(x), &sin_val, &cos_val);
6301 *sinp = simd_make_float2(sin_val);
6302 *cosp = simd_make_float2(cos_val);
6303}
6304
6305static inline SIMD_NONCONST void __tg_sincospi(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp) {
6306 simd_float4 sin_val;
6307 simd_float4 cos_val;
6308 __tg_sincospi(simd_make_float4(x), &sin_val, &cos_val);
6309 *sinp = simd_make_float3(sin_val);
6310 *cosp = simd_make_float3(cos_val);
6311}
6312
6313extern void _simd_sincospi_f4(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp);
6314static inline SIMD_NONCONST void __tg_sincospi(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp) {
6315 return _simd_sincospi_f4(x, sinp, cosp);
6316}
6317
6318static inline SIMD_NONCONST void __tg_sincospi(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp) {
6319 __tg_sincospi(x.lo, (simd_float4 *)sinp+0, (simd_float4 *)cosp+0);
6320 __tg_sincospi(x.hi, (simd_float4 *)sinp+1, (simd_float4 *)cosp+1);
6321}
6322
6323static inline SIMD_NONCONST void __tg_sincospi(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp) {
6324 __tg_sincospi(x.lo, (simd_float8 *)sinp+0, (simd_float8 *)cosp+0);
6325 __tg_sincospi(x.hi, (simd_float8 *)sinp+1, (simd_float8 *)cosp+1);
6326}
6327
6328extern void _simd_sincospi_d2(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp);
6329static inline SIMD_NONCONST void __tg_sincospi(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp) {
6330 return _simd_sincospi_d2(x, sinp, cosp);
6331}
6332
6333static inline SIMD_NONCONST void __tg_sincospi(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp) {
6334 simd_double4 sin_val;
6335 simd_double4 cos_val;
6336 __tg_sincospi(simd_make_double4(x), &sin_val, &cos_val);
6337 *sinp = simd_make_double3(sin_val);
6338 *cosp = simd_make_double3(cos_val);
6339}
6340
6341static inline SIMD_NONCONST void __tg_sincospi(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp) {
6342 __tg_sincospi(x.lo, (simd_double2 *)sinp+0, (simd_double2 *)cosp+0);
6343 __tg_sincospi(x.hi, (simd_double2 *)sinp+1, (simd_double2 *)cosp+1);
6344}
6345
6346static inline SIMD_NONCONST void __tg_sincospi(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp) {
6347 __tg_sincospi(x.lo, (simd_double4 *)sinp+0, (simd_double4 *)cosp+0);
6348 __tg_sincospi(x.hi, (simd_double4 *)sinp+1, (simd_double4 *)cosp+1);
6349}
6350
6351#endif // SIMD_LIBRARY_VERSION >= 5
6352#pragma mark - lgamma implementation
6353static inline SIMD_CFUNC simd_float2 __tg_lgamma(simd_float2 x) {
6354 return simd_make_float2(__tg_lgamma(simd_make_float4(x)));
6355}
6356
6357static inline SIMD_CFUNC simd_float3 __tg_lgamma(simd_float3 x) {
6358 return simd_make_float3(__tg_lgamma(simd_make_float4(x)));
6359}
6360
6361#if SIMD_LIBRARY_VERSION >= 4
6362extern simd_float4 _simd_lgamma_f4(simd_float4 x);
6363static inline SIMD_CFUNC simd_float4 __tg_lgamma(simd_float4 x) {
6364 return _simd_lgamma_f4(x);
6365}
6366#else
6367static inline SIMD_CFUNC simd_float4 __tg_lgamma(simd_float4 x) {
6368 return simd_make_float4(lgamma(x.x), lgamma(x.y), lgamma(x.z), lgamma(x.w));
6369}
6370#endif
6371
6372#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX2__
6373extern simd_float8 _simd_lgamma_f8(simd_float8 x);
6374static inline SIMD_CFUNC simd_float8 __tg_lgamma(simd_float8 x) {
6375 return _simd_lgamma_f8(x);
6376}
6377#else
6378static inline SIMD_CFUNC simd_float8 __tg_lgamma(simd_float8 x) {
6379 return simd_make_float8(__tg_lgamma(x.lo), __tg_lgamma(x.hi));
6380}
6381#endif
6382
6383#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX512F__
6384extern simd_float16 _simd_lgamma_f16(simd_float16 x);
6385static inline SIMD_CFUNC simd_float16 __tg_lgamma(simd_float16 x) {
6386 return _simd_lgamma_f16(x);
6387}
6388#else
6389static inline SIMD_CFUNC simd_float16 __tg_lgamma(simd_float16 x) {
6390 return simd_make_float16(__tg_lgamma(x.lo), __tg_lgamma(x.hi));
6391}
6392#endif
6393
6394#if SIMD_LIBRARY_VERSION >= 4
6395extern simd_double2 _simd_lgamma_d2(simd_double2 x);
6396static inline SIMD_CFUNC simd_double2 __tg_lgamma(simd_double2 x) {
6397 return _simd_lgamma_d2(x);
6398}
6399#else
6400static inline SIMD_CFUNC simd_double2 __tg_lgamma(simd_double2 x) {
6401 return simd_make_double2(lgamma(x.x), lgamma(x.y));
6402}
6403#endif
6404
6405static inline SIMD_CFUNC simd_double3 __tg_lgamma(simd_double3 x) {
6406 return simd_make_double3(__tg_lgamma(simd_make_double4(x)));
6407}
6408
6409#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX2__
6410extern simd_double4 _simd_lgamma_d4(simd_double4 x);
6411static inline SIMD_CFUNC simd_double4 __tg_lgamma(simd_double4 x) {
6412 return _simd_lgamma_d4(x);
6413}
6414#else
6415static inline SIMD_CFUNC simd_double4 __tg_lgamma(simd_double4 x) {
6416 return simd_make_double4(__tg_lgamma(x.lo), __tg_lgamma(x.hi));
6417}
6418#endif
6419
6420#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX512F__
6421extern simd_double8 _simd_lgamma_d8(simd_double8 x);
6422static inline SIMD_CFUNC simd_double8 __tg_lgamma(simd_double8 x) {
6423 return _simd_lgamma_d8(x);
6424}
6425#else
6426static inline SIMD_CFUNC simd_double8 __tg_lgamma(simd_double8 x) {
6427 return simd_make_double8(__tg_lgamma(x.lo), __tg_lgamma(x.hi));
6428}
6429#endif
6430
6431static inline SIMD_CFUNC simd_float2 __tg_fdim(simd_float2 x, simd_float2 y) { return simd_bitselect(x-y, 0, x<y); }
6432static inline SIMD_CFUNC simd_float3 __tg_fdim(simd_float3 x, simd_float3 y) { return simd_bitselect(x-y, 0, x<y); }
6433static inline SIMD_CFUNC simd_float4 __tg_fdim(simd_float4 x, simd_float4 y) { return simd_bitselect(x-y, 0, x<y); }
6434static inline SIMD_CFUNC simd_float8 __tg_fdim(simd_float8 x, simd_float8 y) { return simd_bitselect(x-y, 0, x<y); }
6435static inline SIMD_CFUNC simd_float16 __tg_fdim(simd_float16 x, simd_float16 y) { return simd_bitselect(x-y, 0, x<y); }
6436static inline SIMD_CFUNC simd_double2 __tg_fdim(simd_double2 x, simd_double2 y) { return simd_bitselect(x-y, 0, x<y); }
6437static inline SIMD_CFUNC simd_double3 __tg_fdim(simd_double3 x, simd_double3 y) { return simd_bitselect(x-y, 0, x<y); }
6438static inline SIMD_CFUNC simd_double4 __tg_fdim(simd_double4 x, simd_double4 y) { return simd_bitselect(x-y, 0, x<y); }
6439static inline SIMD_CFUNC simd_double8 __tg_fdim(simd_double8 x, simd_double8 y) { return simd_bitselect(x-y, 0, x<y); }
6440
6441static inline SIMD_CFUNC simd_float2 __tg_fma(simd_float2 x, simd_float2 y, simd_float2 z) {
6442#if defined __arm64__ || defined __aarch64__ || defined __ARM_VFPV4__
6443 return vfma_f32(z, x, y);
6444#else
6445 return simd_make_float2(__tg_fma(simd_make_float4_undef(x), simd_make_float4_undef(y), simd_make_float4_undef(z)));
6446#endif
6447}
6448
6449static inline SIMD_CFUNC simd_float3 __tg_fma(simd_float3 x, simd_float3 y, simd_float3 z) {
6450 return simd_make_float3(__tg_fma(simd_make_float4(x), simd_make_float4(y), simd_make_float4(z)));
6451}
6452
6453#if SIMD_LIBRARY_VERSION >= 3
6454extern simd_float4 _simd_fma_f4(simd_float4 x, simd_float4 y, simd_float4 z);
6455#endif
6456static inline SIMD_CFUNC simd_float4 __tg_fma(simd_float4 x, simd_float4 y, simd_float4 z) {
6457#if defined __arm64__ || defined __aarch64__ || defined __ARM_VFPV4__
6458 return vfmaq_f32(z, x, y);
6459#elif (defined __i386__ || defined __x86_64__) && defined __FMA__
6460 return _mm_fmadd_ps(x, y, z);
6461#elif SIMD_LIBRARY_VERSION >= 3
6462 return _simd_fma_f4(x, y, z);
6463#else
6464 return simd_make_float4(fma(x.x, y.x, z.x), fma(x.y, y.y, z.y), fma(x.z, y.z, z.z), fma(x.w, y.w, z.w));
6465#endif
6466}
6467
6468static inline SIMD_CFUNC simd_float8 __tg_fma(simd_float8 x, simd_float8 y, simd_float8 z) {
6469#if (defined __i386__ || defined __x86_64__) && defined __FMA__
6470 return _mm256_fmadd_ps(x, y, z);
6471#else
6472 return simd_make_float8(__tg_fma(x.lo, y.lo, z.lo), __tg_fma(x.hi, y.hi, z.hi));
6473#endif
6474}
6475
6476static inline SIMD_CFUNC simd_float16 __tg_fma(simd_float16 x, simd_float16 y, simd_float16 z) {
6477#if defined __x86_64__ && defined __AVX512F__
6478 return _mm512_fmadd_ps(x, y, z);
6479#else
6480 return simd_make_float16(__tg_fma(x.lo, y.lo, z.lo), __tg_fma(x.hi, y.hi, z.hi));
6481#endif
6482}
6483
6484#if SIMD_LIBRARY_VERSION >= 3
6485extern simd_double2 _simd_fma_d2(simd_double2 x, simd_double2 y, simd_double2 z);
6486#endif
6487static inline SIMD_CFUNC simd_double2 __tg_fma(simd_double2 x, simd_double2 y, simd_double2 z) {
6488#if defined __arm64__ || defined __aarch64__
6489 return vfmaq_f64(z, x, y);
6490#elif (defined __i386__ || defined __x86_64__) && defined __FMA__
6491 return _mm_fmadd_pd(x, y, z);
6492#elif SIMD_LIBRARY_VERSION >= 3
6493 return _simd_fma_d2(x, y, z);
6494#else
6495 return simd_make_double2(fma(x.x, y.x, z.x), fma(x.y, y.y, z.y));
6496#endif
6497}
6498
6499static inline SIMD_CFUNC simd_double3 __tg_fma(simd_double3 x, simd_double3 y, simd_double3 z) {
6500 return simd_make_double3(__tg_fma(simd_make_double4(x), simd_make_double4(y), simd_make_double4(z)));
6501}
6502
6503static inline SIMD_CFUNC simd_double4 __tg_fma(simd_double4 x, simd_double4 y, simd_double4 z) {
6504#if (defined __i386__ || defined __x86_64__) && defined __FMA__
6505 return _mm256_fmadd_pd(x, y, z);
6506#else
6507 return simd_make_double4(__tg_fma(x.lo, y.lo, z.lo), __tg_fma(x.hi, y.hi, z.hi));
6508#endif
6509}
6510
6511static inline SIMD_CFUNC simd_double8 __tg_fma(simd_double8 x, simd_double8 y, simd_double8 z) {
6512#if defined __x86_64__ && defined __AVX512F__
6513 return _mm512_fmadd_pd(x, y, z);
6514#else
6515 return simd_make_double8(__tg_fma(x.lo, y.lo, z.lo), __tg_fma(x.hi, y.hi, z.hi));
6516#endif
6517}
6518
6519static inline SIMD_CFUNC _Float16 simd_muladd(_Float16 x, _Float16 y, _Float16 z) {
6520#pragma STDC FP_CONTRACT ON
6521 return x*y + z;
6522}
6523static inline SIMD_CFUNC simd_half2 simd_muladd(simd_half2 x, simd_half2 y, simd_half2 z) {
6524#pragma STDC FP_CONTRACT ON
6525 return x*y + z;
6526}
6527static inline SIMD_CFUNC simd_half3 simd_muladd(simd_half3 x, simd_half3 y, simd_half3 z) {
6528#pragma STDC FP_CONTRACT ON
6529 return x*y + z;
6530}
6531static inline SIMD_CFUNC simd_half4 simd_muladd(simd_half4 x, simd_half4 y, simd_half4 z) {
6532#pragma STDC FP_CONTRACT ON
6533 return x*y + z;
6534}
6535static inline SIMD_CFUNC simd_half8 simd_muladd(simd_half8 x, simd_half8 y, simd_half8 z) {
6536#pragma STDC FP_CONTRACT ON
6537 return x*y + z;
6538}
6539static inline SIMD_CFUNC simd_half16 simd_muladd(simd_half16 x, simd_half16 y, simd_half16 z) {
6540#pragma STDC FP_CONTRACT ON
6541 return x*y + z;
6542}
6543static inline SIMD_CFUNC simd_half32 simd_muladd(simd_half32 x, simd_half32 y, simd_half32 z) {
6544#pragma STDC FP_CONTRACT ON
6545 return x*y + z;
6546}
6547static inline SIMD_CFUNC float simd_muladd(float x, float y, float z) {
6548#pragma STDC FP_CONTRACT ON
6549 return x*y + z;
6550}
6551static inline SIMD_CFUNC simd_float2 simd_muladd(simd_float2 x, simd_float2 y, simd_float2 z) {
6552#pragma STDC FP_CONTRACT ON
6553 return x*y + z;
6554}
6555static inline SIMD_CFUNC simd_float3 simd_muladd(simd_float3 x, simd_float3 y, simd_float3 z) {
6556#pragma STDC FP_CONTRACT ON
6557 return x*y + z;
6558}
6559static inline SIMD_CFUNC simd_float4 simd_muladd(simd_float4 x, simd_float4 y, simd_float4 z) {
6560#pragma STDC FP_CONTRACT ON
6561 return x*y + z;
6562}
6563static inline SIMD_CFUNC simd_float8 simd_muladd(simd_float8 x, simd_float8 y, simd_float8 z) {
6564#pragma STDC FP_CONTRACT ON
6565 return x*y + z;
6566}
6567static inline SIMD_CFUNC simd_float16 simd_muladd(simd_float16 x, simd_float16 y, simd_float16 z) {
6568#pragma STDC FP_CONTRACT ON
6569 return x*y + z;
6570}
6571static inline SIMD_CFUNC double simd_muladd(double x, double y, double z) {
6572#pragma STDC FP_CONTRACT ON
6573 return x*y + z;
6574}
6575static inline SIMD_CFUNC simd_double2 simd_muladd(simd_double2 x, simd_double2 y, simd_double2 z) {
6576#pragma STDC FP_CONTRACT ON
6577 return x*y + z;
6578}
6579static inline SIMD_CFUNC simd_double3 simd_muladd(simd_double3 x, simd_double3 y, simd_double3 z) {
6580#pragma STDC FP_CONTRACT ON
6581 return x*y + z;
6582}
6583static inline SIMD_CFUNC simd_double4 simd_muladd(simd_double4 x, simd_double4 y, simd_double4 z) {
6584#pragma STDC FP_CONTRACT ON
6585 return x*y + z;
6586}
6587static inline SIMD_CFUNC simd_double8 simd_muladd(simd_double8 x, simd_double8 y, simd_double8 z) {
6588#pragma STDC FP_CONTRACT ON
6589 return x*y + z;
6590}
6591#ifdef __cplusplus
6592} /* extern "C" */
6593#endif
6594#endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */
6595#endif /* SIMD_MATH_HEADER */