1/* Definitions of libc internal inline math functions implemented
2   by the m68881/2.
3   Copyright (C) 1991,92,93,94,96,97,98,99 Free Software Foundation, Inc.
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
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.
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
14   Lesser General Public License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with the GNU C Library; if not, write to the Free
18   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19   02111-1307 USA.  */
20
21/* This file contains the definitions of the inline math functions that
22   are only used internally inside libm, not visible to the user.  */
23
24__inline_mathop	(__ieee754_acos, acos)
25__inline_mathop	(__ieee754_asin, asin)
26__inline_mathop	(__ieee754_cosh, cosh)
27__inline_mathop	(__ieee754_sinh, sinh)
28__inline_mathop	(__ieee754_exp, etox)
29__inline_mathop	(__ieee754_exp2, twotox)
30__inline_mathop	(__ieee754_exp10, tentox)
31__inline_mathop	(__ieee754_log10, log10)
32__inline_mathop	(__ieee754_log2, log2)
33__inline_mathop	(__ieee754_log, logn)
34__inline_mathop	(__ieee754_sqrt, sqrt)
35__inline_mathop	(__ieee754_atanh, atanh)
36
37__m81_defun (double, __ieee754_remainder, (double __x, double __y))
38{
39  double __result;
40  __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
41  return __result;
42}
43
44__m81_defun (float, __ieee754_remainderf, (float __x, float __y))
45{
46  float __result;
47  __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
48  return __result;
49}
50
51__m81_defun (long double,
52	     __ieee754_remainderl, (long double __x, long double __y))
53{
54  long double __result;
55  __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
56  return __result;
57}
58
59__m81_defun (double, __ieee754_fmod, (double __x, double __y))
60{
61  double __result;
62  __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
63  return __result;
64}
65
66__m81_defun (float, __ieee754_fmodf, (float __x, float __y))
67{
68  float __result;
69  __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
70  return __result;
71}
72
73__m81_defun (long double,
74	     __ieee754_fmodl, (long double __x, long double __y))
75{
76  long double __result;
77  __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
78  return __result;
79}
80
81/* Get the m68881 condition codes, to quickly check multiple conditions.  */
82static __inline__ unsigned long
83__m81_test (long double __val)
84{
85  unsigned long __fpsr;
86  __asm ("ftst%.x %1; fmove%.l %/fpsr,%0" : "=dm" (__fpsr) : "f" (__val));
87  return __fpsr;
88}
89
90/* Bit values returned by __m81_test.  */
91#define __M81_COND_NAN  (1 << 24)
92#define __M81_COND_INF  (2 << 24)
93#define __M81_COND_ZERO (4 << 24)
94#define __M81_COND_NEG  (8 << 24)
95