Back to index

glibc  2.9
mathimpl.h
Go to the documentation of this file.
00001 /* Definitions of libc internal inline math functions implemented
00002    by the m68881/2.
00003    Copyright (C) 1991,92,93,94,96,97,98,99 Free Software Foundation, Inc.
00004    This file is part of the GNU C Library.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 /* This file contains the definitions of the inline math functions that
00022    are only used internally inside libm, not visible to the user.  */
00023 
00024 __inline_mathop      (__ieee754_acos, acos)
00025 __inline_mathop      (__ieee754_asin, asin)
00026 __inline_mathop      (__ieee754_cosh, cosh)
00027 __inline_mathop      (__ieee754_sinh, sinh)
00028 __inline_mathop      (__ieee754_exp, etox)
00029 __inline_mathop      (__ieee754_exp2, twotox)
00030 __inline_mathop      (__ieee754_exp10, tentox)
00031 __inline_mathop      (__ieee754_log10, log10)
00032 __inline_mathop      (__ieee754_log2, log2)
00033 __inline_mathop      (__ieee754_log, logn)
00034 __inline_mathop      (__ieee754_sqrt, sqrt)
00035 __inline_mathop      (__ieee754_atanh, atanh)
00036 
00037 __m81_defun (double, __ieee754_remainder, (double __x, double __y))
00038 {
00039   double __result;
00040   __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
00041   return __result;
00042 }
00043 
00044 __m81_defun (float, __ieee754_remainderf, (float __x, float __y))
00045 {
00046   float __result;
00047   __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
00048   return __result;
00049 }
00050 
00051 __m81_defun (long double,
00052             __ieee754_remainderl, (long double __x, long double __y))
00053 {
00054   long double __result;
00055   __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
00056   return __result;
00057 }
00058 
00059 __m81_defun (double, __ieee754_fmod, (double __x, double __y))
00060 {
00061   double __result;
00062   __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
00063   return __result;
00064 }
00065 
00066 __m81_defun (float, __ieee754_fmodf, (float __x, float __y))
00067 {
00068   float __result;
00069   __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
00070   return __result;
00071 }
00072 
00073 __m81_defun (long double,
00074             __ieee754_fmodl, (long double __x, long double __y))
00075 {
00076   long double __result;
00077   __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
00078   return __result;
00079 }
00080 
00081 /* Get the m68881 condition codes, to quickly check multiple conditions.  */
00082 static __inline__ unsigned long
00083 __m81_test (long double __val)
00084 {
00085   unsigned long __fpsr;
00086   __asm ("ftst%.x %1; fmove%.l %/fpsr,%0" : "=dm" (__fpsr) : "f" (__val));
00087   return __fpsr;
00088 }
00089 
00090 /* Bit values returned by __m81_test.  */
00091 #define __M81_COND_NAN  (1 << 24)
00092 #define __M81_COND_INF  (2 << 24)
00093 #define __M81_COND_ZERO (4 << 24)
00094 #define __M81_COND_NEG  (8 << 24)