diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-08-23 19:27:42 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-08-23 19:27:42 +0000 |
commit | 0814bdad52c764ec4f3c010e78d7cdb6418e64e0 (patch) | |
tree | 3c706ff1cb2cce2cbc9eb500095745b974e3e4b9 /libc/sysdeps/linux/m68k/bits/mathinline.h | |
parent | e47414d975e0ba1fe3a5f329756a20daaf31fefa (diff) |
sync with upstream via psm
Diffstat (limited to 'libc/sysdeps/linux/m68k/bits/mathinline.h')
-rw-r--r-- | libc/sysdeps/linux/m68k/bits/mathinline.h | 77 |
1 files changed, 29 insertions, 48 deletions
diff --git a/libc/sysdeps/linux/m68k/bits/mathinline.h b/libc/sysdeps/linux/m68k/bits/mathinline.h index 81aab8881..acbac47aa 100644 --- a/libc/sysdeps/linux/m68k/bits/mathinline.h +++ b/libc/sysdeps/linux/m68k/bits/mathinline.h @@ -1,5 +1,6 @@ /* Definitions of inline math functions implemented by the m68881/2. - Copyright (C) 1991,92,93,94,96,97,98,99,2000 Free Software Foundation, Inc. + Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,52 +21,60 @@ #ifdef __GNUC__ #ifdef __USE_ISOC99 - +/* GCC 3.1 and up have builtins that actually can be used. */ +# if !__GNUC_PREREQ (3,1) /* ISO C99 defines some macros to perform unordered comparisons. The m68k FPU supports this with special opcodes and we should use them. These must not be inline functions since we have to be able to handle all floating-point types. */ -# define isgreater(x, y) \ +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered +# define isgreater(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsogt %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define isgreaterequal(x, y) \ +# define isgreaterequal(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsoge %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define isless(x, y) \ +# define isless(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsolt %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define islessequal(x, y) \ +# define islessequal(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsole %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define islessgreater(x, y) \ +# define islessgreater(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsogl %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) -# define isunordered(x, y) \ +# define isunordered(x, y) \ __extension__ \ ({ char __result; \ __asm__ ("fcmp%.x %2,%1; fsun %0" \ : "=dm" (__result) : "f" (x), "f" (y)); \ __result != 0; }) +# endif /* GCC 3.1 */ #endif @@ -101,7 +110,7 @@ #if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathop(func, op) \ __inline_mathop1(double, func, op) \ - __inline_mathop1(float, __CONCAT(func,f), op) \ + __inline_mathop1(float, __CONCAT(func,f), op) \ __inline_mathop1(long double, __CONCAT(func,l), op) #else # define __inline_mathop(func, op) \ @@ -166,29 +175,7 @@ __inline_mathop(trunc, intrz) for the function names. */ #define __inline_functions(float_type, s) \ -__m81_inline float_type \ -__m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr) \ -{ \ - float_type __mantissa, __exponent; \ - int __iexponent; \ - unsigned long __fpsr; \ - __asm("ftst%.x %1\n" \ - "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \ - if (__fpsr & (7 << 24)) \ - { \ - /* Not finite or zero. */ \ - *__expptr = 0; \ - return __value; \ - } \ - __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value)); \ - __iexponent = (int) __exponent + 1; \ - *__expptr = __iexponent; \ - __asm("fscale%.l %2, %0" : "=f" (__mantissa) \ - : "0" (__value), "dmi" (-__iexponent)); \ - return __mantissa; \ -} \ - \ -__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ +__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -204,7 +191,7 @@ __m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ return __result; \ } \ \ -__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \ +__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -230,7 +217,7 @@ __inline_functions(long double,l) #ifdef __USE_MISC # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ { \ /* There is no branch-condition for infinity, \ so we must extract and examine the condition codes manually. */ \ @@ -240,7 +227,7 @@ __m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \ } \ \ -__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \ { \ /* There is no branch-condition for infinity, so we must extract and \ examine the condition codes manually. */ \ @@ -268,7 +255,7 @@ __inline_functions(long double,l) #if defined __USE_MISC || defined __USE_XOPEN # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ { \ char __result; \ __asm("ftst%.x %1\n" \ @@ -288,7 +275,7 @@ __inline_functions(long double,l) #ifdef __USE_ISOC99 # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \ +__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \ { \ /* There is no branch-condition for the sign bit, so we must extract \ and examine the condition codes manually. */ \ @@ -298,7 +285,7 @@ __m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \ return (__fpsr >> 27) & 1; \ } \ \ -__m81_defun (float_type, __CONCAT(__scalbln,s), \ + __m81_defun (float_type, __CONCAT(__scalbln,s), \ (float_type __x, long int __n)) \ { \ return __CONCAT(__scalbn,s) (__x, __n); \ @@ -364,10 +351,10 @@ __inline_functions (long double,l) /* Note that there must be no whitespace before the argument passed for NAME, to make token pasting work correctly with -traditional. */ # define __inline_forward_c(rettype, name, args1, args2) \ -extern __inline rettype __attribute__((__const__)) \ -name args1 \ -{ \ - return __CONCAT(__,name) args2; \ +extern __inline rettype __attribute__((__const__)) \ + name args1 \ +{ \ + return __CONCAT(__,name) args2; \ } # define __inline_forward(rettype, name, args1, args2) \ @@ -376,8 +363,6 @@ extern __inline rettype name args1 \ return __CONCAT(__,name) args2; \ } -__inline_forward(double,frexp, (double __value, int *__expptr), - (__value, __expptr)) __inline_forward_c(double,floor, (double __x), (__x)) __inline_forward_c(double,ceil, (double __x), (__x)) # ifdef __USE_MISC @@ -406,8 +391,6 @@ __inline_forward(void,sincos, (double __x, double *__sinx, double *__cosx), # if defined __USE_MISC || defined __USE_ISOC99 -__inline_forward(float,frexpf, (float __value, int *__expptr), - (__value, __expptr)) __inline_forward_c(float,floorf, (float __x), (__x)) __inline_forward_c(float,ceilf, (float __x), (__x)) # ifdef __USE_MISC @@ -428,8 +411,6 @@ __inline_forward(void,sincosf, (float __x, float *__sinx, float *__cosx), (__x, __sinx, __cosx)) # endif -__inline_forward(long double,frexpl, (long double __value, int *__expptr), - (__value, __expptr)) __inline_forward_c(long double,floorl, (long double __x), (__x)) __inline_forward_c(long double,ceill, (long double __x), (__x)) # ifdef __USE_MISC |