Commit Graph

19 Commits

Author SHA1 Message Date
Joseph Myers 418d99e622 Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h.
<fenv_private.h> has inline versions of various <fenv.h> functions,
and their __fe* variants, for systems (generally soft-float) without
support for floating-point exceptions, rounding modes or both.

Having these inlines in a separate header introduces a risk of a
source file including <fenv.h> and compiling OK on x86_64, but failing
to compile (because the feraiseexcept inline is actually a macro that
discards its argument, to avoid the need for #ifdef FE_INVALID
conditionals), or not being properly optimized, on systems without the
exceptions and rounding modes support (when these inlines were in
math_private.h, we had a few cases where this broke the build because
there was no obvious reason for a file to need math_private.h and it
didn't need that header on x86_64).  By moving those inlines to
include/fenv.h, this risk can be avoided, and fenv_private.h becomes
more clearly defined as specifically the header for the internal
libc_fe* and SET_RESTORE_ROUND* interfaces.

This patch makes that move, removing fenv_private.h includes that are
no longer needed (or replacing them by fenv.h includes in a few cases
that didn't already have such an include).

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/generic/fenv_private.h [FE_ALL_EXCEPT == 0]: Move this
	code ....
	[!FE_HAVE_ROUNDING_MODES]: And this code ....
	* include/fenv.h [!_ISOMAC]: ... to here.
	* math/fraiseexcpt.c (__feraiseexcept): Undefine as macro.
	(feraiseexcept): Likewise.
	* math/fromfp.h: Do not include <fenv_private.h>.
	* math/s_cexp_template.c: Likewise.
	* math/s_csin_template.c: Likewise.
	* math/s_csinh_template.c: Likewise.
	* math/s_ctan_template.c: Likewise.
	* math/s_ctanh_template.c: Likewise.
	* math/s_iseqsig_template.c: Likewise.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c: Likewise.
	* math/w_ilogb_template.c: Include <fenv.h> instead of
	<fenv_private.h>.
	* math/w_llogb_template.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
2018-09-04 19:52:06 +00:00
Joseph Myers 70e2ba332f Do not include fenv_private.h in math_private.h.
Continuing the clean-up related to the catch-all math_private.h
header, this patch stops math_private.h from including fenv_private.h.
Instead, fenv_private.h is included directly from those users of
math_private.h that also used interfaces from fenv_private.h.  No
attempt is made to remove unused includes of math_private.h, but that
is a natural followup.

(However, since math_private.h sometimes defines optimized versions of
math.h interfaces or __* variants thereof, as well as defining its own
interfaces, I think it might make sense to get all those optimized
versions included from include/math.h, not requiring a separate header
at all, before eliminating unused math_private.h includes - that
avoids a file quietly becoming less-optimized if someone adds a call
to one of those interfaces without restoring a math_private.h include
to that file.)

There is still a pitfall that if code uses plain fe* and __fe*
interfaces, but only includes fenv.h and not fenv_private.h or (before
this patch) math_private.h, it will compile on platforms with
exceptions and rounding modes but not get the optimized versions (and
possibly not compile) on platforms without exception and rounding mode
support, so making it easy to break the build for such platforms
accidentally.

I think it would be most natural to move the inlines / macros for fe*
and __fe* in the case of no exceptions and rounding modes into
include/fenv.h, so that all code including fenv.h with _ISOMAC not
defined automatically gets them.  Then fenv_private.h would be purely
the header for the libc_fe*, SET_RESTORE_ROUND etc. internal
interfaces and the risk of breaking the build on other platforms than
the one you tested on because of a missing fenv_private.h include
would be much reduced (and there would be some unused fenv_private.h
includes to remove along with unused math_private.h includes).

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

	* sysdeps/generic/math_private.h: Do not include <fenv_private.h>.
	* math/fromfp.h: Include <fenv_private.h>.
	* math/math-narrow.h: Likewise.
	* math/s_cexp_template.c: Likewise.
	* math/s_csin_template.c: Likewise.
	* math/s_csinh_template.c: Likewise.
	* math/s_ctan_template.c: Likewise.
	* math/s_ctanh_template.c: Likewise.
	* math/s_iseqsig_template.c: Likewise.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_ilogb_template.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_llogb_template.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* sysdeps/aarch64/fpu/feholdexcpt.c: Likewise.
	* sysdeps/aarch64/fpu/fesetround.c: Likewise.
	* sysdeps/aarch64/fpu/fgetexcptflg.c: Likewise.
	* sysdeps/aarch64/fpu/ftestexcept.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_remainder.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
	* sysdeps/ieee754/dbl-64/gamma_product.c: Likewise.
	* sysdeps/ieee754/dbl-64/lgamma_neg.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fma.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fmaf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/dbl-64/x2y2m1.c: Likewise.
	* sysdeps/ieee754/float128/float128_private.h: Likewise.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
	* sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
	* sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_nearbyintf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/gamma_productl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/x2y2m1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/gamma_productl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/x2y2m1l.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_ceil.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_floor.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_nearbyint.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_round.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_roundeven.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_trunc.c: Likewise.
	* sysdeps/riscv/rvd/s_finite.c: Likewise.
	* sysdeps/riscv/rvd/s_fmax.c: Likewise.
	* sysdeps/riscv/rvd/s_fmin.c: Likewise.
	* sysdeps/riscv/rvd/s_fpclassify.c: Likewise.
	* sysdeps/riscv/rvd/s_isinf.c: Likewise.
	* sysdeps/riscv/rvd/s_isnan.c: Likewise.
	* sysdeps/riscv/rvd/s_issignaling.c: Likewise.
	* sysdeps/riscv/rvf/fegetround.c: Likewise.
	* sysdeps/riscv/rvf/feholdexcpt.c: Likewise.
	* sysdeps/riscv/rvf/fesetenv.c: Likewise.
	* sysdeps/riscv/rvf/fesetround.c: Likewise.
	* sysdeps/riscv/rvf/feupdateenv.c: Likewise.
	* sysdeps/riscv/rvf/fgetexcptflg.c: Likewise.
	* sysdeps/riscv/rvf/ftestexcept.c: Likewise.
	* sysdeps/riscv/rvf/s_ceilf.c: Likewise.
	* sysdeps/riscv/rvf/s_finitef.c: Likewise.
	* sysdeps/riscv/rvf/s_floorf.c: Likewise.
	* sysdeps/riscv/rvf/s_fmaxf.c: Likewise.
	* sysdeps/riscv/rvf/s_fminf.c: Likewise.
	* sysdeps/riscv/rvf/s_fpclassifyf.c: Likewise.
	* sysdeps/riscv/rvf/s_isinff.c: Likewise.
	* sysdeps/riscv/rvf/s_isnanf.c: Likewise.
	* sysdeps/riscv/rvf/s_issignalingf.c: Likewise.
	* sysdeps/riscv/rvf/s_nearbyintf.c: Likewise.
	* sysdeps/riscv/rvf/s_roundevenf.c: Likewise.
	* sysdeps/riscv/rvf/s_roundf.c: Likewise.
	* sysdeps/riscv/rvf/s_truncf.c: Likewise.
2018-09-03 21:09:04 +00:00
Zack Weinberg 0d13dfa17b Don't include math.h/math_private.h in math_ldbl_opt.h.
The sysdeps/ieee754/ldbl-opt version of math_ldbl_opt.h includes
math.h and math_private.h, despite not having any need for those
headers itself; the sysdeps/generic version doesn't.  About 20 files
are relying on math_ldbl_opt.h to include math.h and/or math_private.h
for them, even though none of them necessarily used on a platform that
needs ldbl-opt support.

	* sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h: Don't include
	math.h or math_private.h.

	* sysdeps/alpha/fpu/s_isnan.c
	* sysdeps/ieee754/ldbl-128ibm/s_ceill.c
	* sysdeps/ieee754/ldbl-128ibm/s_floorl.c
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c
	* sysdeps/ieee754/ldbl-128ibm/s_roundl.c
	* sysdeps/ieee754/ldbl-128ibm/s_truncl.c
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/e_hypot.c
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/e_hypotf.c:
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c:
	Include math_private.h.

	* sysdeps/ieee754/ldbl-64-128/s_finitel.c
	* sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
	* sysdeps/ieee754/ldbl-64-128/s_isinfl.c
	* sysdeps/ieee754/ldbl-64-128/s_isnanl.c
	* sysdeps/ieee754/ldbl-64-128/s_signbitl.c
	* sysdeps/powerpc/power7/fpu/s_logb.c:
	Include math.h and math_private.h.
2018-03-10 15:18:08 -05:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Joseph Myers 4a3d39994e Clean up powerpc fegetround / __fegetround inlines.
The natural fix for some linknamespace test failures, where C90 libm
functions call C99 <fenv.h> functions, is to make fe* into weak
aliases for __fe* and call __fe* from within libm as needed.

To do this, the __fe* names need to be available for that purpose -
that is, they must not be used for something other than aliases of
fe*.  On powerpc, however, __fegetround is an inline function in
fenv_libc.h, with no corresponding fegetround inline function;
fegetround has an equivalent macro expansion in bits/fenvinline.h, but
that is disabled if __NO_MATH_INLINES (which is defined for building
libm).

I see no need for that disabling; it's not even clear that
__NO_MATH_INLINES should affect <fenv.h>, and the results of
fegetround are completely defined so there is no semantic effect of
that disabling at all outside glibc.  The x86 inline feraiseexcept is
conditioned on __USE_EXTERN_INLINES not __NO_MATH_INLINES (but that's
an inline function rather than a macro).

This patch removes the __NO_MATH_INLINES conditional on that
fegetround macro, so resulting in it being expanded inline inside
glibc.  In turn, this means that direct calls to __fegetround from C99
functions in ldbl-128ibm can be changed to calls to fegetround, so
that nofpu fenv_libc.h files don't need to define __fegetround at all
and, by changing ldbl-128ibm files to use <fenv.h> not <fenv_libc.h>,
non-e500 nofpu no longer needs an fenv_libc.h file.

The other macros in fenvinline.h are left conditional on
__NO_MATH_INLINES, although since the only case where this should make
a difference is one involving undefined behavior (if the argument to
the function is not a valid exception macro).

The out-of-line definition for fegetround uses __fegetround (the
inline function removed by this patch).  So this continues to work,
the fenvinline.h header is made to define __fegetround, and then to
define fegetround to call __fegetround.

Tested for powerpc32 (hard float) that installed stripped shared
libraries are unchanged by this patch; also tested that powerpc-nofpu
build still works.  (This patch does not itself fix any bugs; it
simply cleans things up in preparation for separate bug fixes.)

	* sysdeps/powerpc/bits/fenvinline.h (fegetround): Rename macro to
	__fegetround and redefine to call __fegetround.  Remove condition
	on [!__NO_MATH_INLINES].
	* sysdeps/powerpc/fpu/fenv_libc.h (__fegetround): Remove inline
	function.
	* sysdeps/powerpc/nofpu/fenv_libc.h: Remove file.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h (__fegetround):
	Remove macro.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	(__llrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	(__lrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	(__rintl): Call fegetround instead of __fegetround.
2014-12-31 19:16:34 +00:00
Ondřej Bílka a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Adhemerval Zanella 41e8926aa4 PowerPC: Set/restore rounding mode only when needed
This patch helps some math functions performance by adding the libc_fexxx
variant of inline functions to handle both FPU round and exception set/restore
and by using them on the libc_fexxx_ctx functions. It is based on already coded
fexxx family functions for PPC with fpu.

Here is the summary of performance improvements due this patch (measured on a
POWER7 machine):

Before:

cos(): ITERS:9.5895e+07: TOTAL:5116.03Mcy, MAX:77.6cy, MIN:49.792cy, 18744 calls/Mcy
exp(): ITERS:2.827e+07: TOTAL:5187.15Mcy, MAX:494.018cy, MIN:38.422cy, 5450.01 calls/Mcy
pow(): ITERS:6.1705e+07: TOTAL:5144.26Mcy, MAX:171.95cy, MIN:29.935cy, 11994.9 calls/Mcy
sin(): ITERS:8.6898e+07: TOTAL:5117.06Mcy, MAX:83.841cy, MIN:46.582cy, 16982 calls/Mcy
tan(): ITERS:2.9473e+07: TOTAL:5115.39Mcy, MAX:191.017cy, MIN:172.352cy, 5761.63 calls/Mcy

After:

cos(): ITERS:2.05265e+08: TOTAL:5111.37Mcy, MAX:78.754cy, MIN:24.196cy, 40158.5 calls/Mcy
exp(): ITERS:3.341e+07: TOTAL:5170.84Mcy, MAX:476.317cy, MIN:15.574cy, 6461.23 calls/Mcy
pow(): ITERS:7.6153e+07: TOTAL:5129.1Mcy, MAX:147.5cy, MIN:30.916cy, 14847.2 calls/Mcy
sin(): ITERS:1.58816e+08: TOTAL:5115.11Mcy, MAX:1490.39cy, MIN:22.341cy, 31048.4 calls/Mcy
tan(): ITERS:3.4964e+07: TOTAL:5114.18Mcy, MAX:177.422cy, MIN:146.115cy, 6836.68 calls/Mcy
2013-11-25 06:34:41 -06:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Joseph Myers 8db2188281 Remove __STDC__ conditionals from libm. 2012-01-27 17:29:45 +00:00
Ulrich Drepper fb146a76a5 * io/Makefile (CFLAGS-fstatat.c): Set.
(CFLAGS-fstatat64.c): Likewise.
	(CFLAGS-mknodat.c): Likewise.

	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Comment fixes.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Rewritten.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Rewritten.

2006-09-14  Jakub Jelinek  <jakub@redhat.com>
2006-09-17 07:26:24 +00:00
Roland McGrath 830fce0415 [BZ #2466]
* math/gen-libm-test.pl (parse_args): Take function name for pretty
	output as an argument.
	(generate_testfile): Pass it the name given in the START macro.

	[BZ #2466]
	* math/libm-test.inc (llrint_test, llround_test): Fix last change to
	protect large-precision cases with [LDBL_MANT_DIG > 100].
	(llrint_test_tonearest, llrint_test_towardzero): Likewise.
	(llrint_test_downward, llrint_test_upward): Likewise.

2006-03-15  Steven Munroe  <sjmunroe@us.ibm.com>
	    Alan Modra  <amodra@bigpond.net.au>

	[BZ #2466]
	* math/libm-test.inc (llrint_test, llround_test) [TEST_LDOUBLE]:
	Add new test values.
	(llrint_test_tonearest, llrint_test_towardzero, llrint_test_downward,
	llrint_test_upward): New functions.
	(main): Call them.

	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c (__llrintl): Handle
	rounding that spans doubles in IBM long double format.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c (__llroundl): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintl.S: Removed.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundl.S: Removed.
	* sysdeps/powerpc/powerpc64/fpu/s_lrintl.S: Removed.
	* sysdeps/powerpc/powerpc64/fpu/s_lroundl.S: Removed.

2006-03-16  Roland McGrath  <roland@redhat.com>
2006-03-16 23:17:32 +00:00
Roland McGrath f964490f3c 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com>
Jakub Jelinek  <jakub@redhat.com>
	    Roland McGrath  <roland@redhat.com>
	    Steven Munroe  <sjmunroe@us.ibm.com>
	    Alan Modra  <amodra@bigpond.net.au>

	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Comment fix.
	* sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Likewise.

	* sysdeps/powerpc/fpu/libm-test-ulps: Update.

	* math/libm-test.inc (check_float_internal): Allow ulp <= 0.5.
	(erfc_test): Don't run erfcl (27.0L) test if erfcl (27.0L) is
	denormal.
	[TEST_LDOUBLE] (ceil_test, floor_test, llrint_test, llround_test,
	rint_test, round_test, trunc_test): Add new tests.

	* sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: New file.
	* sysdeps/powerpc/powerpc32/fpu/s_fabs.S: New file.
	* sysdeps/powerpc/powerpc32/fpu/s_fabsl.S: New file.
	* sysdeps/powerpc/powerpc32/fpu/s_fdim.c: New file.
	* sysdeps/powerpc/powerpc32/fpu/s_fmax.S: New file.
	* sysdeps/powerpc/powerpc32/fpu/s_fmin.S: New file.
	* sysdeps/powerpc/powerpc32/fpu/s_isnan.c: New file.

	* sysdeps/powerpc/powerpc64/fpu/s_ceill.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_fabs.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_fdim.c: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_floorl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_fmax.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_fmin.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_isnan.c: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_lrintl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_lroundl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_rintl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_roundl.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/s_truncl.S: New file.

	* sysdeps/unix/sysv/linux/powerpc/Implies: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies: New file.
	* sysdeps/unix/sysv/linux/powerpc/configure.in: New file.
	* sysdeps/unix/sysv/linux/powerpc/configure: New file.
	* sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
	(__LONG_DOUBLE_MATH_OPTIONAL): Define.
	(__NO_LONG_DOUBLE_MATH): Define.
	* sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h: New file.
	* sysdeps/powerpc/fpu/s_isnan.c: Include math_ldbl_opt.h.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (ceill): Add compatibility symbols.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (copysignl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (floorl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (llrintl, lrintl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc64/fpu/s_llround.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (llroundl, lroundl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (rintl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (roundl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (truncl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (ceill): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (copysignl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_floor.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (floorl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (lrintl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_llrint.c: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (llrintl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (lroundl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_rint.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (rintl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_round.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (roundl): Add compatibility symbols.
	* sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Include math_ldbl_opt.h.
	[LONG_DOUBLE_COMPAT] (truncl): Add compatibility symbols.

	* misc/qefgcvt_r.c [LDBL_MIN_10_EXP == -291] (FLOAT_MIN_10_NORM): New.

	* sysdeps/powerpc/fpu/bits/mathdef.h (__NO_LONG_DOUBLE_MATH): Remove.
	* sysdeps/powerpc/Implies: Add ieee754/ldbl-128ibm.
	* sysdeps/powerpc/powerpc32/Implies: Remove powerpc/soft-fp.
	* sysdeps/ieee754/ldbl-128ibm/Makefile: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_acoshl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_acosl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_asinl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_atan2l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_coshl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_j0l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_log10l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_log2l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_logl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_powl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_remainderl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/ieee754.h: New file.
	* sysdeps/ieee754/ldbl-128ibm/k_cosl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/k_sinl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/k_tanl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: New file.
	* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_cosl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_erfl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_expm1l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_fabsl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_finitel.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_frexpl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_isinfl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_isnanl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_log1pl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_logbl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_modfl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_signbitl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_sincosl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_sinl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_tanl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_truncl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/strtold_l.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/t_sincosl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/w_expl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_copysignl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_floorl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_roundl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_ceill.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: New file.

	* sysdeps/ieee754/ldbl-128/e_powl.c: Fix old comment.
2006-01-28 00:15:15 +00:00
Ulrich Drepper a334319f65 (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. 2004-12-22 20:10:10 +00:00
Jakub Jelinek 0ecb606cb6 2.5-18.1 2007-07-12 18:26:36 +00:00