Commit Graph

5 Commits

Author SHA1 Message Date
Paul E. Murphy 81f26b53b5 float128: Add private _Float128 declarations for libm.
Add the necessary bits to the private headers to support
building the _Float128 libm functions.

A local override for float.h is provided to include the
missing *FLT128 macros implied by TS 18661-3 for this
type when compiling prior to GCC 7.

	* include/complex.h (__kernel_casinhf128): New declaration.
	* include/float.h: New file.
	* include/math.h (__finitef128): Add a hidden def.
	(__isinff128): Likewise.
	(__isnanf128): Likewise.
	(__fpclassify): Likewise.
	(__issignalling): Likewise.
	(__expf128): Likewise.
	(__expm1f128): Likewise.

	* sysdeps/generic/fix-fp-int-convert-overflow.h:
	(FIX_FLT128_LONG_CONVERT_OVERFLOW): New macro.
	(FIX_FLT128_LLONG_CONVERT_OVERFLOW): Likewise.

	* sysdeps/generic/math-type-macros-float128.h: New file.

	* sysdeps/generic/math_private.h: Include bits/floatn.h and
	math_private_calls.h for _Float128.
	(__isinff128): New inline implementation used when GCC < 7.0,
	since in this case __builtin_isinf_sign is broken.
	(fabsf128): New inline implementation that calls the builtin.
	(__EXPR_FLT128): New macro.
	(min_of_type): Optionally include _Float128 types too.

	* sysdeps/generic/math_private_calls.h (__kernel_sincos):
	Declare for _Float128.
	(__kernel_rem_pio2): Likewise.

	* sysdeps/ieee754/ldbl-opt/s_sin.c:
	(__DECL_SIMD_sincos_disablef128): New macro.
2017-05-15 10:23:28 -03:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Stefan Liebler c4d17461e0 S/390: Do not raise inexact exception in lrint/lround. [BZ #19486]
I get some math test-failures on s390 for float/double/ldouble for
various lrint/lround functions like:
lrint (0x1p64): Exception "Inexact" set
lrint (-0x1p64): Exception "Inexact" set
lround (0x1p64): Exception "Inexact" set
lround (-0x1p64): Exception "Inexact" set
...

GCC emits "convert to fixed" instructions for casting floating point
values to integer values. These instructions raise invalid and inexact
exceptions if the floating point value exceeds the integer type ranges.

This patch enables the various FIX_DBL_LONG_CONVERT_OVERFLOW macros in
order to avoid a cast from floating point to integer type and raise the
invalid exception with feraiseexcept.
The ldbl-128 rint/round functions are now using the same logic.

ChangeLog:

	[BZ #19486]
	* sysdeps/s390/fix-fp-int-convert-overflow.h: New File.
	* sysdeps/generic/fix-fp-int-convert-overflow.h
	(FIX_LDBL_LONG_CONVERT_OVERFLOW,
	FIX_LDBL_LLONG_CONVERT_OVERFLOW): New define.
	* sysdeps/arm/fix-fp-int-convert-overflow.h: Likewise.
	* sysdeps/mips/mips32/fpu/fix-fp-int-convert-overflow.h:
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c (__lrintl):
	Avoid conversions to long int where inexact exceptions
	could be raised.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c (__lroundl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c (__llrintl):
	Avoid conversions to long long int where inexact exceptions
	could be raised.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c (__llroundl):
	Likewise.
2016-01-18 12:48:06 +01:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Joseph Myers 06d97e5e61 Fix lrint, llrint, lround, llround missing exceptions for MIPS (bug 16399).
For 32-bit MIPS and some other systems, various of the lrint, llrint,
lround, llround functions can be missing exceptions on overflow
because casts do not (in current GCC) result in the proper
exceptions.  In the MIPS case there are two problems here: MIPS I code
generation uses an assembler macro that doesn't raise exceptions,
while the libgcc conversions of floating-point values to long long
also do not raise "invalid" on all overflow cases (and can raise
spurious "inexact").

This patch adds support in the generic code (only the functions for
which this problem has actually been seen) for forcing the "invalid"
exception in the problem cases, and enables that support for the
affected MIPS cases.

Tested for MIPS; also tested for x86_64 and x86 that installed
stripped shared libraries are unchanged by this patch.

	[BZ #16399]
	* sysdeps/generic/fix-fp-int-convert-overflow.h: New file.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Include <fenv.h>, <limits.h>
	and <fix-fp-int-convert-overflow.h>.
	(__llrint) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/ieee754/dbl-64/s_llround.c: Include <fenv.h>, <limits.h>
	and <fix-fp-int-convert-overflow.h>.
	(__llround) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Include
	<fix-fp-int-convert-overflow.h>.
	(__lrint) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/ieee754/dbl-64/s_lround.c: Include
	<fix-fp-int-convert-overflow.h>.
	(__lround) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Include <fenv.h>, <limits.h>
	and <fix-fp-int-convert-overflow.h>.
	(__llrintf) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Include <fenv.h>,
	<limits.h> and <fix-fp-int-convert-overflow.h>.
	(__llroundf) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Include <fenv.h>, <limits.h>
	and <fix-fp-int-convert-overflow.h>.
	(__lrintf) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Include <fenv.h>, <limits.h>
	and <fix-fp-int-convert-overflow.h>.
	(__lroundf) [FE_INVALID]: Force FE_INVALID exception as needed if
	FIX_DBL_LLONG_CONVERT_OVERFLOW.
	* sysdeps/mips/mips32/fpu/fix-fp-int-convert-overflow.h: New file.
2015-10-09 21:02:19 +00:00