clang 19.0.0git
__clang_hip_math.h
Go to the documentation of this file.
1/*===---- __clang_hip_math.h - Device-side HIP math support ----------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9#ifndef __CLANG_HIP_MATH_H__
10#define __CLANG_HIP_MATH_H__
11
12#if !defined(__HIP__) && !defined(__OPENMP_AMDGCN__)
13#error "This file is for HIP and OpenMP AMDGCN device compilation only."
14#endif
15
16#if !defined(__HIPCC_RTC__)
17#include <limits.h>
18#include <stdint.h>
19#ifdef __OPENMP_AMDGCN__
20#include <omp.h>
21#endif
22#endif // !defined(__HIPCC_RTC__)
23
24#pragma push_macro("__DEVICE__")
25
26#ifdef __OPENMP_AMDGCN__
27#define __DEVICE__ static inline __attribute__((always_inline, nothrow))
28#else
29#define __DEVICE__ static __device__ inline __attribute__((always_inline))
30#endif
31
32// Device library provides fast low precision and slow full-recision
33// implementations for some functions. Which one gets selected depends on
34// __CLANG_GPU_APPROX_TRANSCENDENTALS__ which gets defined by clang if
35// -ffast-math or -fgpu-approx-transcendentals are in effect.
36#pragma push_macro("__FAST_OR_SLOW")
37#if defined(__CLANG_GPU_APPROX_TRANSCENDENTALS__)
38#define __FAST_OR_SLOW(fast, slow) fast
39#else
40#define __FAST_OR_SLOW(fast, slow) slow
41#endif
42
43// A few functions return bool type starting only in C++11.
44#pragma push_macro("__RETURN_TYPE")
45#ifdef __OPENMP_AMDGCN__
46#define __RETURN_TYPE int
47#else
48#if defined(__cplusplus)
49#define __RETURN_TYPE bool
50#else
51#define __RETURN_TYPE int
52#endif
53#endif // __OPENMP_AMDGCN__
54
55#if defined (__cplusplus) && __cplusplus < 201103L
56// emulate static_assert on type sizes
57template<bool>
58struct __compare_result{};
59template<>
60struct __compare_result<true> {
61 static const __device__ bool valid;
62};
63
65void __suppress_unused_warning(bool b){};
66template <unsigned int S, unsigned int T>
67__DEVICE__ void __static_assert_equal_size() {
68 __suppress_unused_warning(__compare_result<S == T>::valid);
69}
70
71#define __static_assert_type_size_equal(A, B) \
72 __static_assert_equal_size<A,B>()
73
74#else
75#define __static_assert_type_size_equal(A,B) \
76 static_assert((A) == (B), "")
77
78#endif
79
81uint64_t __make_mantissa_base8(const char *__tagp __attribute__((nonnull))) {
82 uint64_t __r = 0;
83 while (*__tagp != '\0') {
84 char __tmp = *__tagp;
85
86 if (__tmp >= '0' && __tmp <= '7')
87 __r = (__r * 8u) + __tmp - '0';
88 else
89 return 0;
90
91 ++__tagp;
92 }
93
94 return __r;
95}
96
98uint64_t __make_mantissa_base10(const char *__tagp __attribute__((nonnull))) {
99 uint64_t __r = 0;
100 while (*__tagp != '\0') {
101 char __tmp = *__tagp;
102
103 if (__tmp >= '0' && __tmp <= '9')
104 __r = (__r * 10u) + __tmp - '0';
105 else
106 return 0;
107
108 ++__tagp;
109 }
110
111 return __r;
112}
113
115uint64_t __make_mantissa_base16(const char *__tagp __attribute__((nonnull))) {
116 uint64_t __r = 0;
117 while (*__tagp != '\0') {
118 char __tmp = *__tagp;
119
120 if (__tmp >= '0' && __tmp <= '9')
121 __r = (__r * 16u) + __tmp - '0';
122 else if (__tmp >= 'a' && __tmp <= 'f')
123 __r = (__r * 16u) + __tmp - 'a' + 10;
124 else if (__tmp >= 'A' && __tmp <= 'F')
125 __r = (__r * 16u) + __tmp - 'A' + 10;
126 else
127 return 0;
128
129 ++__tagp;
130 }
131
132 return __r;
133}
134
136uint64_t __make_mantissa(const char *__tagp __attribute__((nonnull))) {
137 if (*__tagp == '0') {
138 ++__tagp;
139
140 if (*__tagp == 'x' || *__tagp == 'X')
141 return __make_mantissa_base16(__tagp);
142 else
143 return __make_mantissa_base8(__tagp);
144 }
145
146 return __make_mantissa_base10(__tagp);
147}
148
149// BEGIN FLOAT
150
151// BEGIN INTRINSICS
152
154float __cosf(float __x) { return __ocml_native_cos_f32(__x); }
155
157float __exp10f(float __x) {
158 const float __log2_10 = 0x1.a934f0p+1f;
159 return __builtin_amdgcn_exp2f(__log2_10 * __x);
160}
161
163float __expf(float __x) {
164 const float __log2_e = 0x1.715476p+0;
165 return __builtin_amdgcn_exp2f(__log2_e * __x);
166}
167
168#if defined OCML_BASIC_ROUNDED_OPERATIONS
170float __fadd_rd(float __x, float __y) { return __ocml_add_rtn_f32(__x, __y); }
172float __fadd_rn(float __x, float __y) { return __ocml_add_rte_f32(__x, __y); }
174float __fadd_ru(float __x, float __y) { return __ocml_add_rtp_f32(__x, __y); }
176float __fadd_rz(float __x, float __y) { return __ocml_add_rtz_f32(__x, __y); }
177#else
179float __fadd_rn(float __x, float __y) { return __x + __y; }
180#endif
181
182#if defined OCML_BASIC_ROUNDED_OPERATIONS
184float __fdiv_rd(float __x, float __y) { return __ocml_div_rtn_f32(__x, __y); }
186float __fdiv_rn(float __x, float __y) { return __ocml_div_rte_f32(__x, __y); }
188float __fdiv_ru(float __x, float __y) { return __ocml_div_rtp_f32(__x, __y); }
190float __fdiv_rz(float __x, float __y) { return __ocml_div_rtz_f32(__x, __y); }
191#else
193float __fdiv_rn(float __x, float __y) { return __x / __y; }
194#endif
195
197float __fdividef(float __x, float __y) { return __x / __y; }
198
199#if defined OCML_BASIC_ROUNDED_OPERATIONS
201float __fmaf_rd(float __x, float __y, float __z) {
202 return __ocml_fma_rtn_f32(__x, __y, __z);
203}
205float __fmaf_rn(float __x, float __y, float __z) {
206 return __ocml_fma_rte_f32(__x, __y, __z);
207}
209float __fmaf_ru(float __x, float __y, float __z) {
210 return __ocml_fma_rtp_f32(__x, __y, __z);
211}
213float __fmaf_rz(float __x, float __y, float __z) {
214 return __ocml_fma_rtz_f32(__x, __y, __z);
215}
216#else
218float __fmaf_rn(float __x, float __y, float __z) {
219 return __builtin_fmaf(__x, __y, __z);
220}
221#endif
222
223#if defined OCML_BASIC_ROUNDED_OPERATIONS
225float __fmul_rd(float __x, float __y) { return __ocml_mul_rtn_f32(__x, __y); }
227float __fmul_rn(float __x, float __y) { return __ocml_mul_rte_f32(__x, __y); }
229float __fmul_ru(float __x, float __y) { return __ocml_mul_rtp_f32(__x, __y); }
231float __fmul_rz(float __x, float __y) { return __ocml_mul_rtz_f32(__x, __y); }
232#else
234float __fmul_rn(float __x, float __y) { return __x * __y; }
235#endif
236
237#if defined OCML_BASIC_ROUNDED_OPERATIONS
239float __frcp_rd(float __x) { return __ocml_div_rtn_f32(1.0f, __x); }
241float __frcp_rn(float __x) { return __ocml_div_rte_f32(1.0f, __x); }
243float __frcp_ru(float __x) { return __ocml_div_rtp_f32(1.0f, __x); }
245float __frcp_rz(float __x) { return __ocml_div_rtz_f32(1.0f, __x); }
246#else
248float __frcp_rn(float __x) { return 1.0f / __x; }
249#endif
250
252float __frsqrt_rn(float __x) { return __builtin_amdgcn_rsqf(__x); }
253
254#if defined OCML_BASIC_ROUNDED_OPERATIONS
256float __fsqrt_rd(float __x) { return __ocml_sqrt_rtn_f32(__x); }
258float __fsqrt_rn(float __x) { return __ocml_sqrt_rte_f32(__x); }
260float __fsqrt_ru(float __x) { return __ocml_sqrt_rtp_f32(__x); }
262float __fsqrt_rz(float __x) { return __ocml_sqrt_rtz_f32(__x); }
263#else
265float __fsqrt_rn(float __x) { return __ocml_native_sqrt_f32(__x); }
266#endif
267
268#if defined OCML_BASIC_ROUNDED_OPERATIONS
270float __fsub_rd(float __x, float __y) { return __ocml_sub_rtn_f32(__x, __y); }
272float __fsub_rn(float __x, float __y) { return __ocml_sub_rte_f32(__x, __y); }
274float __fsub_ru(float __x, float __y) { return __ocml_sub_rtp_f32(__x, __y); }
276float __fsub_rz(float __x, float __y) { return __ocml_sub_rtz_f32(__x, __y); }
277#else
279float __fsub_rn(float __x, float __y) { return __x - __y; }
280#endif
281
283float __log10f(float __x) { return __builtin_log10f(__x); }
284
286float __log2f(float __x) { return __builtin_amdgcn_logf(__x); }
287
289float __logf(float __x) { return __builtin_logf(__x); }
290
292float __powf(float __x, float __y) { return __ocml_pow_f32(__x, __y); }
293
295float __saturatef(float __x) { return (__x < 0) ? 0 : ((__x > 1) ? 1 : __x); }
296
298void __sincosf(float __x, float *__sinptr, float *__cosptr) {
299 *__sinptr = __ocml_native_sin_f32(__x);
300 *__cosptr = __ocml_native_cos_f32(__x);
301}
302
304float __sinf(float __x) { return __ocml_native_sin_f32(__x); }
305
307float __tanf(float __x) {
308 return __sinf(__x) * __builtin_amdgcn_rcpf(__cosf(__x));
309}
310// END INTRINSICS
311
312#if defined(__cplusplus)
314int abs(int __x) {
315 return __builtin_abs(__x);
316}
318long labs(long __x) {
319 return __builtin_labs(__x);
320}
322long long llabs(long long __x) {
323 return __builtin_llabs(__x);
324}
325#endif
326
328float acosf(float __x) { return __ocml_acos_f32(__x); }
329
331float acoshf(float __x) { return __ocml_acosh_f32(__x); }
332
334float asinf(float __x) { return __ocml_asin_f32(__x); }
335
337float asinhf(float __x) { return __ocml_asinh_f32(__x); }
338
340float atan2f(float __x, float __y) { return __ocml_atan2_f32(__x, __y); }
341
343float atanf(float __x) { return __ocml_atan_f32(__x); }
344
346float atanhf(float __x) { return __ocml_atanh_f32(__x); }
347
349float cbrtf(float __x) { return __ocml_cbrt_f32(__x); }
350
352float ceilf(float __x) { return __builtin_ceilf(__x); }
353
355float copysignf(float __x, float __y) { return __builtin_copysignf(__x, __y); }
356
358float cosf(float __x) { return __FAST_OR_SLOW(__cosf, __ocml_cos_f32)(__x); }
359
361float coshf(float __x) { return __ocml_cosh_f32(__x); }
362
364float cospif(float __x) { return __ocml_cospi_f32(__x); }
365
367float cyl_bessel_i0f(float __x) { return __ocml_i0_f32(__x); }
368
370float cyl_bessel_i1f(float __x) { return __ocml_i1_f32(__x); }
371
373float erfcf(float __x) { return __ocml_erfc_f32(__x); }
374
376float erfcinvf(float __x) { return __ocml_erfcinv_f32(__x); }
377
379float erfcxf(float __x) { return __ocml_erfcx_f32(__x); }
380
382float erff(float __x) { return __ocml_erf_f32(__x); }
383
385float erfinvf(float __x) { return __ocml_erfinv_f32(__x); }
386
388float exp10f(float __x) { return __ocml_exp10_f32(__x); }
389
391float exp2f(float __x) { return __builtin_exp2f(__x); }
392
394float expf(float __x) { return __builtin_expf(__x); }
395
397float expm1f(float __x) { return __ocml_expm1_f32(__x); }
398
400float fabsf(float __x) { return __builtin_fabsf(__x); }
401
403float fdimf(float __x, float __y) { return __ocml_fdim_f32(__x, __y); }
404
406float fdividef(float __x, float __y) { return __x / __y; }
407
409float floorf(float __x) { return __builtin_floorf(__x); }
410
412float fmaf(float __x, float __y, float __z) {
413 return __builtin_fmaf(__x, __y, __z);
414}
415
417float fmaxf(float __x, float __y) { return __builtin_fmaxf(__x, __y); }
418
420float fminf(float __x, float __y) { return __builtin_fminf(__x, __y); }
421
423float fmodf(float __x, float __y) { return __ocml_fmod_f32(__x, __y); }
424
426float frexpf(float __x, int *__nptr) {
427 return __builtin_frexpf(__x, __nptr);
428}
429
431float hypotf(float __x, float __y) { return __ocml_hypot_f32(__x, __y); }
432
434int ilogbf(float __x) { return __ocml_ilogb_f32(__x); }
435
437__RETURN_TYPE __finitef(float __x) { return __builtin_isfinite(__x); }
438
440__RETURN_TYPE __isinff(float __x) { return __builtin_isinf(__x); }
441
443__RETURN_TYPE __isnanf(float __x) { return __builtin_isnan(__x); }
444
446float j0f(float __x) { return __ocml_j0_f32(__x); }
447
449float j1f(float __x) { return __ocml_j1_f32(__x); }
450
452float jnf(int __n, float __x) { // TODO: we could use Ahmes multiplication
453 // and the Miller & Brown algorithm
454 // for linear recurrences to get O(log n) steps, but it's unclear if
455 // it'd be beneficial in this case.
456 if (__n == 0)
457 return j0f(__x);
458 if (__n == 1)
459 return j1f(__x);
460
461 float __x0 = j0f(__x);
462 float __x1 = j1f(__x);
463 for (int __i = 1; __i < __n; ++__i) {
464 float __x2 = (2 * __i) / __x * __x1 - __x0;
465 __x0 = __x1;
466 __x1 = __x2;
467 }
468
469 return __x1;
470}
471
473float ldexpf(float __x, int __e) { return __builtin_amdgcn_ldexpf(__x, __e); }
474
476float lgammaf(float __x) { return __ocml_lgamma_f32(__x); }
477
479long long int llrintf(float __x) { return __builtin_rintf(__x); }
480
482long long int llroundf(float __x) { return __builtin_roundf(__x); }
483
485float log10f(float __x) { return __builtin_log10f(__x); }
486
488float log1pf(float __x) { return __ocml_log1p_f32(__x); }
489
491float log2f(float __x) { return __FAST_OR_SLOW(__log2f, __ocml_log2_f32)(__x); }
492
494float logbf(float __x) { return __ocml_logb_f32(__x); }
495
497float logf(float __x) { return __FAST_OR_SLOW(__logf, __ocml_log_f32)(__x); }
498
500long int lrintf(float __x) { return __builtin_rintf(__x); }
501
503long int lroundf(float __x) { return __builtin_roundf(__x); }
504
506float modff(float __x, float *__iptr) {
507 float __tmp;
508#ifdef __OPENMP_AMDGCN__
509#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
510#endif
511 float __r =
512 __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
513 *__iptr = __tmp;
514 return __r;
515}
516
518float nanf(const char *__tagp __attribute__((nonnull))) {
519 union {
520 float val;
521 struct ieee_float {
522 unsigned int mantissa : 22;
523 unsigned int quiet : 1;
524 unsigned int exponent : 8;
525 unsigned int sign : 1;
526 } bits;
527 } __tmp;
528 __static_assert_type_size_equal(sizeof(__tmp.val), sizeof(__tmp.bits));
529
530 __tmp.bits.sign = 0u;
531 __tmp.bits.exponent = ~0u;
532 __tmp.bits.quiet = 1u;
533 __tmp.bits.mantissa = __make_mantissa(__tagp);
534
535 return __tmp.val;
536}
537
539float nearbyintf(float __x) { return __builtin_nearbyintf(__x); }
540
542float nextafterf(float __x, float __y) {
543 return __ocml_nextafter_f32(__x, __y);
544}
545
547float norm3df(float __x, float __y, float __z) {
548 return __ocml_len3_f32(__x, __y, __z);
549}
550
552float norm4df(float __x, float __y, float __z, float __w) {
553 return __ocml_len4_f32(__x, __y, __z, __w);
554}
555
557float normcdff(float __x) { return __ocml_ncdf_f32(__x); }
558
560float normcdfinvf(float __x) { return __ocml_ncdfinv_f32(__x); }
561
563float normf(int __dim,
564 const float *__a) { // TODO: placeholder until OCML adds support.
565 float __r = 0;
566 while (__dim--) {
567 __r += __a[0] * __a[0];
568 ++__a;
569 }
570
571 return __builtin_sqrtf(__r);
572}
573
575float powf(float __x, float __y) { return __ocml_pow_f32(__x, __y); }
576
578float powif(float __x, int __y) { return __ocml_pown_f32(__x, __y); }
579
581float rcbrtf(float __x) { return __ocml_rcbrt_f32(__x); }
582
584float remainderf(float __x, float __y) {
585 return __ocml_remainder_f32(__x, __y);
586}
587
589float remquof(float __x, float __y, int *__quo) {
590 int __tmp;
591#ifdef __OPENMP_AMDGCN__
592#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
593#endif
594 float __r = __ocml_remquo_f32(
595 __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
596 *__quo = __tmp;
597
598 return __r;
599}
600
602float rhypotf(float __x, float __y) { return __ocml_rhypot_f32(__x, __y); }
603
605float rintf(float __x) { return __builtin_rintf(__x); }
606
608float rnorm3df(float __x, float __y, float __z) {
609 return __ocml_rlen3_f32(__x, __y, __z);
610}
611
613float rnorm4df(float __x, float __y, float __z, float __w) {
614 return __ocml_rlen4_f32(__x, __y, __z, __w);
615}
616
618float rnormf(int __dim,
619 const float *__a) { // TODO: placeholder until OCML adds support.
620 float __r = 0;
621 while (__dim--) {
622 __r += __a[0] * __a[0];
623 ++__a;
624 }
625
626 return __ocml_rsqrt_f32(__r);
627}
628
630float roundf(float __x) { return __builtin_roundf(__x); }
631
633float rsqrtf(float __x) { return __ocml_rsqrt_f32(__x); }
634
636float scalblnf(float __x, long int __n) {
637 return (__n < INT_MAX) ? __builtin_amdgcn_ldexpf(__x, __n)
638 : __ocml_scalb_f32(__x, __n);
639}
640
642float scalbnf(float __x, int __n) { return __builtin_amdgcn_ldexpf(__x, __n); }
643
645__RETURN_TYPE __signbitf(float __x) { return __builtin_signbitf(__x); }
646
648void sincosf(float __x, float *__sinptr, float *__cosptr) {
649 float __tmp;
650#ifdef __OPENMP_AMDGCN__
651#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
652#endif
653#ifdef __CLANG_CUDA_APPROX_TRANSCENDENTALS__
654 __sincosf(__x, __sinptr, __cosptr);
655#else
656 *__sinptr =
657 __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
658 *__cosptr = __tmp;
659#endif
660}
661
663void sincospif(float __x, float *__sinptr, float *__cosptr) {
664 float __tmp;
665#ifdef __OPENMP_AMDGCN__
666#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
667#endif
668 *__sinptr = __ocml_sincospi_f32(
669 __x, (__attribute__((address_space(5))) float *)&__tmp);
670 *__cosptr = __tmp;
671}
672
674float sinf(float __x) { return __FAST_OR_SLOW(__sinf, __ocml_sin_f32)(__x); }
675
677float sinhf(float __x) { return __ocml_sinh_f32(__x); }
678
680float sinpif(float __x) { return __ocml_sinpi_f32(__x); }
681
683float sqrtf(float __x) { return __builtin_sqrtf(__x); }
684
686float tanf(float __x) { return __ocml_tan_f32(__x); }
687
689float tanhf(float __x) { return __ocml_tanh_f32(__x); }
690
692float tgammaf(float __x) { return __ocml_tgamma_f32(__x); }
693
695float truncf(float __x) { return __builtin_truncf(__x); }
696
698float y0f(float __x) { return __ocml_y0_f32(__x); }
699
701float y1f(float __x) { return __ocml_y1_f32(__x); }
702
704float ynf(int __n, float __x) { // TODO: we could use Ahmes multiplication
705 // and the Miller & Brown algorithm
706 // for linear recurrences to get O(log n) steps, but it's unclear if
707 // it'd be beneficial in this case. Placeholder until OCML adds
708 // support.
709 if (__n == 0)
710 return y0f(__x);
711 if (__n == 1)
712 return y1f(__x);
713
714 float __x0 = y0f(__x);
715 float __x1 = y1f(__x);
716 for (int __i = 1; __i < __n; ++__i) {
717 float __x2 = (2 * __i) / __x * __x1 - __x0;
718 __x0 = __x1;
719 __x1 = __x2;
720 }
721
722 return __x1;
723}
724
725
726// END FLOAT
727
728// BEGIN DOUBLE
730double acos(double __x) { return __ocml_acos_f64(__x); }
731
733double acosh(double __x) { return __ocml_acosh_f64(__x); }
734
736double asin(double __x) { return __ocml_asin_f64(__x); }
737
739double asinh(double __x) { return __ocml_asinh_f64(__x); }
740
742double atan(double __x) { return __ocml_atan_f64(__x); }
743
745double atan2(double __x, double __y) { return __ocml_atan2_f64(__x, __y); }
746
748double atanh(double __x) { return __ocml_atanh_f64(__x); }
749
751double cbrt(double __x) { return __ocml_cbrt_f64(__x); }
752
754double ceil(double __x) { return __builtin_ceil(__x); }
755
757double copysign(double __x, double __y) {
758 return __builtin_copysign(__x, __y);
759}
760
762double cos(double __x) { return __ocml_cos_f64(__x); }
763
765double cosh(double __x) { return __ocml_cosh_f64(__x); }
766
768double cospi(double __x) { return __ocml_cospi_f64(__x); }
769
771double cyl_bessel_i0(double __x) { return __ocml_i0_f64(__x); }
772
774double cyl_bessel_i1(double __x) { return __ocml_i1_f64(__x); }
775
777double erf(double __x) { return __ocml_erf_f64(__x); }
778
780double erfc(double __x) { return __ocml_erfc_f64(__x); }
781
783double erfcinv(double __x) { return __ocml_erfcinv_f64(__x); }
784
786double erfcx(double __x) { return __ocml_erfcx_f64(__x); }
787
789double erfinv(double __x) { return __ocml_erfinv_f64(__x); }
790
792double exp(double __x) { return __ocml_exp_f64(__x); }
793
795double exp10(double __x) { return __ocml_exp10_f64(__x); }
796
798double exp2(double __x) { return __ocml_exp2_f64(__x); }
799
801double expm1(double __x) { return __ocml_expm1_f64(__x); }
802
804double fabs(double __x) { return __builtin_fabs(__x); }
805
807double fdim(double __x, double __y) { return __ocml_fdim_f64(__x, __y); }
808
810double floor(double __x) { return __builtin_floor(__x); }
811
813double fma(double __x, double __y, double __z) {
814 return __builtin_fma(__x, __y, __z);
815}
816
818double fmax(double __x, double __y) { return __builtin_fmax(__x, __y); }
819
821double fmin(double __x, double __y) { return __builtin_fmin(__x, __y); }
822
824double fmod(double __x, double __y) { return __ocml_fmod_f64(__x, __y); }
825
827double frexp(double __x, int *__nptr) {
828 return __builtin_frexp(__x, __nptr);
829}
830
832double hypot(double __x, double __y) { return __ocml_hypot_f64(__x, __y); }
833
835int ilogb(double __x) { return __ocml_ilogb_f64(__x); }
836
838__RETURN_TYPE __finite(double __x) { return __builtin_isfinite(__x); }
839
841__RETURN_TYPE __isinf(double __x) { return __builtin_isinf(__x); }
842
844__RETURN_TYPE __isnan(double __x) { return __builtin_isnan(__x); }
845
847double j0(double __x) { return __ocml_j0_f64(__x); }
848
850double j1(double __x) { return __ocml_j1_f64(__x); }
851
853double jn(int __n, double __x) { // TODO: we could use Ahmes multiplication
854 // and the Miller & Brown algorithm
855 // for linear recurrences to get O(log n) steps, but it's unclear if
856 // it'd be beneficial in this case. Placeholder until OCML adds
857 // support.
858 if (__n == 0)
859 return j0(__x);
860 if (__n == 1)
861 return j1(__x);
862
863 double __x0 = j0(__x);
864 double __x1 = j1(__x);
865 for (int __i = 1; __i < __n; ++__i) {
866 double __x2 = (2 * __i) / __x * __x1 - __x0;
867 __x0 = __x1;
868 __x1 = __x2;
869 }
870 return __x1;
871}
872
874double ldexp(double __x, int __e) { return __builtin_amdgcn_ldexp(__x, __e); }
875
877double lgamma(double __x) { return __ocml_lgamma_f64(__x); }
878
880long long int llrint(double __x) { return __builtin_rint(__x); }
881
883long long int llround(double __x) { return __builtin_round(__x); }
884
886double log(double __x) { return __ocml_log_f64(__x); }
887
889double log10(double __x) { return __ocml_log10_f64(__x); }
890
892double log1p(double __x) { return __ocml_log1p_f64(__x); }
893
895double log2(double __x) { return __ocml_log2_f64(__x); }
896
898double logb(double __x) { return __ocml_logb_f64(__x); }
899
901long int lrint(double __x) { return __builtin_rint(__x); }
902
904long int lround(double __x) { return __builtin_round(__x); }
905
907double modf(double __x, double *__iptr) {
908 double __tmp;
909#ifdef __OPENMP_AMDGCN__
910#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
911#endif
912 double __r =
913 __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
914 *__iptr = __tmp;
915
916 return __r;
917}
918
920double nan(const char *__tagp) {
921#if !_WIN32
922 union {
923 double val;
924 struct ieee_double {
925 uint64_t mantissa : 51;
926 uint32_t quiet : 1;
927 uint32_t exponent : 11;
928 uint32_t sign : 1;
929 } bits;
930 } __tmp;
931 __static_assert_type_size_equal(sizeof(__tmp.val), sizeof(__tmp.bits));
932
933 __tmp.bits.sign = 0u;
934 __tmp.bits.exponent = ~0u;
935 __tmp.bits.quiet = 1u;
936 __tmp.bits.mantissa = __make_mantissa(__tagp);
937
938 return __tmp.val;
939#else
940 __static_assert_type_size_equal(sizeof(uint64_t), sizeof(double));
941 uint64_t __val = __make_mantissa(__tagp);
942 __val |= 0xFFF << 51;
943 return *reinterpret_cast<double *>(&__val);
944#endif
945}
946
948double nearbyint(double __x) { return __builtin_nearbyint(__x); }
949
951double nextafter(double __x, double __y) {
952 return __ocml_nextafter_f64(__x, __y);
953}
954
956double norm(int __dim,
957 const double *__a) { // TODO: placeholder until OCML adds support.
958 double __r = 0;
959 while (__dim--) {
960 __r += __a[0] * __a[0];
961 ++__a;
962 }
963
964 return __builtin_sqrt(__r);
965}
966
968double norm3d(double __x, double __y, double __z) {
969 return __ocml_len3_f64(__x, __y, __z);
970}
971
973double norm4d(double __x, double __y, double __z, double __w) {
974 return __ocml_len4_f64(__x, __y, __z, __w);
975}
976
978double normcdf(double __x) { return __ocml_ncdf_f64(__x); }
979
981double normcdfinv(double __x) { return __ocml_ncdfinv_f64(__x); }
982
984double pow(double __x, double __y) { return __ocml_pow_f64(__x, __y); }
985
987double powi(double __x, int __y) { return __ocml_pown_f64(__x, __y); }
988
990double rcbrt(double __x) { return __ocml_rcbrt_f64(__x); }
991
993double remainder(double __x, double __y) {
994 return __ocml_remainder_f64(__x, __y);
995}
996
998double remquo(double __x, double __y, int *__quo) {
999 int __tmp;
1000#ifdef __OPENMP_AMDGCN__
1001#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
1002#endif
1003 double __r = __ocml_remquo_f64(
1004 __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
1005 *__quo = __tmp;
1006
1007 return __r;
1008}
1009
1011double rhypot(double __x, double __y) { return __ocml_rhypot_f64(__x, __y); }
1012
1014double rint(double __x) { return __builtin_rint(__x); }
1015
1017double rnorm(int __dim,
1018 const double *__a) { // TODO: placeholder until OCML adds support.
1019 double __r = 0;
1020 while (__dim--) {
1021 __r += __a[0] * __a[0];
1022 ++__a;
1023 }
1024
1025 return __ocml_rsqrt_f64(__r);
1026}
1027
1029double rnorm3d(double __x, double __y, double __z) {
1030 return __ocml_rlen3_f64(__x, __y, __z);
1031}
1032
1034double rnorm4d(double __x, double __y, double __z, double __w) {
1035 return __ocml_rlen4_f64(__x, __y, __z, __w);
1036}
1037
1039double round(double __x) { return __builtin_round(__x); }
1040
1042double rsqrt(double __x) { return __ocml_rsqrt_f64(__x); }
1043
1045double scalbln(double __x, long int __n) {
1046 return (__n < INT_MAX) ? __builtin_amdgcn_ldexp(__x, __n)
1047 : __ocml_scalb_f64(__x, __n);
1048}
1050double scalbn(double __x, int __n) { return __builtin_amdgcn_ldexp(__x, __n); }
1051
1053__RETURN_TYPE __signbit(double __x) { return __builtin_signbit(__x); }
1054
1056double sin(double __x) { return __ocml_sin_f64(__x); }
1057
1059void sincos(double __x, double *__sinptr, double *__cosptr) {
1060 double __tmp;
1061#ifdef __OPENMP_AMDGCN__
1062#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
1063#endif
1064 *__sinptr = __ocml_sincos_f64(
1065 __x, (__attribute__((address_space(5))) double *)&__tmp);
1066 *__cosptr = __tmp;
1067}
1068
1070void sincospi(double __x, double *__sinptr, double *__cosptr) {
1071 double __tmp;
1072#ifdef __OPENMP_AMDGCN__
1073#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
1074#endif
1075 *__sinptr = __ocml_sincospi_f64(
1076 __x, (__attribute__((address_space(5))) double *)&__tmp);
1077 *__cosptr = __tmp;
1078}
1079
1081double sinh(double __x) { return __ocml_sinh_f64(__x); }
1082
1084double sinpi(double __x) { return __ocml_sinpi_f64(__x); }
1085
1087double sqrt(double __x) { return __builtin_sqrt(__x); }
1088
1090double tan(double __x) { return __ocml_tan_f64(__x); }
1091
1093double tanh(double __x) { return __ocml_tanh_f64(__x); }
1094
1096double tgamma(double __x) { return __ocml_tgamma_f64(__x); }
1097
1099double trunc(double __x) { return __builtin_trunc(__x); }
1100
1102double y0(double __x) { return __ocml_y0_f64(__x); }
1103
1105double y1(double __x) { return __ocml_y1_f64(__x); }
1106
1108double yn(int __n, double __x) { // TODO: we could use Ahmes multiplication
1109 // and the Miller & Brown algorithm
1110 // for linear recurrences to get O(log n) steps, but it's unclear if
1111 // it'd be beneficial in this case. Placeholder until OCML adds
1112 // support.
1113 if (__n == 0)
1114 return y0(__x);
1115 if (__n == 1)
1116 return y1(__x);
1117
1118 double __x0 = y0(__x);
1119 double __x1 = y1(__x);
1120 for (int __i = 1; __i < __n; ++__i) {
1121 double __x2 = (2 * __i) / __x * __x1 - __x0;
1122 __x0 = __x1;
1123 __x1 = __x2;
1124 }
1125
1126 return __x1;
1127}
1128
1129// BEGIN INTRINSICS
1130#if defined OCML_BASIC_ROUNDED_OPERATIONS
1132double __dadd_rd(double __x, double __y) {
1133 return __ocml_add_rtn_f64(__x, __y);
1134}
1136double __dadd_rn(double __x, double __y) {
1137 return __ocml_add_rte_f64(__x, __y);
1138}
1140double __dadd_ru(double __x, double __y) {
1141 return __ocml_add_rtp_f64(__x, __y);
1142}
1144double __dadd_rz(double __x, double __y) {
1145 return __ocml_add_rtz_f64(__x, __y);
1146}
1147#else
1149double __dadd_rn(double __x, double __y) { return __x + __y; }
1150#endif
1151
1152#if defined OCML_BASIC_ROUNDED_OPERATIONS
1154double __ddiv_rd(double __x, double __y) {
1155 return __ocml_div_rtn_f64(__x, __y);
1156}
1158double __ddiv_rn(double __x, double __y) {
1159 return __ocml_div_rte_f64(__x, __y);
1160}
1162double __ddiv_ru(double __x, double __y) {
1163 return __ocml_div_rtp_f64(__x, __y);
1164}
1166double __ddiv_rz(double __x, double __y) {
1167 return __ocml_div_rtz_f64(__x, __y);
1168}
1169#else
1171double __ddiv_rn(double __x, double __y) { return __x / __y; }
1172#endif
1173
1174#if defined OCML_BASIC_ROUNDED_OPERATIONS
1176double __dmul_rd(double __x, double __y) {
1177 return __ocml_mul_rtn_f64(__x, __y);
1178}
1180double __dmul_rn(double __x, double __y) {
1181 return __ocml_mul_rte_f64(__x, __y);
1182}
1184double __dmul_ru(double __x, double __y) {
1185 return __ocml_mul_rtp_f64(__x, __y);
1186}
1188double __dmul_rz(double __x, double __y) {
1189 return __ocml_mul_rtz_f64(__x, __y);
1190}
1191#else
1193double __dmul_rn(double __x, double __y) { return __x * __y; }
1194#endif
1195
1196#if defined OCML_BASIC_ROUNDED_OPERATIONS
1198double __drcp_rd(double __x) { return __ocml_div_rtn_f64(1.0, __x); }
1200double __drcp_rn(double __x) { return __ocml_div_rte_f64(1.0, __x); }
1202double __drcp_ru(double __x) { return __ocml_div_rtp_f64(1.0, __x); }
1204double __drcp_rz(double __x) { return __ocml_div_rtz_f64(1.0, __x); }
1205#else
1207double __drcp_rn(double __x) { return 1.0 / __x; }
1208#endif
1209
1210#if defined OCML_BASIC_ROUNDED_OPERATIONS
1212double __dsqrt_rd(double __x) { return __ocml_sqrt_rtn_f64(__x); }
1214double __dsqrt_rn(double __x) { return __ocml_sqrt_rte_f64(__x); }
1216double __dsqrt_ru(double __x) { return __ocml_sqrt_rtp_f64(__x); }
1218double __dsqrt_rz(double __x) { return __ocml_sqrt_rtz_f64(__x); }
1219#else
1221double __dsqrt_rn(double __x) { return __builtin_sqrt(__x); }
1222#endif
1223
1224#if defined OCML_BASIC_ROUNDED_OPERATIONS
1226double __dsub_rd(double __x, double __y) {
1227 return __ocml_sub_rtn_f64(__x, __y);
1228}
1230double __dsub_rn(double __x, double __y) {
1231 return __ocml_sub_rte_f64(__x, __y);
1232}
1234double __dsub_ru(double __x, double __y) {
1235 return __ocml_sub_rtp_f64(__x, __y);
1236}
1238double __dsub_rz(double __x, double __y) {
1239 return __ocml_sub_rtz_f64(__x, __y);
1240}
1241#else
1243double __dsub_rn(double __x, double __y) { return __x - __y; }
1244#endif
1245
1246#if defined OCML_BASIC_ROUNDED_OPERATIONS
1248double __fma_rd(double __x, double __y, double __z) {
1249 return __ocml_fma_rtn_f64(__x, __y, __z);
1250}
1252double __fma_rn(double __x, double __y, double __z) {
1253 return __ocml_fma_rte_f64(__x, __y, __z);
1254}
1256double __fma_ru(double __x, double __y, double __z) {
1257 return __ocml_fma_rtp_f64(__x, __y, __z);
1258}
1260double __fma_rz(double __x, double __y, double __z) {
1261 return __ocml_fma_rtz_f64(__x, __y, __z);
1262}
1263#else
1265double __fma_rn(double __x, double __y, double __z) {
1266 return __builtin_fma(__x, __y, __z);
1267}
1268#endif
1269// END INTRINSICS
1270// END DOUBLE
1271
1272// C only macros
1273#if !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
1274#define isfinite(__x) _Generic((__x), float : __finitef, double : __finite)(__x)
1275#define isinf(__x) _Generic((__x), float : __isinff, double : __isinf)(__x)
1276#define isnan(__x) _Generic((__x), float : __isnanf, double : __isnan)(__x)
1277#define signbit(__x) \
1278 _Generic((__x), float : __signbitf, double : __signbit)(__x)
1279#endif // !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
1280
1281#if defined(__cplusplus)
1282template <class T> __DEVICE__ T min(T __arg1, T __arg2) {
1283 return (__arg1 < __arg2) ? __arg1 : __arg2;
1284}
1285
1286template <class T> __DEVICE__ T max(T __arg1, T __arg2) {
1287 return (__arg1 > __arg2) ? __arg1 : __arg2;
1288}
1289
1290__DEVICE__ int min(int __arg1, int __arg2) {
1291 return (__arg1 < __arg2) ? __arg1 : __arg2;
1292}
1293__DEVICE__ int max(int __arg1, int __arg2) {
1294 return (__arg1 > __arg2) ? __arg1 : __arg2;
1295}
1296
1298float max(float __x, float __y) { return __builtin_fmaxf(__x, __y); }
1299
1301double max(double __x, double __y) { return __builtin_fmax(__x, __y); }
1302
1304float min(float __x, float __y) { return __builtin_fminf(__x, __y); }
1305
1307double min(double __x, double __y) { return __builtin_fmin(__x, __y); }
1308
1309#if !defined(__HIPCC_RTC__) && !defined(__OPENMP_AMDGCN__)
1310__host__ inline static int min(int __arg1, int __arg2) {
1311 return __arg1 < __arg2 ? __arg1 : __arg2;
1312}
1313
1314__host__ inline static int max(int __arg1, int __arg2) {
1315 return __arg1 > __arg2 ? __arg1 : __arg2;
1316}
1317#endif // !defined(__HIPCC_RTC__) && !defined(__OPENMP_AMDGCN__)
1318#endif
1319
1320#pragma pop_macro("__DEVICE__")
1321#pragma pop_macro("__RETURN_TYPE")
1322#pragma pop_macro("__FAST_OR_SLOW")
1323
1324#endif // __CLANG_HIP_MATH_H__
__DEVICE__ long long abs(long long __n)
__DEVICE__ float __fsqrt_rd(float __a)
__DEVICE__ float __fdiv_rd(float __a, float __b)
__DEVICE__ double __dsub_ru(double __a, double __b)
__DEVICE__ double __drcp_ru(double __a)
__DEVICE__ float __frcp_rz(float __a)
__DEVICE__ float __fmul_ru(float __a, float __b)
__DEVICE__ double __dsub_rd(double __a, double __b)
__DEVICE__ float __frcp_ru(float __a)
__DEVICE__ float __frcp_rd(float __a)
__DEVICE__ double __dmul_ru(double __a, double __b)
__DEVICE__ float __fmaf_ru(float __a, float __b, float __c)
__DEVICE__ double __fma_rz(double __a, double __b, double __c)
__DEVICE__ double __fma_rd(double __a, double __b, double __c)
__DEVICE__ double __dmul_rd(double __a, double __b)
__DEVICE__ double __ddiv_ru(double __a, double __b)
__DEVICE__ double __ddiv_rd(double __a, double __b)
__DEVICE__ double __dadd_ru(double __a, double __b)
__DEVICE__ float __fmul_rd(float __a, float __b)
__DEVICE__ float __fsub_rd(float __a, float __b)
__DEVICE__ float __fsub_rz(float __a, float __b)
__DEVICE__ double __fma_ru(double __a, double __b, double __c)
__DEVICE__ double __dsqrt_ru(double __a)
__DEVICE__ float __fsqrt_rz(float __a)
__DEVICE__ double __dsub_rz(double __a, double __b)
__DEVICE__ float __fadd_rd(float __a, float __b)
__DEVICE__ float __fmul_rz(float __a, float __b)
__DEVICE__ float __fadd_rz(float __a, float __b)
__DEVICE__ double __dsqrt_rd(double __a)
__DEVICE__ float __fmaf_rd(float __a, float __b, float __c)
__DEVICE__ double __dadd_rd(double __a, double __b)
__DEVICE__ double __dsqrt_rz(double __a)
__DEVICE__ double __drcp_rd(double __a)
__DEVICE__ float __fdiv_rz(float __a, float __b)
__DEVICE__ float __fmaf_rz(float __a, float __b, float __c)
__DEVICE__ double __drcp_rz(double __a)
__DEVICE__ float __fsub_ru(float __a, float __b)
__DEVICE__ double __dmul_rz(double __a, double __b)
__DEVICE__ float __fsqrt_ru(float __a)
__DEVICE__ float __fadd_ru(float __a, float __b)
__DEVICE__ float __fdiv_ru(float __a, float __b)
__DEVICE__ double __ddiv_rz(double __a, double __b)
__DEVICE__ double __dadd_rz(double __a, double __b)
__DEVICE__ long labs(long __a)
__DEVICE__ long long llabs(long long __a)
__DEVICE__ int min(int __a, int __b)
__DEVICE__ int max(int __a, int __b)
__device__ double __ocml_i0_f64(double)
__device__ float __ocml_j1_f32(float)
__device__ double __ocml_remquo_f64(double, double, __attribute__((address_space(5))) int *)
__device__ double __ocml_modf_f64(double, __attribute__((address_space(5))) double *)
__device__ float __ocml_cospi_f32(float)
__device__ float __ocml_i0_f32(float)
__device__ double __ocml_lgamma_f64(double)
__device__ __2f16 b
__device__ float __ocml_sincos_f32(float, __attribute__((address_space(5))) float *)
__device__ float __ocml_remquo_f32(float, float, __attribute__((address_space(5))) int *)
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
__device__ float __ocml_y0_f32(float)
__device__ float __ocml_modf_f32(float, __attribute__((address_space(5))) float *)
__device__ float __ocml_i1_f32(float)
__device__ float __ocml_lgamma_f32(float)
__device__ double __ocml_sinpi_f64(double)
__device__ double __ocml_cospi_f64(double)
__device__ double __ocml_tgamma_f64(double)
__device__ float __ocml_tan_f32(float)
__device__ float __ocml_tgamma_f32(float)
__device__ double __ocml_sincos_f64(double, __attribute__((address_space(5))) double *)
__device__ float __ocml_sinpi_f32(float)
__device__ double __ocml_j1_f64(double)
__device__ double __ocml_y1_f64(double)
__device__ double __ocml_j0_f64(double)
__device__ float __ocml_cos_f32(float)
__device__ float __ocml_y1_f32(float)
__device__ float __ocml_j0_f32(float)
__device__ double __ocml_cos_f64(double)
__device__ double __ocml_i1_f64(double)
__device__ double __ocml_sin_f64(double)
__device__ double __ocml_sincospi_f64(double, __attribute__((address_space(5))) double *)
__device__ float __ocml_sin_f32(float)
__device__ float __ocml_sincospi_f32(float, __attribute__((address_space(5))) float *)
__device__ float __ocml_native_sin_f32(float)
__device__ float __ocml_native_cos_f32(float)
__device__ double __ocml_y0_f64(double)
__device__ double __ocml_tan_f64(double)
__DEVICE__ double __dsub_rn(double __x, double __y)
__DEVICE__ __RETURN_TYPE __isinff(float __x)
__DEVICE__ float sinpif(float __x)
__DEVICE__ float tanf(float __x)
__DEVICE__ float log2f(float __x)
__DEVICE__ float y0f(float __x)
__DEVICE__ float tanhf(float __x)
__DEVICE__ float coshf(float __x)
__DEVICE__ float log10f(float __x)
__DEVICE__ float j1f(float __x)
__DEVICE__ __RETURN_TYPE __finitef(float __x)
__DEVICE__ float ldexpf(float __x, int __e)
__DEVICE__ long long int llroundf(float __x)
__DEVICE__ double rhypot(double __x, double __y)
__DEVICE__ double normcdfinv(double __x)
__DEVICE__ double norm3d(double __x, double __y, double __z)
__DEVICE__ float truncf(float __x)
__DEVICE__ float remainderf(float __x, float __y)
__DEVICE__ float fabsf(float __x)
__DEVICE__ float __fdiv_rn(float __x, float __y)
__DEVICE__ float scalbnf(float __x, int __n)
__DEVICE__ float cyl_bessel_i0f(float __x)
__DEVICE__ float nanf(const char *__tagp __attribute__((nonnull)))
__DEVICE__ float lgammaf(float __x)
__DEVICE__ float cospif(float __x)
__DEVICE__ __RETURN_TYPE __signbitf(float __x)
__DEVICE__ double __dsqrt_rn(double __x)
__DEVICE__ float frexpf(float __x, int *__nptr)
__DEVICE__ float tgammaf(float __x)
__DEVICE__ float __sinf(float __x)
__DEVICE__ float erfinvf(float __x)
__DEVICE__ float modff(float __x, float *__iptr)
__DEVICE__ double erfinv(double __x)
__DEVICE__ float expm1f(float __x)
__DEVICE__ float sinhf(float __x)
__DEVICE__ double j0(double __x)
__DEVICE__ float y1f(float __x)
__DEVICE__ float acosf(float __x)
__DEVICE__ float fmaf(float __x, float __y, float __z)
__DEVICE__ float cyl_bessel_i1f(float __x)
__DEVICE__ float fmodf(float __x, float __y)
__DEVICE__ float log1pf(float __x)
__DEVICE__ float atan2f(float __x, float __y)
__DEVICE__ float copysignf(float __x, float __y)
__DEVICE__ double j1(double __x)
__DEVICE__ __RETURN_TYPE __isnan(double __x)
__DEVICE__ float rnormf(int __dim, const float *__a)
__DEVICE__ float rnorm4df(float __x, float __y, float __z, float __w)
__DEVICE__ float __cosf(float __x)
__DEVICE__ float erff(float __x)
__DEVICE__ float atanf(float __x)
__DEVICE__ float rnorm3df(float __x, float __y, float __z)
__DEVICE__ double norm(int __dim, const double *__a)
__DEVICE__ float erfcxf(float __x)
__DEVICE__ float erfcinvf(float __x)
__DEVICE__ float asinf(float __x)
__DEVICE__ long int lroundf(float __x)
__DEVICE__ float __fdividef(float __x, float __y)
__DEVICE__ float __frsqrt_rn(float __x)
__DEVICE__ float __log2f(float __x)
__DEVICE__ float norm4df(float __x, float __y, float __z, float __w)
__DEVICE__ __RETURN_TYPE __isnanf(float __x)
__DEVICE__ uint64_t __make_mantissa_base10(const char *__tagp __attribute__((nonnull)))
__DEVICE__ double jn(int __n, double __x)
__DEVICE__ float __exp10f(float __x)
__DEVICE__ float __frcp_rn(float __x)
#define __DEVICE__
__DEVICE__ float ynf(int __n, float __x)
__DEVICE__ float powf(float __x, float __y)
__DEVICE__ float __fsub_rn(float __x, float __y)
__DEVICE__ double __dadd_rn(double __x, double __y)
__DEVICE__ float sinf(float __x)
__DEVICE__ float __tanf(float __x)
__DEVICE__ float remquof(float __x, float __y, int *__quo)
__DEVICE__ double normcdf(double __x)
__DEVICE__ float __fsqrt_rn(float __x)
__DEVICE__ float hypotf(float __x, float __y)
__DEVICE__ float __fmaf_rn(float __x, float __y, float __z)
__DEVICE__ void sincosf(float __x, float *__sinptr, float *__cosptr)
__DEVICE__ uint64_t __make_mantissa_base8(const char *__tagp __attribute__((nonnull)))
__DEVICE__ float exp10f(float __x)
__DEVICE__ double y1(double __x)
#define __FAST_OR_SLOW(fast, slow)
__DEVICE__ float fmaxf(float __x, float __y)
__DEVICE__ float fminf(float __x, float __y)
__DEVICE__ double erfcinv(double __x)
__DEVICE__ double powi(double __x, int __y)
__DEVICE__ float logf(float __x)
__DEVICE__ float __fadd_rn(float __x, float __y)
__DEVICE__ double cospi(double __x)
__DEVICE__ double rsqrt(double __x)
__DEVICE__ float erfcf(float __x)
__DEVICE__ float atanhf(float __x)
__DEVICE__ float asinhf(float __x)
__DEVICE__ float __expf(float __x)
__DEVICE__ double norm4d(double __x, double __y, double __z, double __w)
#define __RETURN_TYPE
__DEVICE__ float __logf(float __x)
__DEVICE__ double __fma_rn(double __x, double __y, double __z)
__DEVICE__ double nan(const char *__tagp)
__DEVICE__ double rnorm(int __dim, const double *__a)
__DEVICE__ float j0f(float __x)
__DEVICE__ float rsqrtf(float __x)
__DEVICE__ float jnf(int __n, float __x)
__DEVICE__ double sinpi(double __x)
__DEVICE__ float logbf(float __x)
__DEVICE__ double y0(double __x)
__DEVICE__ __RETURN_TYPE __finite(double __x)
__DEVICE__ void __sincosf(float __x, float *__sinptr, float *__cosptr)
__DEVICE__ double yn(int __n, double __x)
__DEVICE__ float rhypotf(float __x, float __y)
__DEVICE__ float exp2f(float __x)
__DEVICE__ double cyl_bessel_i0(double __x)
__DEVICE__ float powif(float __x, int __y)
__DEVICE__ double __ddiv_rn(double __x, double __y)
__DEVICE__ double cyl_bessel_i1(double __x)
__DEVICE__ float ceilf(float __x)
__DEVICE__ double rcbrt(double __x)
__DEVICE__ double rnorm3d(double __x, double __y, double __z)
__DEVICE__ float normcdfinvf(float __x)
__DEVICE__ float norm3df(float __x, float __y, float __z)
__DEVICE__ void sincos(double __x, double *__sinptr, double *__cosptr)
#define __static_assert_type_size_equal(A, B)
__DEVICE__ __RETURN_TYPE __signbit(double __x)
__DEVICE__ float fdimf(float __x, float __y)
__DEVICE__ double __dmul_rn(double __x, double __y)
__DEVICE__ float normf(int __dim, const float *__a)
__DEVICE__ float nearbyintf(float __x)
__DEVICE__ uint64_t __make_mantissa(const char *__tagp __attribute__((nonnull)))
__DEVICE__ int ilogbf(float __x)
__DEVICE__ float floorf(float __x)
__DEVICE__ float sqrtf(float __x)
__DEVICE__ float roundf(float __x)
__DEVICE__ void sincospif(float __x, float *__sinptr, float *__cosptr)
__DEVICE__ double __drcp_rn(double __x)
__DEVICE__ long int lrintf(float __x)
__DEVICE__ float acoshf(float __x)
__DEVICE__ double modf(double __x, double *__iptr)
__DEVICE__ float cosf(float __x)
__DEVICE__ float expf(float __x)
__DEVICE__ float nextafterf(float __x, float __y)
__DEVICE__ double rnorm4d(double __x, double __y, double __z, double __w)
__DEVICE__ long long int llrintf(float __x)
__DEVICE__ double erfcx(double __x)
__DEVICE__ float fdividef(float __x, float __y)
__DEVICE__ float rcbrtf(float __x)
__DEVICE__ double exp10(double __x)
__DEVICE__ float __log10f(float __x)
__DEVICE__ float cbrtf(float __x)
__DEVICE__ float __fmul_rn(float __x, float __y)
__DEVICE__ void sincospi(double __x, double *__sinptr, double *__cosptr)
__DEVICE__ float scalblnf(float __x, long int __n)
__DEVICE__ __RETURN_TYPE __isinf(double __x)
__DEVICE__ float rintf(float __x)
__DEVICE__ float normcdff(float __x)
__DEVICE__ uint64_t __make_mantissa_base16(const char *__tagp __attribute__((nonnull)))
__DEVICE__ float __saturatef(float __x)
__DEVICE__ float __powf(float __x, float __y)
static __inline__ uint32_t uint32_t __y
Definition: arm_acle.h:122
static __inline__ void int __a
Definition: emmintrin.h:4057
#define INT_MAX
Definition: limits.h:46
const FunctionProtoType * T
float __ovld __cnfn sign(float)
Returns 1.0 if x > 0, -0.0 if x = -0.0, +0.0 if x = +0.0, or -1.0 if x < 0.
#define true
Definition: stdbool.h:21
#define sinh(__x)
Definition: tgmath.h:373
#define asin(__x)
Definition: tgmath.h:112
#define scalbln(__x, __y)
Definition: tgmath.h:1182
#define sqrt(__x)
Definition: tgmath.h:520
#define acos(__x)
Definition: tgmath.h:83
#define fmin(__x, __y)
Definition: tgmath.h:780
#define exp(__x)
Definition: tgmath.h:431
#define ilogb(__x)
Definition: tgmath.h:851
#define copysign(__x, __y)
Definition: tgmath.h:618
#define erf(__x)
Definition: tgmath.h:636
#define atanh(__x)
Definition: tgmath.h:228
#define remquo(__x, __y, __z)
Definition: tgmath.h:1111
#define nextafter(__x, __y)
Definition: tgmath.h:1055
#define frexp(__x, __y)
Definition: tgmath.h:816
#define asinh(__x)
Definition: tgmath.h:199
#define erfc(__x)
Definition: tgmath.h:653
#define atan2(__x, __y)
Definition: tgmath.h:566
#define hypot(__x, __y)
Definition: tgmath.h:833
#define exp2(__x)
Definition: tgmath.h:670
#define sin(__x)
Definition: tgmath.h:286
#define cbrt(__x)
Definition: tgmath.h:584
#define log2(__x)
Definition: tgmath.h:970
#define llround(__x)
Definition: tgmath.h:919
#define cosh(__x)
Definition: tgmath.h:344
#define trunc(__x)
Definition: tgmath.h:1216
#define fmax(__x, __y)
Definition: tgmath.h:762
#define ldexp(__x, __y)
Definition: tgmath.h:868
#define acosh(__x)
Definition: tgmath.h:170
#define tgamma(__x)
Definition: tgmath.h:1199
#define scalbn(__x, __y)
Definition: tgmath.h:1165
#define round(__x)
Definition: tgmath.h:1148
#define fmod(__x, __y)
Definition: tgmath.h:798
#define llrint(__x)
Definition: tgmath.h:902
#define tan(__x)
Definition: tgmath.h:315
#define cos(__x)
Definition: tgmath.h:257
#define log10(__x)
Definition: tgmath.h:936
#define fabs(__x)
Definition: tgmath.h:549
#define pow(__x, __y)
Definition: tgmath.h:490
#define log1p(__x)
Definition: tgmath.h:953
#define rint(__x)
Definition: tgmath.h:1131
#define expm1(__x)
Definition: tgmath.h:687
#define remainder(__x, __y)
Definition: tgmath.h:1090
#define fdim(__x, __y)
Definition: tgmath.h:704
#define lgamma(__x)
Definition: tgmath.h:885
#define tanh(__x)
Definition: tgmath.h:402
#define lrint(__x)
Definition: tgmath.h:1004
#define atan(__x)
Definition: tgmath.h:141
#define floor(__x)
Definition: tgmath.h:722
#define ceil(__x)
Definition: tgmath.h:601
#define log(__x)
Definition: tgmath.h:460
#define logb(__x)
Definition: tgmath.h:987
#define nearbyint(__x)
Definition: tgmath.h:1038
#define lround(__x)
Definition: tgmath.h:1021
#define fma(__x, __y, __z)
Definition: tgmath.h:742