Remove ancient __signbit inlines
[glibc.git] / sysdeps / sparc / fpu / bits / mathinline.h
blob0c5da628bf59b2d5adaeddf616df92d2bdbef522
1 /* Inline math functions for SPARC.
2 Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Jakub Jelinek <jakub@redhat.com>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef _MATH_H
21 # error "Never use <bits/mathinline.h> directly; include <math.h> instead."
22 #endif
24 #include <bits/wordsize.h>
26 #ifdef __GNUC__
28 #if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) && defined __OPTIMIZE__
30 # ifndef __extern_inline
31 # define __MATH_INLINE __inline
32 # else
33 # define __MATH_INLINE __extern_inline
34 # endif /* __cplusplus */
36 /* The gcc, version 2.7 or below, has problems with all this inlining
37 code. So disable it for this version of the compiler. */
38 # if __GNUC_PREREQ (2, 8)
40 # if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2)
42 __MATH_INLINE double
43 __NTH (sqrt (double __x))
45 register double __r;
46 __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x));
47 return __r;
50 __MATH_INLINE float
51 __NTH (sqrtf (float __x))
53 register float __r;
54 __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x));
55 return __r;
58 # if __WORDSIZE == 64
59 __MATH_INLINE long double
60 __NTH (sqrtl (long double __x))
62 long double __r;
63 extern void _Qp_sqrt (long double *, const long double *);
64 _Qp_sqrt (&__r, &__x);
65 return __r;
67 # elif !defined __NO_LONG_DOUBLE_MATH
68 __MATH_INLINE long double
69 sqrtl (long double __x) __THROW
71 extern long double _Q_sqrt (const long double);
72 return _Q_sqrt (__x);
74 # endif /* sparc64 */
76 # endif /* !__NO_MATH_INLINES && !GCC 3.2+ */
78 /* This code is used internally in the GNU libc. */
79 # ifdef __LIBC_INTERNAL_MATH_INLINES
80 __MATH_INLINE double
81 __ieee754_sqrt (double __x)
83 register double __r;
84 __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x));
85 return __r;
88 __MATH_INLINE float
89 __ieee754_sqrtf (float __x)
91 register float __r;
92 __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x));
93 return __r;
96 # if __WORDSIZE == 64
97 __MATH_INLINE long double
98 __ieee754_sqrtl (long double __x)
100 long double __r;
101 extern void _Qp_sqrt (long double *, const long double *);
102 _Qp_sqrt(&__r, &__x);
103 return __r;
105 # elif !defined __NO_LONG_DOUBLE_MATH
106 __MATH_INLINE long double
107 __ieee754_sqrtl (long double __x)
109 extern long double _Q_sqrt (const long double);
110 return _Q_sqrt (__x);
112 # endif /* sparc64 */
113 # endif /* __LIBC_INTERNAL_MATH_INLINES */
114 # endif /* gcc 2.8+ */
116 # ifdef __USE_ISOC99
118 # ifndef __NO_MATH_INLINES
120 __MATH_INLINE double __NTH (fdim (double __x, double __y));
121 __MATH_INLINE double
122 __NTH (fdim (double __x, double __y))
124 return __x <= __y ? 0 : __x - __y;
127 __MATH_INLINE float __NTH (fdimf (float __x, float __y));
128 __MATH_INLINE float
129 __NTH (fdimf (float __x, float __y))
131 return __x <= __y ? 0 : __x - __y;
134 # endif /* !__NO_MATH_INLINES */
135 # endif /* __USE_ISOC99 */
136 #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
137 #endif /* __GNUC__ */