]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/m68k/m680x0/fpu/mathimpl.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / m68k / m680x0 / fpu / mathimpl.h
CommitLineData
5da9d124
AS
1/* Definitions of libc internal inline math functions implemented
2 by the m68881/2.
04277e02 3 Copyright (C) 1991-2019 Free Software Foundation, Inc.
5da9d124
AS
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
3214b89b
AJ
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.
5da9d124
AS
10
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
3214b89b 14 Lesser General Public License for more details.
5da9d124 15
3214b89b 16 You should have received a copy of the GNU Lesser General Public
ab84e3ff
PE
17 License along with the GNU C Library. If not, see
18 <http://www.gnu.org/licenses/>. */
5da9d124
AS
19
20/* This file contains the definitions of the inline math functions that
21 are only used internally inside libm, not visible to the user. */
22
66425185
JM
23__inline_mathop (__ieee754_acos, acos,)
24__inline_mathop (__ieee754_asin, asin,)
25__inline_mathop (__ieee754_cosh, cosh,)
26__inline_mathop (__ieee754_sinh, sinh,)
27__inline_mathop (__ieee754_exp, etox,)
28__inline_mathop (__ieee754_exp2, twotox,)
29__inline_mathop (__ieee754_exp10, tentox,)
30__inline_mathop (__ieee754_log10, log10,)
31__inline_mathop (__ieee754_log2, log2,)
32__inline_mathop (__ieee754_log, logn,)
22679b2c 33__inline_mathop (__ieee754_sqrt, sqrt,)
66425185 34__inline_mathop (__ieee754_atanh, atanh,)
5da9d124 35
66425185 36__m81_defun (double, __ieee754_remainder, (double __x, double __y),)
5da9d124
AS
37{
38 double __result;
39 __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
40 return __result;
41}
42
66425185 43__m81_defun (float, __ieee754_remainderf, (float __x, float __y),)
5da9d124
AS
44{
45 float __result;
46 __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
47 return __result;
48}
49
50__m81_defun (long double,
66425185 51 __ieee754_remainderl, (long double __x, long double __y),)
5da9d124
AS
52{
53 long double __result;
54 __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
55 return __result;
56}
57
66425185 58__m81_defun (double, __ieee754_fmod, (double __x, double __y),)
5da9d124
AS
59{
60 double __result;
61 __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
62 return __result;
63}
64
66425185 65__m81_defun (float, __ieee754_fmodf, (float __x, float __y),)
5da9d124
AS
66{
67 float __result;
68 __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
69 return __result;
70}
71
72__m81_defun (long double,
66425185 73 __ieee754_fmodl, (long double __x, long double __y),)
5da9d124
AS
74{
75 long double __result;
76 __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
77 return __result;
78}
79
80/* Get the m68881 condition codes, to quickly check multiple conditions. */
81static __inline__ unsigned long
82__m81_test (long double __val)
83{
84 unsigned long __fpsr;
85 __asm ("ftst%.x %1; fmove%.l %/fpsr,%0" : "=dm" (__fpsr) : "f" (__val));
86 return __fpsr;
87}
88
89/* Bit values returned by __m81_test. */
90#define __M81_COND_NAN (1 << 24)
91#define __M81_COND_INF (2 << 24)
92#define __M81_COND_ZERO (4 << 24)
93#define __M81_COND_NEG (8 << 24)