diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 19:01:57 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 19:01:57 +0000 |
commit | cab56836b146bc129f1ad43f0393d95a9deca63a (patch) | |
tree | 4f4e655319bbac78fca170da05275c127429b460 /sysdeps/m68k/m680x0/fpu | |
parent | 04ac1241a4cd004872282c2c82ec37fa33925292 (diff) | |
parent | 82dd75a7f436a19047325d62182590c9f9e23a78 (diff) |
Merge branch 't/tls' into refs/top-bases/t/tls-threadvar
Diffstat (limited to 'sysdeps/m68k/m680x0/fpu')
117 files changed, 887 insertions, 758 deletions
diff --git a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h index df498eff56..fbe8d029df 100644 --- a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h +++ b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h @@ -1,5 +1,5 @@ /* Definitions of inline math functions implemented by the m68881/2. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 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 @@ -28,103 +28,28 @@ #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. */ -# 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) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsoge %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - __result != 0; }) - -# 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) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsole %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - __result != 0; }) - -# 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) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsun %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - __result != 0; }) -# endif /* GCC 3.1 */ - -/* Test for negative number. Used in the signbit() macro. */ -__MATH_INLINE int -__NTH (__signbitf (float __x)) -{ - __extension__ union { float __f; int __i; } __u = { __f: __x }; - return __u.__i < 0; -} -__MATH_INLINE int -__NTH (__signbit (double __x)) -{ - __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; - return __u.__i[0] < 0; -} -__MATH_INLINE int -__NTH (__signbitl (long double __x)) -{ - __extension__ union { long double __d; int __i[3]; } __u = { __d: __x }; - return __u.__i[0] < 0; -} -#endif - - #if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \ || defined __LIBC_INTERNAL_MATH_INLINES #ifdef __LIBC_INTERNAL_MATH_INLINES /* This is used when defining the functions themselves. Define them with __ names, and with `static inline' instead of `extern inline' so the - bodies will always be used, never an external function call. */ + bodies will always be used, never an external function call. + Note: GCC 6 objects to __attribute__ ((__leaf__)) on static functions. */ # define __m81_u(x) __CONCAT(__,x) # define __m81_inline static __inline +# define __m81_nth(fn) __NTHNL (fn) #else # define __m81_u(x) x -# define __m81_inline __MATH_INLINE +# define __m81_inline __MATH_INLINE +# define __m81_nth(fn) __NTH (fn) # define __M81_MATH_INLINES 1 #endif -/* Define a const math function. */ -#define __m81_defun(rettype, func, args) \ - __m81_inline rettype __attribute__((__const__)) \ - __NTH (__m81_u(func) args) +/* Define a math function. */ +#define __m81_defun(rettype, func, args, attrs) \ + __m81_inline rettype attrs \ + __m81_nth (__m81_u(func) args) /* Define the three variants of a math function that has a direct implementation in the m68k fpu. FUNC is the name for C (which will be @@ -132,17 +57,17 @@ __NTH (__signbitl (long double __x)) is the name of the fpu operation (without leading f). */ #ifdef __USE_ISOC99 -# define __inline_mathop(func, op) \ - __inline_mathop1(double, func, op) \ - __inline_mathop1(float, __CONCAT(func,f), op) \ - __inline_mathop1(long double, __CONCAT(func,l), op) +# define __inline_mathop(func, op, attrs) \ + __inline_mathop1(double, func, op, attrs) \ + __inline_mathop1(float, __CONCAT(func,f), op, attrs) \ + __inline_mathop1(long double, __CONCAT(func,l), op, attrs) #else -# define __inline_mathop(func, op) \ - __inline_mathop1(double, func, op) +# define __inline_mathop(func, op, attrs) \ + __inline_mathop1(double, func, op, attrs) #endif -#define __inline_mathop1(float_type,func, op) \ - __m81_defun (float_type, func, (float_type __mathop_x)) \ +#define __inline_mathop1(float_type,func, op, attrs) \ + __m81_defun (float_type, func, (float_type __mathop_x), attrs) \ { \ float_type __result; \ __asm __volatile__ ("f" __STRING(op) "%.x %1, %0" \ @@ -150,53 +75,54 @@ __NTH (__signbitl (long double __x)) return __result; \ } -__inline_mathop(__atan, atan) -__inline_mathop(__cos, cos) -__inline_mathop(__sin, sin) -__inline_mathop(__tan, tan) -__inline_mathop(__tanh, tanh) -__inline_mathop(__fabs, abs) +__inline_mathop(__atan, atan,) +__inline_mathop(__cos, cos,) +__inline_mathop(__sin, sin,) +__inline_mathop(__tan, tan,) +__inline_mathop(__tanh, tanh,) +__inline_mathop(__fabs, abs, __attribute__ ((__const__))) #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__inline_mathop(__rint, int) -__inline_mathop(__expm1, etoxm1) -__inline_mathop(__log1p, lognp1) +__inline_mathop(__rint, int,) +__inline_mathop(__expm1, etoxm1,) +__inline_mathop(__log1p, lognp1,) #endif #ifdef __USE_MISC -__inline_mathop(__significand, getman) +__inline_mathop(__significand, getman,) #endif #ifdef __USE_ISOC99 -__inline_mathop(__trunc, intrz) +__inline_mathop(__trunc, intrz, __attribute__ ((__const__))) #endif #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ -__inline_mathop(atan, atan) -__inline_mathop(tanh, tanh) +__inline_mathop(atan, atan,) +__inline_mathop(tanh, tanh,) # if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__inline_mathop(rint, int) -__inline_mathop(log1p, lognp1) +__inline_mathop(rint, int,) +__inline_mathop(log1p, lognp1,) # endif # ifdef __USE_MISC -__inline_mathop(significand, getman) +__inline_mathop(significand, getman,) # endif # ifdef __USE_ISOC99 -__inline_mathop(trunc, intrz) +__inline_mathop(trunc, intrz, __attribute__ ((__const__))) # endif #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ /* This macro contains the definition for the rest of the inline - functions, using FLOAT_TYPE as the domain type and S as the suffix - for the function names. */ + functions, using FLOAT_TYPE as the domain type and M as a macro + that adds the suffix for the function names. */ -#define __inline_functions(float_type, s) \ -__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ +#define __inline_functions(float_type, m) \ +__m81_defun (float_type, m(__floor), (float_type __x), \ + __attribute__ ((__const__))) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -212,7 +138,8 @@ __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, m(__ceil), (float_type __x), \ + __attribute__ ((__const__))) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -228,17 +155,21 @@ __m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \ return __result; \ } -__inline_functions(double,) +#define __CONCAT_d(arg) arg +#define __CONCAT_f(arg) arg ## f +#define __CONCAT_l(arg) arg ## l +__inline_functions(double, __CONCAT_d) #ifdef __USE_ISOC99 -__inline_functions(float,f) -__inline_functions(long double,l) +__inline_functions(float, __CONCAT_f) +__inline_functions(long double, __CONCAT_l) #endif #undef __inline_functions #ifdef __USE_MISC -# define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ +# define __inline_functions(float_type, m) \ +__m81_defun (int, m(__isinf), (float_type __value), \ + __attribute__ ((__const__))) \ { \ /* There is no branch-condition for infinity, \ so we must extract and examine the condition codes manually. */ \ @@ -248,7 +179,8 @@ __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, m(__finite), (float_type __value), \ + __attribute__ ((__const__))) \ { \ /* There is no branch-condition for infinity, so we must extract and \ examine the condition codes manually. */ \ @@ -258,8 +190,8 @@ __m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \ return (__fpsr & (3 << 24)) == 0; \ } \ \ -__m81_defun (float_type, __CONCAT(__scalbn,s), \ - (float_type __x, int __n)) \ +__m81_defun (float_type, m(__scalbn), \ + (float_type __x, int __n),) \ { \ float_type __result; \ __asm __volatile__ ("fscale%.l %1, %0" : "=f" (__result) \ @@ -267,17 +199,18 @@ __m81_defun (float_type, __CONCAT(__scalbn,s), \ return __result; \ } -__inline_functions(double,) -__inline_functions(float,f) -__inline_functions(long double,l) +__inline_functions(double, __CONCAT_d) +__inline_functions(float, __CONCAT_f) +__inline_functions(long double, __CONCAT_l) # undef __inline_functions #endif /* Use misc. */ #if defined __USE_MISC || defined __USE_XOPEN -# define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ +# define __inline_functions(float_type, m) \ +__m81_defun (int, m(__isnan), (float_type __value), \ + __attribute__ ((__const__))) \ { \ char __result; \ __asm ("ftst%.x %1\n" \ @@ -285,10 +218,10 @@ __m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ return __result; \ } -__inline_functions(double,) +__inline_functions(double, __CONCAT_d) # ifdef __USE_MISC -__inline_functions(float,f) -__inline_functions(long double,l) +__inline_functions(float, __CONCAT_f) +__inline_functions(long double, __CONCAT_l) # endif # undef __inline_functions @@ -296,14 +229,14 @@ __inline_functions(long double,l) #ifdef __USE_ISOC99 -# define __inline_functions(float_type, s) \ -__m81_defun (float_type, __CONCAT(__scalbln,s), \ - (float_type __x, long int __n)) \ +# define __inline_functions(float_type, m) \ +__m81_defun (float_type, m(__scalbln), \ + (float_type __x, long int __n),) \ { \ - return __CONCAT(__scalbn,s) (__x, __n); \ + return m(__scalbn) (__x, __n); \ } \ \ -__m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \ +__m81_defun (float_type, m(__nearbyint), (float_type __x),) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -317,44 +250,46 @@ __m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \ return __result; \ } \ \ -__m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) \ +__m81_defun (long int, m(__lrint), (float_type __x),) \ { \ long int __result; \ __asm __volatile__ ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \ return __result; \ } -__inline_functions (double,) -__inline_functions (float,f) -__inline_functions (long double,l) +__inline_functions (double, __CONCAT_d) +__inline_functions (float, __CONCAT_f) +__inline_functions (long double, __CONCAT_l) # undef __inline_functions #endif /* Use ISO C9x */ #ifdef __USE_GNU -# define __inline_functions(float_type, s) \ +# define __inline_functions(float_type, m) \ __m81_inline void \ -__NTH (__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \ - float_type *__cosx)) \ +__m81_nth (__m81_u(m(__sincos)) \ + (float_type __x, float_type *__sinx, float_type *__cosx)) \ { \ __asm __volatile__ ("fsincos%.x %2,%1:%0" \ : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \ } -__inline_functions (double,) -__inline_functions (float,f) -__inline_functions (long double,l) +__inline_functions (double, __CONCAT_d) +__inline_functions (float, __CONCAT_f) +__inline_functions (long double, __CONCAT_l) # undef __inline_functions #endif +#undef __CONCAT_d +#undef __CONCAT_f +#undef __CONCAT_l + #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ /* Define inline versions of the user visible functions. */ -/* 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) \ __MATH_INLINE rettype __attribute__((__const__)) \ __NTH (name args1) \ @@ -375,7 +310,7 @@ __inline_forward_c(double,ceil, (double __x), (__x)) __inline_forward_c(int,isinf, (double __value), (__value)) # endif __inline_forward_c(int,finite, (double __value), (__value)) -__inline_forward_c(double,scalbn, (double __x, int __n), (__x, __n)) +__inline_forward(double,scalbn, (double __x, int __n), (__x, __n)) # endif # if defined __USE_MISC || defined __USE_XOPEN # ifndef __USE_ISOC99 /* Conflict with macro of same name. */ @@ -383,9 +318,9 @@ __inline_forward_c(int,isnan, (double __value), (__value)) # endif # endif # ifdef __USE_ISOC99 -__inline_forward_c(double,scalbln, (double __x, long int __n), (__x, __n)) -__inline_forward_c(double,nearbyint, (double __value), (__value)) -__inline_forward_c(long int,lrint, (double __value), (__value)) +__inline_forward(double,scalbln, (double __x, long int __n), (__x, __n)) +__inline_forward(double,nearbyint, (double __value), (__value)) +__inline_forward(long int,lrint, (double __value), (__value)) # endif # ifdef __USE_GNU __inline_forward(void,sincos, (double __x, double *__sinx, double *__cosx), @@ -399,13 +334,13 @@ __inline_forward_c(float,ceilf, (float __x), (__x)) # ifdef __USE_MISC __inline_forward_c(int,isinff, (float __value), (__value)) __inline_forward_c(int,finitef, (float __value), (__value)) -__inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n)) +__inline_forward(float,scalbnf, (float __x, int __n), (__x, __n)) __inline_forward_c(int,isnanf, (float __value), (__value)) # endif # ifdef __USE_ISOC99 -__inline_forward_c(float,scalblnf, (float __x, long int __n), (__x, __n)) -__inline_forward_c(float,nearbyintf, (float __value), (__value)) -__inline_forward_c(long int,lrintf, (float __value), (__value)) +__inline_forward(float,scalblnf, (float __x, long int __n), (__x, __n)) +__inline_forward(float,nearbyintf, (float __value), (__value)) +__inline_forward(long int,lrintf, (float __value), (__value)) # endif # ifdef __USE_GNU __inline_forward(void,sincosf, (float __x, float *__sinx, float *__cosx), @@ -417,14 +352,14 @@ __inline_forward_c(long double,ceill, (long double __x), (__x)) # ifdef __USE_MISC __inline_forward_c(int,isinfl, (long double __value), (__value)) __inline_forward_c(int,finitel, (long double __value), (__value)) -__inline_forward_c(long double,scalbnl, (long double __x, int __n), (__x, __n)) +__inline_forward(long double,scalbnl, (long double __x, int __n), (__x, __n)) __inline_forward_c(int,isnanl, (long double __value), (__value)) # endif # ifdef __USE_ISOC99 -__inline_forward_c(long double,scalblnl, (long double __x, long int __n), - (__x, __n)) -__inline_forward_c(long double,nearbyintl, (long double __value), (__value)) -__inline_forward_c(long int,lrintl, (long double __value), (__value)) +__inline_forward(long double,scalblnl, (long double __x, long int __n), + (__x, __n)) +__inline_forward(long double,nearbyintl, (long double __value), (__value)) +__inline_forward(long int,lrintl, (long double __value), (__value)) # endif # ifdef __USE_GNU __inline_forward(void,sincosl, diff --git a/sysdeps/m68k/m680x0/fpu/e_acos.c b/sysdeps/m68k/m680x0/fpu/e_acos.c index 522e20985e..67a2616be7 100644 --- a/sysdeps/m68k/m680x0/fpu/e_acos.c +++ b/sysdeps/m68k/m680x0/fpu/e_acos.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. +/* Copyright (C) 1996-2018 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 diff --git a/sysdeps/m68k/m680x0/fpu/e_atan2.c b/sysdeps/m68k/m680x0/fpu/e_atan2.c index 05c0988787..f1cd00df78 100644 --- a/sysdeps/m68k/m680x0/fpu/e_atan2.c +++ b/sysdeps/m68k/m680x0/fpu/e_atan2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 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 diff --git a/sysdeps/m68k/m680x0/fpu/halfulp.c b/sysdeps/m68k/m680x0/fpu/e_exp2f_data.c index 1cc8931700..1cc8931700 100644 --- a/sysdeps/m68k/m680x0/fpu/halfulp.c +++ b/sysdeps/m68k/m680x0/fpu/e_exp2f_data.c diff --git a/sysdeps/m68k/m680x0/fpu/e_fmod.c b/sysdeps/m68k/m680x0/fpu/e_fmod.c index e7c958bead..83dbd37e85 100644 --- a/sysdeps/m68k/m680x0/fpu/e_fmod.c +++ b/sysdeps/m68k/m680x0/fpu/e_fmod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. +/* Copyright (C) 1996-2018 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 diff --git a/sysdeps/m68k/m680x0/fpu/e_ilogb.c b/sysdeps/m68k/m680x0/fpu/e_ilogb.c index 920f244f6a..e1cb2938bf 100644 --- a/sysdeps/m68k/m680x0/fpu/e_ilogb.c +++ b/sysdeps/m68k/m680x0/fpu/e_ilogb.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. +/* Copyright (C) 1996-2018 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 diff --git a/sysdeps/m68k/m680x0/fpu/mpexp.c b/sysdeps/m68k/m680x0/fpu/e_log2f_data.c index 1cc8931700..1cc8931700 100644 --- a/sysdeps/m68k/m680x0/fpu/mpexp.c +++ b/sysdeps/m68k/m680x0/fpu/e_log2f_data.c diff --git a/sysdeps/m68k/m680x0/fpu/mplog.c b/sysdeps/m68k/m680x0/fpu/e_logf_data.c index 1cc8931700..1cc8931700 100644 --- a/sysdeps/m68k/m680x0/fpu/mplog.c +++ b/sysdeps/m68k/m680x0/fpu/e_logf_data.c diff --git a/sysdeps/m68k/m680x0/fpu/e_pow.c b/sysdeps/m68k/m680x0/fpu/e_pow.c index 34bdf464b7..a94c0e0c0d 100644 --- a/sysdeps/m68k/m680x0/fpu/e_pow.c +++ b/sysdeps/m68k/m680x0/fpu/e_pow.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 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 @@ -64,7 +64,7 @@ s(__ieee754_pow) (float_type x, float_type y) if (y == 2) return x * x; if (y == 0.5 && !(x_cond & __M81_COND_NEG)) - return m81(__ieee754_sqrt) (x); + return m81(sqrt) (x); if (x == 10.0) { @@ -106,7 +106,7 @@ s(__ieee754_pow) (float_type x, float_type y) this format and rounding won't change the result. */ { int32_t exponent; - u_int32_t i0, i1; + uint32_t i0, i1; GET_LDOUBLE_WORDS (exponent, i0, i1, y); exponent = (exponent & 0x7fff) - 0x3fff; if (exponent <= 31 diff --git a/sysdeps/m68k/m680x0/fpu/slowexp.c b/sysdeps/m68k/m680x0/fpu/e_powf_log2_data.c index 1cc8931700..1cc8931700 100644 --- a/sysdeps/m68k/m680x0/fpu/slowexp.c +++ b/sysdeps/m68k/m680x0/fpu/e_powf_log2_data.c diff --git a/sysdeps/m68k/m680x0/fpu/e_scalb.c b/sysdeps/m68k/m680x0/fpu/e_scalb.c index 498fdbe477..efa3133363 100644 --- a/sysdeps/m68k/m680x0/fpu/e_scalb.c +++ b/sysdeps/m68k/m680x0/fpu/e_scalb.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. diff --git a/sysdeps/m68k/m680x0/fpu/fraiseexcpt.c b/sysdeps/m68k/m680x0/fpu/fraiseexcpt.c index 0a55f25a76..99fee81548 100644 --- a/sysdeps/m68k/m680x0/fpu/fraiseexcpt.c +++ b/sysdeps/m68k/m680x0/fpu/fraiseexcpt.c @@ -1,5 +1,5 @@ /* Raise given exceptions. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> diff --git a/sysdeps/m68k/m680x0/fpu/k_rem_pio2l.c b/sysdeps/m68k/m680x0/fpu/k_rem_pio2l.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/m68k/m680x0/fpu/k_rem_pio2l.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps index 7667d34b84..2247a4af60 100644 --- a/sysdeps/m68k/m680x0/fpu/libm-test-ulps +++ b/sysdeps/m68k/m680x0/fpu/libm-test-ulps @@ -1451,14 +1451,6 @@ ifloat: 7 ildouble: 9 ldouble: 9 -Function: "pow_tonearest": -double: 1 -float: 7 -idouble: 1 -ifloat: 7 -ildouble: 7 -ldouble: 7 - Function: "pow_towardzero": double: 1 float: 4 diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps-name b/sysdeps/m68k/m680x0/fpu/libm-test-ulps-name new file mode 100644 index 0000000000..35c8a9e5f0 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/libm-test-ulps-name @@ -0,0 +1 @@ +M68k diff --git a/sysdeps/m68k/m680x0/fpu/math-barriers.h b/sysdeps/m68k/m680x0/fpu/math-barriers.h new file mode 100644 index 0000000000..b1b78d5f11 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/math-barriers.h @@ -0,0 +1,37 @@ +/* Control when floating-point expressions are evaluated. M68k version. + Copyright (C) 2011-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef M68K_MATH_BARRIERS_H +#define M68K_MATH_BARRIERS_H 1 + +#define math_opt_barrier(x) \ +({ __typeof (x) __x; \ + __asm ("" : "=f" (__x) : "0" (x)); \ + __x; }) +#define math_force_eval(x) \ +do \ + { \ + __typeof (x) __x = (x); \ + if (sizeof (x) <= sizeof (double)) \ + __asm __volatile ("" : : "m" (__x)); \ + else \ + __asm __volatile ("" : : "f" (__x)); \ + } \ +while (0) + +#endif diff --git a/sysdeps/m68k/m680x0/fpu/slowpow.c b/sysdeps/m68k/m680x0/fpu/math_errf.c index 1cc8931700..1cc8931700 100644 --- a/sysdeps/m68k/m680x0/fpu/slowpow.c +++ b/sysdeps/m68k/m680x0/fpu/math_errf.c diff --git a/sysdeps/m68k/m680x0/fpu/math_private.h b/sysdeps/m68k/m680x0/fpu/math_private.h deleted file mode 100644 index 2b7909535e..0000000000 --- a/sysdeps/m68k/m680x0/fpu/math_private.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef M68K_MATH_PRIVATE_H -#define M68K_MATH_PRIVATE_H 1 - -#define math_opt_barrier(x) \ -({ __typeof (x) __x; \ - __asm ("" : "=f" (__x) : "0" (x)); \ - __x; }) -#define math_force_eval(x) \ -do \ - { \ - __typeof (x) __x = (x); \ - if (sizeof (x) <= sizeof (double)) \ - __asm __volatile ("" : : "m" (__x)); \ - else \ - __asm __volatile ("" : : "f" (__x)); \ - } \ -while (0) - -#include_next <math_private.h> -#endif diff --git a/sysdeps/m68k/m680x0/fpu/mathimpl.h b/sysdeps/m68k/m680x0/fpu/mathimpl.h index cebec16200..848f9cffaa 100644 --- a/sysdeps/m68k/m680x0/fpu/mathimpl.h +++ b/sysdeps/m68k/m680x0/fpu/mathimpl.h @@ -1,6 +1,6 @@ /* Definitions of libc internal inline math functions implemented by the m68881/2. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2018 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,27 +20,27 @@ /* This file contains the definitions of the inline math functions that are only used internally inside libm, not visible to the user. */ -__inline_mathop (__ieee754_acos, acos) -__inline_mathop (__ieee754_asin, asin) -__inline_mathop (__ieee754_cosh, cosh) -__inline_mathop (__ieee754_sinh, sinh) -__inline_mathop (__ieee754_exp, etox) -__inline_mathop (__ieee754_exp2, twotox) -__inline_mathop (__ieee754_exp10, tentox) -__inline_mathop (__ieee754_log10, log10) -__inline_mathop (__ieee754_log2, log2) -__inline_mathop (__ieee754_log, logn) -__inline_mathop (__ieee754_sqrt, sqrt) -__inline_mathop (__ieee754_atanh, atanh) +__inline_mathop (__ieee754_acos, acos,) +__inline_mathop (__ieee754_asin, asin,) +__inline_mathop (__ieee754_cosh, cosh,) +__inline_mathop (__ieee754_sinh, sinh,) +__inline_mathop (__ieee754_exp, etox,) +__inline_mathop (__ieee754_exp2, twotox,) +__inline_mathop (__ieee754_exp10, tentox,) +__inline_mathop (__ieee754_log10, log10,) +__inline_mathop (__ieee754_log2, log2,) +__inline_mathop (__ieee754_log, logn,) +__inline_mathop (__ieee754_sqrt, sqrt,) +__inline_mathop (__ieee754_atanh, atanh,) -__m81_defun (double, __ieee754_remainder, (double __x, double __y)) +__m81_defun (double, __ieee754_remainder, (double __x, double __y),) { double __result; __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); return __result; } -__m81_defun (float, __ieee754_remainderf, (float __x, float __y)) +__m81_defun (float, __ieee754_remainderf, (float __x, float __y),) { float __result; __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); @@ -48,21 +48,21 @@ __m81_defun (float, __ieee754_remainderf, (float __x, float __y)) } __m81_defun (long double, - __ieee754_remainderl, (long double __x, long double __y)) + __ieee754_remainderl, (long double __x, long double __y),) { long double __result; __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); return __result; } -__m81_defun (double, __ieee754_fmod, (double __x, double __y)) +__m81_defun (double, __ieee754_fmod, (double __x, double __y),) { double __result; __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); return __result; } -__m81_defun (float, __ieee754_fmodf, (float __x, float __y)) +__m81_defun (float, __ieee754_fmodf, (float __x, float __y),) { float __result; __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); @@ -70,7 +70,7 @@ __m81_defun (float, __ieee754_fmodf, (float __x, float __y)) } __m81_defun (long double, - __ieee754_fmodl, (long double __x, long double __y)) + __ieee754_fmodl, (long double __x, long double __y),) { long double __result; __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); diff --git a/sysdeps/m68k/m680x0/fpu/s_atan.c b/sysdeps/m68k/m680x0/fpu/s_atan.c index 5160faee52..a6f90d3298 100644 --- a/sysdeps/m68k/m680x0/fpu/s_atan.c +++ b/sysdeps/m68k/m680x0/fpu/s_atan.c @@ -1,34 +1,2 @@ -/* Copyright (C) 1996-2016 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -#ifndef FUNC -#define FUNC atan -#endif -#ifndef float_type -#define float_type double -#endif - -#define __CONCATX(a,b) __CONCAT(a,b) - -float_type -__CONCATX(__,FUNC) (float_type x) -{ - return __m81_u(__CONCATX(__,FUNC))(x); -} -weak_alias (__CONCATX(__,FUNC), FUNC) +#include <math-type-macros-double.h> +#include <s_atan_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_atan_template.c b/sysdeps/m68k/m680x0/fpu/s_atan_template.c new file mode 100644 index 0000000000..8696a65105 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_atan_template.c @@ -0,0 +1,26 @@ +/* Implement atan for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__atan) (FLOAT x) +{ + return __m81_u(M_SUF (__atan)) (x); +} +declare_mgen_alias (__atan, atan) diff --git a/sysdeps/m68k/m680x0/fpu/s_atanf.c b/sysdeps/m68k/m680x0/fpu/s_atanf.c index c98559a8ba..bc24155c41 100644 --- a/sysdeps/m68k/m680x0/fpu/s_atanf.c +++ b/sysdeps/m68k/m680x0/fpu/s_atanf.c @@ -1,5 +1,2 @@ -#ifndef FUNC -#define FUNC atanf -#endif -#define float_type float -#include <s_atan.c> +#include <math-type-macros-float.h> +#include <s_atan_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_atanl.c b/sysdeps/m68k/m680x0/fpu/s_atanl.c index b7e608addd..28eea11999 100644 --- a/sysdeps/m68k/m680x0/fpu/s_atanl.c +++ b/sysdeps/m68k/m680x0/fpu/s_atanl.c @@ -1,5 +1,2 @@ -#ifndef FUNC -#define FUNC atanl -#endif -#define float_type long double -#include <s_atan.c> +#include <math-type-macros-ldouble.h> +#include <s_atan_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_ccosh.c b/sysdeps/m68k/m680x0/fpu/s_ccosh_template.c index 47a4fb0c94..23308a20c3 100644 --- a/sysdeps/m68k/m680x0/fpu/s_ccosh.c +++ b/sysdeps/m68k/m680x0/fpu/s_ccosh_template.c @@ -1,5 +1,5 @@ /* Complex cosine hyperbole function. m68k fpu version - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. @@ -21,27 +21,19 @@ #include <math.h> #include "mathimpl.h" -#ifndef SUFF -#define SUFF -#endif -#ifndef float_type -#define float_type double -#endif - -#define CONCATX(a,b) __CONCAT(a,b) -#define s(name) CONCATX(name,SUFF) +#define s(name) M_SUF (name) #define m81(func) __m81_u(s(func)) -__complex__ float_type -s(__ccosh) (__complex__ float_type x) +CFLOAT +s(__ccosh) (CFLOAT x) { - __complex__ float_type retval; + CFLOAT retval; unsigned long ix_cond = __m81_test (__imag__ x); if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) { /* Imaginary part is finite. */ - float_type sin_ix, cos_ix; + FLOAT sin_ix, cos_ix; __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) : "f" (__imag__ x)); @@ -73,4 +65,4 @@ s(__ccosh) (__complex__ float_type x) return retval; } -weak_alias (s(__ccosh), s(ccosh)) +declare_mgen_alias (__ccosh, ccosh) diff --git a/sysdeps/m68k/m680x0/fpu/s_ccoshf.c b/sysdeps/m68k/m680x0/fpu/s_ccoshf.c deleted file mode 100644 index 3c8e7c7bb7..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_ccoshf.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF f -#define float_type float -#include <s_ccosh.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_ccoshl.c b/sysdeps/m68k/m680x0/fpu/s_ccoshl.c deleted file mode 100644 index 772d5786cf..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_ccoshl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF l -#define float_type long double -#include <s_ccosh.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_ceil.c b/sysdeps/m68k/m680x0/fpu/s_ceil.c index 93d5ad72e5..70aeb739f1 100644 --- a/sysdeps/m68k/m680x0/fpu/s_ceil.c +++ b/sysdeps/m68k/m680x0/fpu/s_ceil.c @@ -1,2 +1,2 @@ -#define FUNC ceil -#include <s_atan.c> +#include <math-type-macros-double.h> +#include <s_ceil_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_ceil_template.c b/sysdeps/m68k/m680x0/fpu/s_ceil_template.c new file mode 100644 index 0000000000..a4d032d90c --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_ceil_template.c @@ -0,0 +1,26 @@ +/* Implement ceil for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__ceil) (FLOAT x) +{ + return __m81_u(M_SUF (__ceil)) (x); +} +declare_mgen_alias (__ceil, ceil) diff --git a/sysdeps/m68k/m680x0/fpu/s_ceilf.c b/sysdeps/m68k/m680x0/fpu/s_ceilf.c index b3ba6a5700..74e027e40c 100644 --- a/sysdeps/m68k/m680x0/fpu/s_ceilf.c +++ b/sysdeps/m68k/m680x0/fpu/s_ceilf.c @@ -1,2 +1,2 @@ -#define FUNC ceilf -#include <s_atanf.c> +#include <math-type-macros-float.h> +#include <s_ceil_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_ceill.c b/sysdeps/m68k/m680x0/fpu/s_ceill.c index 2bf95b00c6..5188c2471d 100644 --- a/sysdeps/m68k/m680x0/fpu/s_ceill.c +++ b/sysdeps/m68k/m680x0/fpu/s_ceill.c @@ -1,2 +1,2 @@ -#define FUNC ceill -#include <s_atanl.c> +#include <math-type-macros-ldouble.h> +#include <s_ceil_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_cexp.c b/sysdeps/m68k/m680x0/fpu/s_cexp_template.c index f715b77d2d..02de829470 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cexp.c +++ b/sysdeps/m68k/m680x0/fpu/s_cexp_template.c @@ -1,5 +1,5 @@ /* Complex exponential function. m68k fpu version - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> @@ -22,21 +22,14 @@ #include <math.h> #include "mathimpl.h" -#ifndef SUFF -#define SUFF -#endif -#ifndef float_type -#define float_type double -#endif - #define CONCATX(a,b) __CONCAT(a,b) -#define s(name) CONCATX(name,SUFF) +#define s(name) M_SUF (name) #define m81(func) __m81_u(s(func)) -__complex__ float_type -s(__cexp) (__complex__ float_type x) +CFLOAT +s(__cexp) (CFLOAT x) { - __complex__ float_type retval; + CFLOAT retval; unsigned long ix_cond; ix_cond = __m81_test (__imag__ x); @@ -133,4 +126,4 @@ s(__cexp) (__complex__ float_type x) return retval; } -weak_alias (s(__cexp), s(cexp)) +declare_mgen_alias (__cexp, cexp) diff --git a/sysdeps/m68k/m680x0/fpu/s_cexpf.c b/sysdeps/m68k/m680x0/fpu/s_cexpf.c deleted file mode 100644 index 177a360f9b..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_cexpf.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF f -#define float_type float -#include <s_cexp.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_cexpl.c b/sysdeps/m68k/m680x0/fpu/s_cexpl.c deleted file mode 100644 index bbda4ba990..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_cexpl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF l -#define float_type long double -#include <s_cexp.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_cos.c b/sysdeps/m68k/m680x0/fpu/s_cos.c index 2f1adf77f5..24e508e5c3 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cos.c +++ b/sysdeps/m68k/m680x0/fpu/s_cos.c @@ -1,2 +1,2 @@ -#define FUNC cos -#include <s_sin.c> +#include <math-type-macros-double.h> +#include <s_cos_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_cos_template.c b/sysdeps/m68k/m680x0/fpu/s_cos_template.c new file mode 100644 index 0000000000..a2574debdc --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_cos_template.c @@ -0,0 +1,30 @@ +/* Implement cos for m68k. + Copyright (C) 2012-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <errno.h> +#include "mathimpl.h" + +FLOAT +M_DECL_FUNC (__cos) (FLOAT x) +{ + if (__m81_test (x) & __M81_COND_INF) + __set_errno (EDOM); + return __m81_u(M_SUF (__cos)) (x); +} +declare_mgen_alias (__cos, cos) diff --git a/sysdeps/m68k/m680x0/fpu/s_cosf.c b/sysdeps/m68k/m680x0/fpu/s_cosf.c index b6d6accb4a..fcfc844dfe 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cosf.c +++ b/sysdeps/m68k/m680x0/fpu/s_cosf.c @@ -1,2 +1,2 @@ -#define FUNC cosf -#include <s_sinf.c> +#include <math-type-macros-float.h> +#include <s_cos_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_cosl.c b/sysdeps/m68k/m680x0/fpu/s_cosl.c index eb61521fdd..de8767cfe3 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cosl.c +++ b/sysdeps/m68k/m680x0/fpu/s_cosl.c @@ -1,2 +1,2 @@ -#define FUNC cosl -#include <s_sinl.c> +#include <math-type-macros-ldouble.h> +#include <s_cos_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_csin.c b/sysdeps/m68k/m680x0/fpu/s_csin_template.c index b8419be897..1ea0b1bb77 100644 --- a/sysdeps/m68k/m680x0/fpu/s_csin.c +++ b/sysdeps/m68k/m680x0/fpu/s_csin_template.c @@ -1,5 +1,5 @@ /* Complex sine function. m68k fpu version - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. @@ -21,27 +21,19 @@ #include <math.h> #include "mathimpl.h" -#ifndef SUFF -#define SUFF -#endif -#ifndef float_type -#define float_type double -#endif - -#define CONCATX(a,b) __CONCAT(a,b) -#define s(name) CONCATX(name,SUFF) +#define s(name) M_SUF (name) #define m81(func) __m81_u(s(func)) -__complex__ float_type -s(__csin) (__complex__ float_type x) +CFLOAT +s(__csin) (CFLOAT x) { - __complex__ float_type retval; + CFLOAT retval; unsigned long rx_cond = __m81_test (__real__ x); if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) { /* Real part is finite. */ - float_type sin_rx, cos_rx; + FLOAT sin_rx, cos_rx; __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx) : "f" (__real__ x)); @@ -64,4 +56,4 @@ s(__csin) (__complex__ float_type x) return retval; } -weak_alias (s(__csin), s(csin)) +declare_mgen_alias (__csin, csin) diff --git a/sysdeps/m68k/m680x0/fpu/s_csinf.c b/sysdeps/m68k/m680x0/fpu/s_csinf.c deleted file mode 100644 index b760e192c3..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_csinf.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF f -#define float_type float -#include <s_csin.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_csinh.c b/sysdeps/m68k/m680x0/fpu/s_csinh_template.c index c633cd8875..26c41a290d 100644 --- a/sysdeps/m68k/m680x0/fpu/s_csinh.c +++ b/sysdeps/m68k/m680x0/fpu/s_csinh_template.c @@ -1,5 +1,5 @@ /* Complex sine hyperbole function. m68k fpu version - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. @@ -21,21 +21,14 @@ #include <math.h> #include "mathimpl.h" -#ifndef SUFF -#define SUFF -#endif -#ifndef float_type -#define float_type double -#endif - #define CONCATX(a,b) __CONCAT(a,b) -#define s(name) CONCATX(name,SUFF) +#define s(name) M_SUF (name) #define m81(func) __m81_u(s(func)) -__complex__ float_type -s(__csinh) (__complex__ float_type x) +CFLOAT +s(__csinh) (CFLOAT x) { - __complex__ float_type retval; + CFLOAT retval; unsigned long ix_cond; ix_cond = __m81_test (__imag__ x); @@ -43,7 +36,7 @@ s(__csinh) (__complex__ float_type x) if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) { /* Imaginary part is finite. */ - float_type sin_ix, cos_ix; + FLOAT sin_ix, cos_ix; __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) : "f" (__imag__ x)); @@ -66,4 +59,4 @@ s(__csinh) (__complex__ float_type x) return retval; } -weak_alias (s(__csinh), s(csinh)) +declare_mgen_alias (__csinh, csinh) diff --git a/sysdeps/m68k/m680x0/fpu/s_csinhf.c b/sysdeps/m68k/m680x0/fpu/s_csinhf.c deleted file mode 100644 index 2f7a43e6a8..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_csinhf.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF f -#define float_type float -#include <s_csinh.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_csinhl.c b/sysdeps/m68k/m680x0/fpu/s_csinhl.c deleted file mode 100644 index 026a20e7be..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_csinhl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF l -#define float_type long double -#include <s_csinh.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_csinl.c b/sysdeps/m68k/m680x0/fpu/s_csinl.c deleted file mode 100644 index ea2dad0556..0000000000 --- a/sysdeps/m68k/m680x0/fpu/s_csinl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF l -#define float_type long double -#include <s_csin.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_expm1.c b/sysdeps/m68k/m680x0/fpu/s_expm1.c index baa044ce99..3f9b4660a3 100644 --- a/sysdeps/m68k/m680x0/fpu/s_expm1.c +++ b/sysdeps/m68k/m680x0/fpu/s_expm1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2012-2016 Free Software Foundation, Inc. +/* Copyright (C) 2012-2018 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 @@ -15,27 +15,6 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ -#include <math.h> -#include <errno.h> -#include "mathimpl.h" - -#ifndef FUNC -# define FUNC expm1 -#endif -#ifndef float_type -# define float_type double -#endif -#ifndef o_threshold -# define o_threshold 7.09782712893383973096e+02 -#endif - -#define CONCATX(a,b) __CONCAT(a,b) - -float_type -CONCATX(__,FUNC) (float_type x) -{ - if ((__m81_test (x) & __M81_COND_INF) == 0 && isgreater (x, o_threshold)) - __set_errno (ERANGE); - return __m81_u(CONCATX(__, FUNC)) (x); -} -weak_alias (CONCATX(__, FUNC), FUNC) +#include <math-type-macros-double.h> +#define o_threshold 7.09782712893383973096e+02 +#include <s_expm1_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_expm1_template.c b/sysdeps/m68k/m680x0/fpu/s_expm1_template.c new file mode 100644 index 0000000000..f055f7781a --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_expm1_template.c @@ -0,0 +1,30 @@ +/* Implement expm1 for m68k. + Copyright (C) 2012-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <errno.h> +#include "mathimpl.h" + +FLOAT +M_DECL_FUNC (__expm1) (FLOAT x) +{ + if ((__m81_test (x) & __M81_COND_INF) == 0 && isgreater (x, o_threshold)) + __set_errno (ERANGE); + return __m81_u(M_SUF (__expm1)) (x); +} +declare_mgen_alias (__expm1, expm1) diff --git a/sysdeps/m68k/m680x0/fpu/s_expm1f.c b/sysdeps/m68k/m680x0/fpu/s_expm1f.c index 2cd8ffcfeb..a36080030e 100644 --- a/sysdeps/m68k/m680x0/fpu/s_expm1f.c +++ b/sysdeps/m68k/m680x0/fpu/s_expm1f.c @@ -1,4 +1,3 @@ -#define FUNC expm1f -#define float_type float +#include <math-type-macros-float.h> #define o_threshold 8.8722831726e+01F -#include <s_expm1.c> +#include <s_expm1_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_expm1l.c b/sysdeps/m68k/m680x0/fpu/s_expm1l.c index a2c80860ba..cfbab2843b 100644 --- a/sysdeps/m68k/m680x0/fpu/s_expm1l.c +++ b/sysdeps/m68k/m680x0/fpu/s_expm1l.c @@ -1,6 +1,5 @@ -#define FUNC expm1l -#define float_type long double +#include <math-type-macros-ldouble.h> /* 400c0000b17217f7d1cf79ab */ #define o_threshold 1.13565234062941439487914863093465101e+04L -#include <s_expm1.c> +#include <s_expm1_template.c> libm_hidden_def (__expm1l) diff --git a/sysdeps/m68k/m680x0/fpu/s_fabs.c b/sysdeps/m68k/m680x0/fpu/s_fabs.c index 1f0631e2ff..179a94add2 100644 --- a/sysdeps/m68k/m680x0/fpu/s_fabs.c +++ b/sysdeps/m68k/m680x0/fpu/s_fabs.c @@ -1,2 +1,2 @@ -#define FUNC fabs -#include <s_atan.c> +#include <math-type-macros-double.h> +#include <s_fabs_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_fabs_template.c b/sysdeps/m68k/m680x0/fpu/s_fabs_template.c new file mode 100644 index 0000000000..8af749a3f3 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_fabs_template.c @@ -0,0 +1,26 @@ +/* Implement fabs for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__fabs) (FLOAT x) +{ + return __m81_u(M_SUF (__fabs)) (x); +} +declare_mgen_alias (__fabs, fabs) diff --git a/sysdeps/m68k/m680x0/fpu/s_fabsf.c b/sysdeps/m68k/m680x0/fpu/s_fabsf.c index 8f9421998a..9072d2a76a 100644 --- a/sysdeps/m68k/m680x0/fpu/s_fabsf.c +++ b/sysdeps/m68k/m680x0/fpu/s_fabsf.c @@ -1,2 +1,2 @@ -#define FUNC fabsf -#include <s_atanf.c> +#include <math-type-macros-float.h> +#include <s_fabs_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_fabsl.c b/sysdeps/m68k/m680x0/fpu/s_fabsl.c index 8ac14d5b8c..fa48f8ae4e 100644 --- a/sysdeps/m68k/m680x0/fpu/s_fabsl.c +++ b/sysdeps/m68k/m680x0/fpu/s_fabsl.c @@ -1,2 +1,2 @@ -#define FUNC fabsl -#include <s_atanl.c> +#include <math-type-macros-ldouble.h> +#include <s_fabs_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_floor.c b/sysdeps/m68k/m680x0/fpu/s_floor.c index e1219c602a..339ae2cce4 100644 --- a/sysdeps/m68k/m680x0/fpu/s_floor.c +++ b/sysdeps/m68k/m680x0/fpu/s_floor.c @@ -1,2 +1,2 @@ -#define FUNC floor -#include <s_atan.c> +#include <math-type-macros-double.h> +#include <s_floor_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_floor_template.c b/sysdeps/m68k/m680x0/fpu/s_floor_template.c new file mode 100644 index 0000000000..7779813d84 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_floor_template.c @@ -0,0 +1,26 @@ +/* Implement floor for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__floor) (FLOAT x) +{ + return __m81_u(M_SUF (__floor)) (x); +} +declare_mgen_alias (__floor, floor) diff --git a/sysdeps/m68k/m680x0/fpu/s_floorf.c b/sysdeps/m68k/m680x0/fpu/s_floorf.c index f4f9b9a1d8..5d998e0217 100644 --- a/sysdeps/m68k/m680x0/fpu/s_floorf.c +++ b/sysdeps/m68k/m680x0/fpu/s_floorf.c @@ -1,2 +1,2 @@ -#define FUNC floorf -#include <s_atanf.c> +#include <math-type-macros-float.h> +#include <s_floor_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_floorl.c b/sysdeps/m68k/m680x0/fpu/s_floorl.c index 2c1ffd7d2c..2295f99845 100644 --- a/sysdeps/m68k/m680x0/fpu/s_floorl.c +++ b/sysdeps/m68k/m680x0/fpu/s_floorl.c @@ -1,2 +1,2 @@ -#define FUNC floorl -#include <s_atanl.c> +#include <math-type-macros-ldouble.h> +#include <s_floor_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_fpclassifyl.c b/sysdeps/m68k/m680x0/fpu/s_fpclassifyl.c index efe2116f22..657fe0c476 100644 --- a/sysdeps/m68k/m680x0/fpu/s_fpclassifyl.c +++ b/sysdeps/m68k/m680x0/fpu/s_fpclassifyl.c @@ -1,5 +1,5 @@ /* Return classification value corresponding to argument. m68k version. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. Fixed for m68k by Andreas Schwab <schwab@suse.de>. @@ -26,7 +26,7 @@ int __fpclassifyl (long double x) { - u_int32_t ex, hx, lx; + uint32_t ex, hx, lx; int retval = FP_NORMAL; GET_LDOUBLE_WORDS (ex, hx, lx, x); diff --git a/sysdeps/m68k/m680x0/fpu/s_frexp.c b/sysdeps/m68k/m680x0/fpu/s_frexp.c index 34e6ad1efa..be8db3875a 100644 --- a/sysdeps/m68k/m680x0/fpu/s_frexp.c +++ b/sysdeps/m68k/m680x0/fpu/s_frexp.c @@ -1,53 +1,2 @@ -/* Copyright (C) 1996-2016 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -#ifndef FUNC -#define FUNC frexp -#endif -#ifndef float_type -#define float_type double -#endif - -#define __CONCATX(a,b) __CONCAT(a,b) - -float_type -__CONCATX(__,FUNC) (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; -} -weak_alias (__CONCATX(__,FUNC), FUNC) +#include <math-type-macros-double.h> +#include <s_frexp_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_frexp_template.c b/sysdeps/m68k/m680x0/fpu/s_frexp_template.c new file mode 100644 index 0000000000..5036433766 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_frexp_template.c @@ -0,0 +1,45 @@ +/* Implement frexp for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__frexp) (FLOAT value, int *expptr) +{ + FLOAT 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; +} +declare_mgen_alias (__frexp, frexp) diff --git a/sysdeps/m68k/m680x0/fpu/s_frexpf.c b/sysdeps/m68k/m680x0/fpu/s_frexpf.c index 893b6ad3cf..6cf7ceb294 100644 --- a/sysdeps/m68k/m680x0/fpu/s_frexpf.c +++ b/sysdeps/m68k/m680x0/fpu/s_frexpf.c @@ -1,3 +1,2 @@ -#define FUNC frexpf -#define float_type float -#include <s_frexp.c> +#include <math-type-macros-float.h> +#include <s_frexp_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_frexpl.c b/sysdeps/m68k/m680x0/fpu/s_frexpl.c index e8b5edf6b4..44e67bf8d7 100644 --- a/sysdeps/m68k/m680x0/fpu/s_frexpl.c +++ b/sysdeps/m68k/m680x0/fpu/s_frexpl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2016 Free Software Foundation, Inc. +/* Copyright (C) 2003-2018 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 diff --git a/sysdeps/m68k/m680x0/fpu/s_isinf.c b/sysdeps/m68k/m680x0/fpu/s_isinf.c index aa15e2ca90..339db1f9f4 100644 --- a/sysdeps/m68k/m680x0/fpu/s_isinf.c +++ b/sysdeps/m68k/m680x0/fpu/s_isinf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. +/* Copyright (C) 1996-2018 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 diff --git a/sysdeps/m68k/m680x0/fpu/s_llrint.c b/sysdeps/m68k/m680x0/fpu/s_llrint.c index d3f4154f42..6ca1875869 100644 --- a/sysdeps/m68k/m680x0/fpu/s_llrint.c +++ b/sysdeps/m68k/m680x0/fpu/s_llrint.c @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> @@ -20,13 +20,14 @@ #include <math.h> #include <math_private.h> +#include <libm-alias-double.h> #include "mathimpl.h" long long int __llrint (double x) { int32_t e; - u_int32_t h, l, s; + uint32_t h, l, s; long long int result; x = __m81_u(__rint) (x); @@ -72,4 +73,4 @@ __llrint (double x) return result; } -weak_alias (__llrint, llrint) +libm_alias_double (__llrint, llrint) diff --git a/sysdeps/m68k/m680x0/fpu/s_llrintf.c b/sysdeps/m68k/m680x0/fpu/s_llrintf.c index 8c8ad56023..f972cf99f1 100644 --- a/sysdeps/m68k/m680x0/fpu/s_llrintf.c +++ b/sysdeps/m68k/m680x0/fpu/s_llrintf.c @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> @@ -20,13 +20,14 @@ #include <math.h> #include <math_private.h> +#include <libm-alias-float.h> #include "mathimpl.h" long long int __llrintf (float x) { int32_t e; - u_int32_t i, s; + uint32_t i, s; long long int result; x = __m81_u(__rintf) (x); @@ -62,4 +63,4 @@ __llrintf (float x) return result; } -weak_alias (__llrintf, llrintf) +libm_alias_float (__llrint, llrint) diff --git a/sysdeps/m68k/m680x0/fpu/s_llrintl.c b/sysdeps/m68k/m680x0/fpu/s_llrintl.c index d239fc0a99..9caa46f98a 100644 --- a/sysdeps/m68k/m680x0/fpu/s_llrintl.c +++ b/sysdeps/m68k/m680x0/fpu/s_llrintl.c @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> @@ -20,13 +20,14 @@ #include <math.h> #include <math_private.h> +#include <libm-alias-ldouble.h> #include "mathimpl.h" long long int __llrintl (long double x) { int32_t e, s; - u_int32_t h, l; + uint32_t h, l; long long int result; x = __m81_u(__rintl) (x); @@ -61,4 +62,4 @@ __llrintl (long double x) return result; } -weak_alias (__llrintl, llrintl) +libm_alias_ldouble (__llrint, llrint) diff --git a/sysdeps/m68k/m680x0/fpu/s_log1p.c b/sysdeps/m68k/m680x0/fpu/s_log1p.c index 082618df18..5da96c5834 100644 --- a/sysdeps/m68k/m680x0/fpu/s_log1p.c +++ b/sysdeps/m68k/m680x0/fpu/s_log1p.c @@ -1,4 +1,34 @@ -#define FUNC log1p -#undef weak_alias -#define weak_alias(a,b) -#include <s_atan.c> +/* Implement logp1 for m68k. + Copyright (C) 2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +#ifndef FUNC +#define FUNC log1p +#endif +#ifndef float_type +#define float_type double +#endif + +#define __CONCATX(a,b) __CONCAT(a,b) + +float_type +__CONCATX(__,FUNC) (float_type x) +{ + return __m81_u(__CONCATX(__,FUNC))(x); +} diff --git a/sysdeps/m68k/m680x0/fpu/s_log1pf.c b/sysdeps/m68k/m680x0/fpu/s_log1pf.c index 480c39519f..1e408ffffe 100644 --- a/sysdeps/m68k/m680x0/fpu/s_log1pf.c +++ b/sysdeps/m68k/m680x0/fpu/s_log1pf.c @@ -1,4 +1,3 @@ #define FUNC log1pf -#undef weak_alias -#define weak_alias(a,b) -#include <s_atanf.c> +#define float_type float +#include <s_log1p.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_log1pl.c b/sysdeps/m68k/m680x0/fpu/s_log1pl.c index a4f34a4f86..ffe1d8893f 100644 --- a/sysdeps/m68k/m680x0/fpu/s_log1pl.c +++ b/sysdeps/m68k/m680x0/fpu/s_log1pl.c @@ -1,4 +1,3 @@ #define FUNC log1pl -#undef weak_alias -#define weak_alias(a,b) -#include <s_atanl.c> +#define float_type long double +#include <s_log1p.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_lrint.c b/sysdeps/m68k/m680x0/fpu/s_lrint.c index 1096931eed..31440cfdbc 100644 --- a/sysdeps/m68k/m680x0/fpu/s_lrint.c +++ b/sysdeps/m68k/m680x0/fpu/s_lrint.c @@ -1,37 +1,2 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -#ifndef suffix -#define suffix /*empty*/ -#endif -#ifndef float_type -#define float_type double -#endif - -#define CONCATX(a,b) __CONCAT(a,b) - -long int -CONCATX(__lrint,suffix) (float_type x) -{ - return __m81_u(CONCATX(__lrint,suffix)) (x); -} -weak_alias (CONCATX(__lrint,suffix), CONCATX(lrint,suffix)) +#include <math-type-macros-double.h> +#include <s_lrint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_lrint_template.c b/sysdeps/m68k/m680x0/fpu/s_lrint_template.c new file mode 100644 index 0000000000..6a531789d2 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_lrint_template.c @@ -0,0 +1,28 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +long int +M_DECL_FUNC (__lrint) (FLOAT x) +{ + return __m81_u(M_SUF (__lrint)) (x); +} +declare_mgen_alias (__lrint, lrint) diff --git a/sysdeps/m68k/m680x0/fpu/s_lrintf.c b/sysdeps/m68k/m680x0/fpu/s_lrintf.c index 44924cb82f..77e753baa7 100644 --- a/sysdeps/m68k/m680x0/fpu/s_lrintf.c +++ b/sysdeps/m68k/m680x0/fpu/s_lrintf.c @@ -1,3 +1,2 @@ -#define suffix f -#define float_type float -#include <s_lrint.c> +#include <math-type-macros-float.h> +#include <s_lrint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_lrintl.c b/sysdeps/m68k/m680x0/fpu/s_lrintl.c index cd0bd23b8a..a4670b83c6 100644 --- a/sysdeps/m68k/m680x0/fpu/s_lrintl.c +++ b/sysdeps/m68k/m680x0/fpu/s_lrintl.c @@ -1,3 +1,2 @@ -#define suffix l -#define float_type long double -#include <s_lrint.c> +#include <math-type-macros-ldouble.h> +#include <s_lrint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_modf.c b/sysdeps/m68k/m680x0/fpu/s_modf.c index 11970950c2..1d1c0ea7f2 100644 --- a/sysdeps/m68k/m680x0/fpu/s_modf.c +++ b/sysdeps/m68k/m680x0/fpu/s_modf.c @@ -1,53 +1,2 @@ -/* Copyright (C) 1996-2016 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include "mathimpl.h" - -#ifndef SUFF -#define SUFF -#endif -#ifndef float_type -#define float_type double -#endif - -#define CONCATX(a,b) __CONCAT(a,b) -#define s(name) CONCATX(name,SUFF) -#define m81(func) __m81_u(s(func)) - -float_type -s(__modf) (float_type x, float_type *iptr) -{ - float_type x_int, result; - unsigned long x_cond; - - __asm ("fintrz%.x %1, %0" : "=f" (x_int) : "f" (x)); - *iptr = x_int; - x_cond = __m81_test (x); - if (x_cond & __M81_COND_INF) - { - result = 0; - if (x_cond & __M81_COND_NEG) - result = -result; - } - else if (x_cond & __M81_COND_ZERO) - result = x; - else - result = x - x_int; - return result; -} -weak_alias (s(__modf), s(modf)) +#include <math-type-macros-double.h> +#include <s_modf_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_modf_template.c b/sysdeps/m68k/m680x0/fpu/s_modf_template.c new file mode 100644 index 0000000000..a6f51bd6d7 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_modf_template.c @@ -0,0 +1,43 @@ +/* Implement modf for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include "mathimpl.h" + +FLOAT +M_DECL_FUNC (__modf) (FLOAT x, FLOAT *iptr) +{ + FLOAT x_int, result; + unsigned long x_cond; + + __asm ("fintrz%.x %1, %0" : "=f" (x_int) : "f" (x)); + *iptr = x_int; + x_cond = __m81_test (x); + if (x_cond & __M81_COND_INF) + { + result = 0; + if (x_cond & __M81_COND_NEG) + result = -result; + } + else if (x_cond & __M81_COND_ZERO) + result = x; + else + result = x - x_int; + return result; +} +declare_mgen_alias (__modf, modf) diff --git a/sysdeps/m68k/m680x0/fpu/s_modff.c b/sysdeps/m68k/m680x0/fpu/s_modff.c index 0c44d7c0ab..3d28880398 100644 --- a/sysdeps/m68k/m680x0/fpu/s_modff.c +++ b/sysdeps/m68k/m680x0/fpu/s_modff.c @@ -1,3 +1,2 @@ -#define SUFF f -#define float_type float -#include <s_modf.c> +#include <math-type-macros-float.h> +#include <s_modf_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_modfl.c b/sysdeps/m68k/m680x0/fpu/s_modfl.c index c7075b3ba9..9057645249 100644 --- a/sysdeps/m68k/m680x0/fpu/s_modfl.c +++ b/sysdeps/m68k/m680x0/fpu/s_modfl.c @@ -1,3 +1,2 @@ -#define SUFF l -#define float_type long double -#include <s_modf.c> +#include <math-type-macros-ldouble.h> +#include <s_modf_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_nearbyint.c b/sysdeps/m68k/m680x0/fpu/s_nearbyint.c index b87f5e2160..6af0d9b1a9 100644 --- a/sysdeps/m68k/m680x0/fpu/s_nearbyint.c +++ b/sysdeps/m68k/m680x0/fpu/s_nearbyint.c @@ -1,2 +1,2 @@ -#define FUNC nearbyint -#include <s_atan.c> +#include <math-type-macros-double.h> +#include <s_nearbyint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_nearbyint_template.c b/sysdeps/m68k/m680x0/fpu/s_nearbyint_template.c new file mode 100644 index 0000000000..971511321b --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_nearbyint_template.c @@ -0,0 +1,26 @@ +/* Implement nearbyint for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__nearbyint) (FLOAT x) +{ + return __m81_u(M_SUF (__nearbyint)) (x); +} +declare_mgen_alias (__nearbyint, nearbyint) diff --git a/sysdeps/m68k/m680x0/fpu/s_nearbyintf.c b/sysdeps/m68k/m680x0/fpu/s_nearbyintf.c index 70d08ab44c..aefd7fc7c5 100644 --- a/sysdeps/m68k/m680x0/fpu/s_nearbyintf.c +++ b/sysdeps/m68k/m680x0/fpu/s_nearbyintf.c @@ -1,2 +1,2 @@ -#define FUNC nearbyintf -#include <s_atanf.c> +#include <math-type-macros-float.h> +#include <s_nearbyint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_nearbyintl.c b/sysdeps/m68k/m680x0/fpu/s_nearbyintl.c index 230cd7784c..8516caf947 100644 --- a/sysdeps/m68k/m680x0/fpu/s_nearbyintl.c +++ b/sysdeps/m68k/m680x0/fpu/s_nearbyintl.c @@ -1,2 +1,2 @@ -#define FUNC nearbyintl -#include <s_atanl.c> +#include <math-type-macros-ldouble.h> +#include <s_nearbyint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_nextafterl.c b/sysdeps/m68k/m680x0/fpu/s_nextafterl.c index c46c0e76ec..76e900055f 100644 --- a/sysdeps/m68k/m680x0/fpu/s_nextafterl.c +++ b/sysdeps/m68k/m680x0/fpu/s_nextafterl.c @@ -28,12 +28,13 @@ static char rcsid[] = "$NetBSD: $"; #include <errno.h> #include <math.h> +#include <math-barriers.h> #include <math_private.h> long double __nextafterl(long double x, long double y) { int32_t ix,iy,esx,esy; - u_int32_t hx,hy,lx,ly; + uint32_t hx,hy,lx,ly; GET_LDOUBLE_WORDS(esx,hx,lx,x); GET_LDOUBLE_WORDS(esy,hy,ly,y); diff --git a/sysdeps/m68k/m680x0/fpu/s_remquo.c b/sysdeps/m68k/m680x0/fpu/s_remquo.c index ef9c4e4c27..b1d8f3a972 100644 --- a/sysdeps/m68k/m680x0/fpu/s_remquo.c +++ b/sysdeps/m68k/m680x0/fpu/s_remquo.c @@ -1,46 +1,2 @@ -/* Compute remainder and a congruent to the quotient. m68k fpu version - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -#ifndef SUFF -#define SUFF -#endif -#ifndef float_type -#define float_type double -#endif - -#define CONCATX(a,b) __CONCAT(a,b) -#define s(name) CONCATX(name,SUFF) - -float_type -s(__remquo) (float_type x, float_type y, int *quo) -{ - float_type result; - int cquo, fpsr; - - __asm ("frem%.x %2,%0\n\tfmove%.l %/fpsr,%1" - : "=f" (result), "=dm" (fpsr) : "f" (y), "0" (x)); - cquo = (fpsr >> 16) & 0x7f; - if (fpsr & (1 << 23)) - cquo = -cquo; - *quo = cquo; - return result; -} -weak_alias (s(__remquo), s(remquo)) +#include <math-type-macros-double.h> +#include <s_remquo_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_remquo_template.c b/sysdeps/m68k/m680x0/fpu/s_remquo_template.c new file mode 100644 index 0000000000..e7c7be6271 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_remquo_template.c @@ -0,0 +1,36 @@ +/* Compute remainder and a congruent to the quotient. m68k fpu version + Copyright (C) 1997-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__remquo) (FLOAT x, FLOAT y, int *quo) +{ + FLOAT result; + int cquo, fpsr; + + __asm ("frem%.x %2,%0\n\tfmove%.l %/fpsr,%1" + : "=f" (result), "=dm" (fpsr) : "f" (y), "0" (x)); + cquo = (fpsr >> 16) & 0x7f; + if (fpsr & (1 << 23)) + cquo = -cquo; + *quo = cquo; + return result; +} +declare_mgen_alias (__remquo, remquo) diff --git a/sysdeps/m68k/m680x0/fpu/s_remquof.c b/sysdeps/m68k/m680x0/fpu/s_remquof.c index 8a292fc26c..f2b86628d2 100644 --- a/sysdeps/m68k/m680x0/fpu/s_remquof.c +++ b/sysdeps/m68k/m680x0/fpu/s_remquof.c @@ -1,3 +1,2 @@ -#define SUFF f -#define float_type float -#include <s_remquo.c> +#include <math-type-macros-float.h> +#include <s_remquo_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_remquol.c b/sysdeps/m68k/m680x0/fpu/s_remquol.c index d236cfd1f9..cb18d9e520 100644 --- a/sysdeps/m68k/m680x0/fpu/s_remquol.c +++ b/sysdeps/m68k/m680x0/fpu/s_remquol.c @@ -1,3 +1,2 @@ -#define SUFF l -#define float_type long double -#include <s_remquo.c> +#include <math-type-macros-ldouble.h> +#include <s_remquo_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_rint.c b/sysdeps/m68k/m680x0/fpu/s_rint.c index f0f18c7346..fa092c07eb 100644 --- a/sysdeps/m68k/m680x0/fpu/s_rint.c +++ b/sysdeps/m68k/m680x0/fpu/s_rint.c @@ -1,2 +1,2 @@ -#define FUNC rint -#include <s_atan.c> +#include <math-type-macros-double.h> +#include <s_rint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_rint_template.c b/sysdeps/m68k/m680x0/fpu/s_rint_template.c new file mode 100644 index 0000000000..4f4ef12aab --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_rint_template.c @@ -0,0 +1,26 @@ +/* Implement rint for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__rint) (FLOAT x) +{ + return __m81_u(M_SUF (__rint)) (x); +} +declare_mgen_alias (__rint, rint) diff --git a/sysdeps/m68k/m680x0/fpu/s_rintf.c b/sysdeps/m68k/m680x0/fpu/s_rintf.c index 4e00cab0fb..5cda19c690 100644 --- a/sysdeps/m68k/m680x0/fpu/s_rintf.c +++ b/sysdeps/m68k/m680x0/fpu/s_rintf.c @@ -1,2 +1,2 @@ -#define FUNC rintf -#include <s_atanf.c> +#include <math-type-macros-float.h> +#include <s_rint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_rintl.c b/sysdeps/m68k/m680x0/fpu/s_rintl.c index 305667b3a1..df393ee895 100644 --- a/sysdeps/m68k/m680x0/fpu/s_rintl.c +++ b/sysdeps/m68k/m680x0/fpu/s_rintl.c @@ -1,2 +1,2 @@ -#define FUNC rintl -#include <s_atanl.c> +#include <math-type-macros-ldouble.h> +#include <s_rint_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_scalbn.c b/sysdeps/m68k/m680x0/fpu/s_scalbn.c index 886a13dcaf..eed3a351fe 100644 --- a/sysdeps/m68k/m680x0/fpu/s_scalbn.c +++ b/sysdeps/m68k/m680x0/fpu/s_scalbn.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. +/* Copyright (C) 1996-2018 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 diff --git a/sysdeps/m68k/m680x0/fpu/s_significand.c b/sysdeps/m68k/m680x0/fpu/s_significand.c index 34d4ea3d14..3259d4ee6a 100644 --- a/sysdeps/m68k/m680x0/fpu/s_significand.c +++ b/sysdeps/m68k/m680x0/fpu/s_significand.c @@ -1,2 +1,21 @@ -#define FUNC significand -#include <s_atan.c> +/* Implement significand for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#define FUNC significand +#include <s_log1p.c> +weak_alias (__significand, significand) diff --git a/sysdeps/m68k/m680x0/fpu/s_significandf.c b/sysdeps/m68k/m680x0/fpu/s_significandf.c index 4e769ca317..95da7cf969 100644 --- a/sysdeps/m68k/m680x0/fpu/s_significandf.c +++ b/sysdeps/m68k/m680x0/fpu/s_significandf.c @@ -1,2 +1,4 @@ -#define FUNC significandf -#include <s_atanf.c> +#define FUNC significandf +#define float_type float +#include <s_log1p.c> +weak_alias (__significandf, significandf) diff --git a/sysdeps/m68k/m680x0/fpu/s_significandl.c b/sysdeps/m68k/m680x0/fpu/s_significandl.c index 8c6fc7e610..356b48d138 100644 --- a/sysdeps/m68k/m680x0/fpu/s_significandl.c +++ b/sysdeps/m68k/m680x0/fpu/s_significandl.c @@ -1,2 +1,4 @@ #define FUNC significandl -#include <s_atanl.c> +#define float_type long double +#include <s_log1p.c> +weak_alias (__significandl, significandl) diff --git a/sysdeps/m68k/m680x0/fpu/s_sin.c b/sysdeps/m68k/m680x0/fpu/s_sin.c index 9b54adb849..b52e804ab9 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sin.c +++ b/sysdeps/m68k/m680x0/fpu/s_sin.c @@ -1,38 +1,2 @@ -/* Copyright (C) 2012-2016 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <errno.h> -#include "mathimpl.h" - -#ifndef FUNC -# define FUNC sin -#endif -#ifndef float_type -# define float_type double -#endif - -#define CONCATX(a,b) __CONCAT(a,b) - -float_type -CONCATX(__,FUNC) (float_type x) -{ - if (__m81_test (x) & __M81_COND_INF) - __set_errno (EDOM); - return __m81_u(CONCATX(__, FUNC)) (x); -} -weak_alias (CONCATX(__, FUNC), FUNC) +#include <math-type-macros-double.h> +#include <s_sin_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_sin_template.c b/sysdeps/m68k/m680x0/fpu/s_sin_template.c new file mode 100644 index 0000000000..6872889710 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_sin_template.c @@ -0,0 +1,30 @@ +/* Implement sin for m68k. + Copyright (C) 2012-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <errno.h> +#include "mathimpl.h" + +FLOAT +M_DECL_FUNC (__sin) (FLOAT x) +{ + if (__m81_test (x) & __M81_COND_INF) + __set_errno (EDOM); + return __m81_u(M_SUF (__sin)) (x); +} +declare_mgen_alias (__sin, sin) diff --git a/sysdeps/m68k/m680x0/fpu/s_sincos.c b/sysdeps/m68k/m680x0/fpu/s_sincos.c index f681b16bf7..9226798fd7 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sincos.c +++ b/sysdeps/m68k/m680x0/fpu/s_sincos.c @@ -1,34 +1,2 @@ -/* Copyright (C) 1997-2016 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -#ifndef FUNC -#define FUNC sincos -#endif -#ifndef float_type -#define float_type double -#endif - -#define CONCATX(a,b) __CONCAT(a,b) - -void -CONCATX(__,FUNC) (float_type x, float_type *sinx, float_type *cosx) -{ - __m81_u(CONCATX(__,FUNC))(x, sinx, cosx); -} -weak_alias (CONCATX(__,FUNC), FUNC) +#include <math-type-macros-double.h> +#include <s_sincos_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_sincos_template.c b/sysdeps/m68k/m680x0/fpu/s_sincos_template.c new file mode 100644 index 0000000000..5d2af7e4ba --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_sincos_template.c @@ -0,0 +1,26 @@ +/* Implement sincos for m68k. + Copyright (C) 1997-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +void +M_DECL_FUNC (__sincos) (FLOAT x, FLOAT *sinx, FLOAT *cosx) +{ + __m81_u(M_SUF (__sincos)) (x, sinx, cosx); +} +declare_mgen_alias (__sincos, sincos) diff --git a/sysdeps/m68k/m680x0/fpu/s_sincosf.c b/sysdeps/m68k/m680x0/fpu/s_sincosf.c index 7ee2ec6600..581388bdc6 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sincosf.c +++ b/sysdeps/m68k/m680x0/fpu/s_sincosf.c @@ -1,3 +1,2 @@ -#define FUNC sincosf -#define float_type float -#include <s_sincos.c> +#include <math-type-macros-float.h> +#include <s_sincos_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_sincosl.c b/sysdeps/m68k/m680x0/fpu/s_sincosl.c index f998cc0977..6a88d3e88a 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sincosl.c +++ b/sysdeps/m68k/m680x0/fpu/s_sincosl.c @@ -1,3 +1,2 @@ -#define FUNC sincosl -#define float_type long double -#include <s_sincos.c> +#include <math-type-macros-ldouble.h> +#include <s_sincos_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_sinf.c b/sysdeps/m68k/m680x0/fpu/s_sinf.c index 304f4f76f6..7868705d27 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sinf.c +++ b/sysdeps/m68k/m680x0/fpu/s_sinf.c @@ -1,5 +1,2 @@ -#ifndef FUNC -# define FUNC sinf -#endif -#define float_type float -#include <s_sin.c> +#include <math-type-macros-float.h> +#include <s_sin_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_sinl.c b/sysdeps/m68k/m680x0/fpu/s_sinl.c index 31dac0bee7..f542d1b096 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sinl.c +++ b/sysdeps/m68k/m680x0/fpu/s_sinl.c @@ -1,5 +1,2 @@ -#ifndef FUNC -# define FUNC sinl -#endif -#define float_type long double -#include <s_sin.c> +#include <math-type-macros-ldouble.h> +#include <s_sin_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_tan.c b/sysdeps/m68k/m680x0/fpu/s_tan.c index dfbbbb2270..c680a6b041 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tan.c +++ b/sysdeps/m68k/m680x0/fpu/s_tan.c @@ -1,2 +1,2 @@ -#define FUNC tan -#include <s_sin.c> +#include <math-type-macros-double.h> +#include <s_tan_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_tan_template.c b/sysdeps/m68k/m680x0/fpu/s_tan_template.c new file mode 100644 index 0000000000..54ec165f90 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_tan_template.c @@ -0,0 +1,30 @@ +/* Implement tan for m68k. + Copyright (C) 2012-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <errno.h> +#include "mathimpl.h" + +FLOAT +M_DECL_FUNC (__tan) (FLOAT x) +{ + if (__m81_test (x) & __M81_COND_INF) + __set_errno (EDOM); + return __m81_u(M_SUF (__tan)) (x); +} +declare_mgen_alias (__tan, tan) diff --git a/sysdeps/m68k/m680x0/fpu/s_tanf.c b/sysdeps/m68k/m680x0/fpu/s_tanf.c index 9ae66ddbf3..a95d4d757c 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tanf.c +++ b/sysdeps/m68k/m680x0/fpu/s_tanf.c @@ -1,2 +1,2 @@ -#define FUNC tanf -#include <s_sinf.c> +#include <math-type-macros-float.h> +#include <s_tan_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_tanh.c b/sysdeps/m68k/m680x0/fpu/s_tanh.c index ac2e7dbb79..11d4bc4f71 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tanh.c +++ b/sysdeps/m68k/m680x0/fpu/s_tanh.c @@ -1,2 +1,2 @@ -#define FUNC tanh -#include <s_atan.c> +#include <math-type-macros-double.h> +#include <s_tanh_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_tanh_template.c b/sysdeps/m68k/m680x0/fpu/s_tanh_template.c new file mode 100644 index 0000000000..e7122a651c --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_tanh_template.c @@ -0,0 +1,26 @@ +/* Implement tanh for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__tanh) (FLOAT x) +{ + return __m81_u(M_SUF (__tanh)) (x); +} +declare_mgen_alias (__tanh, tanh) diff --git a/sysdeps/m68k/m680x0/fpu/s_tanhf.c b/sysdeps/m68k/m680x0/fpu/s_tanhf.c index 1addaae4ff..40f45a2fd7 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tanhf.c +++ b/sysdeps/m68k/m680x0/fpu/s_tanhf.c @@ -1,2 +1,2 @@ -#define FUNC tanhf -#include <s_atanf.c> +#include <math-type-macros-float.h> +#include <s_tanh_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_tanhl.c b/sysdeps/m68k/m680x0/fpu/s_tanhl.c index 6e997911f2..72f4d8f1bc 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tanhl.c +++ b/sysdeps/m68k/m680x0/fpu/s_tanhl.c @@ -1,2 +1,2 @@ -#define FUNC tanhl -#include <s_atanl.c> +#include <math-type-macros-ldouble.h> +#include <s_tanh_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_tanl.c b/sysdeps/m68k/m680x0/fpu/s_tanl.c index 27daf8f29b..099dbfde7d 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tanl.c +++ b/sysdeps/m68k/m680x0/fpu/s_tanl.c @@ -1,2 +1,2 @@ -#define FUNC tanl -#include <s_sinl.c> +#include <math-type-macros-ldouble.h> +#include <s_tan_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_trunc.c b/sysdeps/m68k/m680x0/fpu/s_trunc.c index 96f29a776c..a9f0c4b9db 100644 --- a/sysdeps/m68k/m680x0/fpu/s_trunc.c +++ b/sysdeps/m68k/m680x0/fpu/s_trunc.c @@ -1,2 +1,2 @@ -#define FUNC trunc -#include <s_atan.c> +#include <math-type-macros-double.h> +#include <s_trunc_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_trunc_template.c b/sysdeps/m68k/m680x0/fpu/s_trunc_template.c new file mode 100644 index 0000000000..39a6822cfb --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/s_trunc_template.c @@ -0,0 +1,26 @@ +/* Implement trunc for m68k. + Copyright (C) 1996-2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <math.h> + +FLOAT +M_DECL_FUNC (__trunc) (FLOAT x) +{ + return __m81_u(M_SUF (__trunc)) (x); +} +declare_mgen_alias (__trunc, trunc) diff --git a/sysdeps/m68k/m680x0/fpu/s_truncf.c b/sysdeps/m68k/m680x0/fpu/s_truncf.c index 44dca748ca..65474c779b 100644 --- a/sysdeps/m68k/m680x0/fpu/s_truncf.c +++ b/sysdeps/m68k/m680x0/fpu/s_truncf.c @@ -1,2 +1,2 @@ -#define FUNC truncf -#include <s_atanf.c> +#include <math-type-macros-float.h> +#include <s_trunc_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/s_truncl.c b/sysdeps/m68k/m680x0/fpu/s_truncl.c index 8d35777aed..cbb87540cf 100644 --- a/sysdeps/m68k/m680x0/fpu/s_truncl.c +++ b/sysdeps/m68k/m680x0/fpu/s_truncl.c @@ -1,2 +1,2 @@ -#define FUNC truncl -#include <s_atanl.c> +#include <math-type-macros-ldouble.h> +#include <s_trunc_template.c> diff --git a/sysdeps/m68k/m680x0/fpu/w_exp2f.c b/sysdeps/m68k/m680x0/fpu/w_exp2f.c new file mode 100644 index 0000000000..583065d12a --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/w_exp2f.c @@ -0,0 +1 @@ +#include <sysdeps/../math/w_exp2f.c> diff --git a/sysdeps/m68k/m680x0/fpu/w_expf.c b/sysdeps/m68k/m680x0/fpu/w_expf.c new file mode 100644 index 0000000000..b5fe164520 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/w_expf.c @@ -0,0 +1 @@ +#include <sysdeps/../math/w_expf.c> diff --git a/sysdeps/m68k/m680x0/fpu/w_log2f.c b/sysdeps/m68k/m680x0/fpu/w_log2f.c new file mode 100644 index 0000000000..3f5c71cec2 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/w_log2f.c @@ -0,0 +1 @@ +#include <sysdeps/../math/w_log2f.c> diff --git a/sysdeps/m68k/m680x0/fpu/w_logf.c b/sysdeps/m68k/m680x0/fpu/w_logf.c new file mode 100644 index 0000000000..ea48d1356e --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/w_logf.c @@ -0,0 +1 @@ +#include <sysdeps/../math/w_logf.c> diff --git a/sysdeps/m68k/m680x0/fpu/w_powf.c b/sysdeps/m68k/m680x0/fpu/w_powf.c new file mode 100644 index 0000000000..d133216f5b --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/w_powf.c @@ -0,0 +1 @@ +#include <sysdeps/../math/w_powf.c> |