Age | Commit message (Collapse) | Author |
|
|
|
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
|
|
* 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.
|
|
This patch adds the narrowing multiply functions from TS 18661-1 to
glibc's libm: fmul, fmull, dmull, f32mulf64, f32mulf32x, f32xmulf64
for all configurations; f32mulf64x, f32mulf128, f64mulf64x,
f64mulf128, f32xmulf64x, f32xmulf128, f64xmulf128 for configurations
with _Float64x and _Float128; __nldbl_dmull for ldbl-opt.
The changes are mostly essentially the same as for the narrowing add
functions, so the description of those generally applies to this patch
as well. f32xmulf64 for i386 cannot use precision control as used for
add and subtract, because that would result in double rounding for
subnormal results, so that uses round-to-odd with long double
intermediate result instead. The soft-fp support involves adding a
new FP_TRUNC_COOKED since soft-fp multiplication uses cooked inputs
and outputs.
Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft
float) and powerpc, and with build-many-glibcs.py.
* math/Makefile (libm-narrow-fns): Add mul.
(libm-test-funcs-narrow): Likewise.
* math/Versions (GLIBC_2.28): Add narrowing multiply functions.
* math/bits/mathcalls-narrow.h (mul): Use __MATHCALL_NARROW.
* math/gen-auto-libm-tests.c (test_functions): Add mul.
* math/math-narrow.h (CHECK_NARROW_MUL): New macro.
(NARROW_MUL_ROUND_TO_ODD): Likewise.
(NARROW_MUL_TRIVIAL): Likewise.
* soft-fp/op-common.h (FP_TRUNC_COOKED): Likewise.
* sysdeps/ieee754/float128/float128_private.h (__fmull): New
macro.
(__dmull): Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmul and
dmul.
(CFLAGS-nldbl-dmul.c): New variable.
(CFLAGS-nldbl-fmul.c): Likewise.
* sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add
__nldbl_dmull.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_dmull): New
prototype.
* manual/arith.texi (Misc FP Arithmetic): Document fmul, fmull,
dmull, fMmulfN, fMmulfNx, fMxmulfN and fMxmulfNx.
* math/auto-libm-test-in: Add tests of mul.
* math/auto-libm-test-out-narrow-mul: New generated file.
* math/libm-test-narrow-mul.inc: New file.
* sysdeps/i386/fpu/s_f32xmulf64.c: Likewise.
* sysdeps/ieee754/dbl-64/s_f32xmulf64.c: Likewise.
* sysdeps/ieee754/dbl-64/s_fmul.c: Likewise.
* sysdeps/ieee754/float128/s_f32mulf128.c: Likewise.
* sysdeps/ieee754/float128/s_f64mulf128.c: Likewise.
* sysdeps/ieee754/float128/s_f64xmulf128.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_dmull.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_f64xmulf128.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_fmull.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_dmull.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_fmull.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_dmull.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_fmull.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-dmul.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-fmul.c: Likewise.
* sysdeps/ieee754/soft-fp/s_dmull.c: Likewise.
* sysdeps/ieee754/soft-fp/s_fmul.c: Likewise.
* sysdeps/ieee754/soft-fp/s_fmull.c: Likewise.
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
* sysdeps/mach/hurd/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
* 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.
|
|
/* FALLTHRU */ comments.
|
|
|
|
|
|
* soft-fp/op-common.h (_FP_FROM_INT): Don't write to R.
|
|
This patch makes soft-fp use static assertions in place of conditional
calls to abort, in places where there are checks for conditions (on
the types for which a macro is used) that the code is not prepared to
handle. The fallback definition of _FP_STATIC_ASSERT (for kernel use
only, as only relevant to compilers not supported for building glibc)
is as in misc/sys/cdefs.h.
This means that soft-fp only ever calls abort for _FP_UNREACHABLE
calls in builds with GCC versions before 4.5. Thus, there is no need
for an abort declaration or <stdlib.h> include, since the kernel code
handles defining abort as a macro itself - and so this avoids any need
for an __KERNEL__ condition on the abort declaration to avoid it
breaking with the kernel's macro definition. That is, this patch is
intended to make glibc's soft-fp code suitable for kernel use with no
kernel-local changes to the soft-fp code needed at all.
Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by the patch. One explicit <stdlib.h> include had to be
added to a file that was relying on the include from soft-fp.h.
* soft-fp/soft-fp.h (_FP_STATIC_ASSERT): New macro.
[_LIBC]: Do not include <stdlib.h>.
[!_LIBC] (abort): Remove declaration.
* soft-fp/op-2.h (_FP_MUL_MEAT_2_120_240_double): Use
_FP_STATIC_ASSERT instead of conditionally calling abort.
* soft-fp/op-common.h (_FP_FROM_INT): Likewise.
(_FP_EXTEND_CNAN): Likewise.
(FP_TRUNC): Likewise.
(__FP_CLZ): Likewise.
* sysdeps/powerpc/nofpu/flt-rounds.c: Include <stdlib.h>.
|
|
This patch makes soft-fp use a new macro _FP_UNREACHABLE in place of
calling abort in unreachable default cases of switch statements.
_FP_UNREACHABLE expands to call __builtin_unreachable for GCC 4.5 and
later; the fallback to abort is thus only for kernel use.
Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch. Also tested with the math/ tests for mips64
(in the case of fma there *was* previously an abort call generated,
unlike for the other operations - one switch only deals with a subset
of classes for one operand based on what could have been generated in
the earlier part of fma, whereas the other switches deal with all
combinations of two classes - and this is apparently too complicated
for the default case to have been optimized away).
* soft-fp/soft-fp.h (_FP_UNREACHABLE): New macro.
* soft-fp/op-common.h (_FP_MUL): Use _FP_UNREACHABLE instead of
abort.
(_FP_FMA): Likewise.
(_FP_DIV): Likewise.
|
|
This patch makes soft-fp headers consistently use multiple-include
guards, something previously done mainly only in the Linux kernel
version. The guard macros aren't the same as those used in the Linux
kernel, but there seems to be enough variation in such guards in Linux
kernel code that hopefully this version will be acceptable there.
Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.
* soft-fp/double.h [SOFT_FP_DOUBLE_H]: New multiple-include guard.
* soft-fp/extended.h [SOFT_FP_EXTENDED_H]: Likewise.
* soft-fp/op-1.h [SOFT_FP_OP_1_H]: Likewise.
* soft-fp/op-2.h [SOFT_FP_OP_2_H]: Likewise.
* soft-fp/op-4.h [SOFT_FP_OP_4_H]: Likewise.
* soft-fp/op-8.h [SOFT_FP_OP_8_H]: Likewise.
* soft-fp/op-common.h [SOFT_FP_OP_COMMON_H]: Likewise.
* soft-fp/quad.h [SOFT_FP_QUAD_H]: Likewise.
* soft-fp/single.h [SOFT_FP_SINGLE_H]: Likewise.
* soft-fp/soft-fp.h (SOFT_FP_H): Define to 1 rather than empty.
Add comment on closing #endif.
|
|
In the Linux kernel, some architectures have a single function that
uses different kinds of unpacking and packing depending on the
instruction being emulated, meaning it is not readily visible to the
compiler that variables from _FP_DECL and _FP_FRAC_DECL_* macros are
only used in cases where they were initialized. The existing copy of
soft-fp in the Linux kernel uses zero-initialization to avoid warnings
in this case, so while frowned upon as a warning suppression mechanism
in code built for glibc it seems appropriate to have such
zero-initialization conditional on __KERNEL__. This patch duly adds
it, via a macro _FP_ZERO_INIT that expands to empty for non-kernel
compilations.
Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.
* soft-fp/soft-fp.h (_FP_ZERO_INIT): New macro. Define depending
on [__KERNEL__].
* soft-fp/op-1.h (_FP_FRAC_DECL_1): Use _FP_ZERO_INIT.
* soft-fp/op-2.h (_FP_FRAC_DECL_2): Likewise.
* soft-fp/op-common.h (_FP_DECL): Likewise.
|
|
soft-fp calls abort in various cases that the code doesn't handle, all
cases that should never actually occur for any supported choice of
types.
Calling an abort function is not appropriate for kernel use, so the
Linux kernel redefines abort as a macro in various ways in the ports
using this code, typically to "return 0" or similar.
One use of abort in soft-fp is inside a comma expression and doesn't
work with such a macro. This patch changes it to use a statement
expression.
Tested for powerpc-nofpu that installed shared libraries are unchanged
by this patch.
(There are two classes of aborts: those to make control flow visible
to the compiler, in default cases of switches over _FP_CLS_COMBINE,
which could reasonably change to __builtin_unreachable for glibc but
would still need to handle pre-4.5 compilers for kernel use, and those
intended to detect any use of soft-fp for combinations of types the
code doesn't know how to handle, which could reasonably become link
failures if the calls should always be optimized away. But those are
separate possible future enhancements.)
* soft-fp/op-common.h (_FP_FROM_INT): Wrap call to abort in
expression inside statement expression.
|
|
17932).
soft-fp's _FP_FMA fails to set the result's exponent for cases where
the result of the multiplication is 0, yielding incorrect (arbitrary,
depending on uninitialized values) results for those cases. This
affects libm for architectures using soft-fp to implement fma. This
patch adds the exponent setting and tests for this case.
Tested for ARM soft-float (which uses soft-fp fma), x86_64 and x86 (to
verify not introducing new libm test failures there).
(This bug showed up in testing my patch to move the Linux kernel to
current soft-fp. math/Makefile has "override CFLAGS +=
-Wno-uninitialized" which would have stopped compiler warnings from
showing up this problem, although I wouldn't be surprised if removing
that shows spurious warnings from this code, if the compiler fails to
follow that various cases where the exponent is uninitialized don't
need it initialized because the class is set to a value meaning the
uninitialized exponent isn't used.)
[BZ #17932]
* soft-fp/op-common.h (_FP_FMA): Set exponent of result in case
where multiplication results in zero and third argument is finite
and nonzero.
* math/auto-libm-test-in: Add more tests of fma.
* math/auto-libm-test-out: Regenerated.
|
|
In <https://sourceware.org/ml/libc-alpha/2014-09/msg00488.html>, I
noted that comparisons in soft-fp did not set FP_EX_DENORM unless
denormal operands were flushed to zero.
This patch fixes soft-fp to check for denormal operands for
comparisons and set that exception whenever FP_EX_DENORM is not zero.
In particular, for the one architecture for which the Linux kernel
defines FP_EX_DENORM (alpha), this corresponds to the existing logic
for comparisons and so allows that logic to be replaced by a simple
call to FP_CMP_D when soft-fp is updated in the kernel.
Tested for powerpc (e500) that installed stripped shared libraries are
unchanged by this patch.
* soft-fp/op-common.h (_FP_CMP_CHECK_DENORM): New macro.
(_FP_CMP_CHECK_FLUSH_ZERO): Likewise.
(_FP_CMP): Use_FP_CMP_CHECK_DENORM and _FP_CMP_CHECK_FLUSH_ZERO.
(_FP_CMP_EQ): Likewise.
(_FP_CMP_UNORD): Use _FP_CMP_CHECK_DENORM.
|
|
One special case needed in soft-fp to replace the old version in the
Linux kernel is extending from a narrower floating-point format to a
wider one without quieting signaling NaNs. (This is for
arch/powerpc/math-emu/lfs.c, where previously it used the old FP_CONV
which didn't do anything special for NaNs, then handled packing
specially for NaNs to avoid quieting at packing time, and discarded
the exceptions from unpacking.)
This patch accordingly refactors FP_EXTEND, creating a separate
_FP_EXTEND_CNAN that offers a choice of how NaNs are handled, with
FP_EXTEND reimplemented as a wrapper that provides the common case of
the IEEE operation that does quiet signaling NaNs and raise exceptions
for them.
Tested for powerpc (e500) that installed stripped shared libraries are
unchanged by this patch.
* soft-fp/op-common.h (FP_EXTEND): Rename to _FP_EXTEND_CNAN with
extra argument CHECK_NAN. Redefine as wrapper around
_FP_EXTEND_CNAN.
|
|
soft-fp has various macros containing labels and goto statements.
Because label names are function-scoped, this is problematic for using
the same macro more than once within a function, which some
architectures do in the Linux kernel (the soft-fp version there
predates the addition of any of these labels and gotos). This patch
fixes this by using __label__ to make the labels local to the block
with the __label__ declaration.
Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.
* soft-fp/op-common.h (_FP_ADD_INTERNAL): Declare labels with
__label__.
(_FP_FMA): Likewise.
(_FP_TO_INT_ROUND): Likewise.
(_FP_FROM_INT): Likewise.
|
|
|
|
Continuing the series of patches adding soft-fp features from the
kernel version of soft-fp to glibc so that glibc's version is able to
replace the old fork of soft-fp in the kernel, this patch adds the
last major such feature: _FP_TO_INT_ROUND, converting a floating-point
number to an integer with rounding according to the current rounding
direction (as opposed to truncating towards zero, which _FP_TO_INT
does).
The general structure of the implementation follows that of
_FP_TO_INT, but of course is more complicated. As with glibc's
_FP_TO_INT it works with raw input (the kernel versions of these
macros predate the conversion of _FP_TO_INT and many other macros to
raw or semi-raw input). I have not tried to work out what bugs there
might be in the kernel version that this might fix; it's a
from-scratch implementation based on _FP_TO_INT.
Tested for powerpc (soft-float) that there is no change to the
installed shared libraries; also tested with the libm tests with lrint
/ lrintf / llrint / llrintf made to use _FP_TO_INT_ROUND, to provide
some test of the functionality. As we don't have benchmarks for those
functions, I haven't actually included the soft-fp versions of them,
although I expect them to be faster than the existing code (given that
the existing code involves adding and subtracting numbers such as
0x1p52 to achieve the desired rounding, which is not particularly
efficient when the underlying floating point is software floating
point).
2014-11-04 Joseph Myers <joseph@codesourcery.com>
* soft-fp/op-common.h (_FP_TO_INT_ROUND): New macro.
* soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_ROUND_D): New
macro.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_ROUND_D): Likewise.
* soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_ROUND_E):
New macro.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_ROUND_E): Likewise.
* soft-fp/quad.h [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_ROUND_Q): New
macro.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_ROUND_Q): Likewise.
* soft-fp/single.h (FP_TO_INT_ROUND_S): New macro.
|
|
This patch cleans up the soft-fp code to use parentheses around macro
arguments (where possible; many macro arguments are identifiers used
with ## rather than arbitrary expressions, so cannot be put in
parentheses). (I'm not aware of any bugs caused by the lack of
parentheses, but this is generally good practice. The patch is not
exhaustive regarding internal macros where the arguments always come
directly from the mantissa of a floating-point number, although
probably those should be cleaned up in this regard as well.)
Tested for powerpc-nofpu that the installed shared libraries are
unchanged by this patch.
* soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_D): Use
parentheses around macro arguments.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_D): Likewise.
* soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_E):
Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_E): Likewise.
* soft-fp/op-1.h (_FP_FRAC_SRST_1): Likewise.
(_FP_FRAC_SRS_1): Likewise.
(_FP_FRAC_CLZ_1): Likewise.
(_FP_MUL_MEAT_1_imm): Likewise.
(_FP_MUL_MEAT_1_wide): Likewise.
(_FP_MUL_MEAT_1_hard): Likewise.
(_FP_SQRT_MEAT_1): Likewise.
(_FP_FRAC_ASSEMBLE_1): Likewise.
(_FP_FRAC_DISASSEMBLE_1): Likewise.
* soft-fp/op-2.h (_FP_FRAC_CLZ_2): Likewise.
(__FP_CLZ_2): Likewise.
(_FP_MUL_MEAT_2_wide): Likewise.
(_FP_MUL_MEAT_2_wide_3mul): Likewise.
(_FP_MUL_MEAT_2_gmp): Likewise.
(_FP_MUL_MEAT_2_120_240_double): Likewise.
(_FP_SQRT_MEAT_2): Likewise.
(_FP_FRAC_ASSEMBLE_2): Likewise.
(_FP_FRAC_DISASSEMBLE_2): Likewise.
* soft-fp/op-4.h (_FP_FRAC_SRS_4): Likewise.
(_FP_FRAC_CLZ_4): Likewise.
(_FP_MUL_MEAT_4_wide): Likewise.
(_FP_MUL_MEAT_4_gmp): Likewise.
(_FP_SQRT_MEAT_4): Likewise.
(_FP_FRAC_ASSEMBLE_4): Likewise.
(_FP_FRAC_DISASSEMBLE_4): Likewise.
* soft-fp/op-common.h (_FP_CMP): Likewise.
(_FP_CMP_EQ): Likewise.
(_FP_CMP_UNORD): Likewise.
(_FP_TO_INT): Likewise.
(_FP_FROM_INT): Likewise.
[!__FP_CLZ] (__FP_CLZ): Likewise.
(_FP_DIV_HELP_imm): Likewise.
* soft-fp/quad.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_Q):
Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_Q): Likewise.
* soft-fp/single.h (FP_UNPACK_RAW_S): Likewise.
(FP_UNPACK_RAW_SP): Likewise.
(FP_PACK_RAW_S): Likewise.
(FP_PACK_RAW_SP): Likewise.
(FP_UNPACK_S): Likewise.
(FP_UNPACK_SP): Likewise.
(FP_UNPACK_SEMIRAW_S): Likewise.
(FP_UNPACK_SEMIRAW_SP): Likewise.
(FP_PACK_S): Likewise.
(FP_PACK_SP): Likewise.
(FP_PACK_SEMIRAW_S): Likewise.
(FP_PACK_SEMIRAW_SP): Likewise.
(_FP_SQRT_MEAT_S): Likewise.
(FP_CMP_S): Likewise.
(FP_CMP_EQ_S): Likewise.
(FP_CMP_UNORD_S): Likewise.
(FP_TO_INT_S): Likewise.
(FP_FROM_INT_S): Likewise.
|
|
Continuing the addition of soft-fp features in the Linux kernel
version, this patch adds _FP_TO_INT support for rsigned == 2 (reduce
overflowing results modulo 2^rsize to fit in the destination, used for
alpha emulation).
The kernel version is buggy; it can left shift by a negative amount
when right shifting is required in an overflow case (the kernel
version also has other bugs fixed long ago in glibc; at least,
spurious exceptions converting to the most negative integer). This
version avoids that by handling overflow (other than to 0) for rsigned
== 2 along with the normal non-overflow case, which already properly
determines the direction in which to shift.
Tested for powerpc-nofpu. Some functions get slightly bigger and some
get slightly smaller, no doubt as a result of the change to where in
the macro "inexact" is raised, but I don't think those changes are
significant. Also tested for powerpc-nofpu with the relevant __fix*
functions changed to use rsigned == 2 (which is after all just as
valid as rsigned == 1 in IEEE terms), including verifying the results
and exceptions for various cases of conversions.
With these seven patches, the one remaining feature to add for the
soft-fp code to have all the features of the kernel version is
_FP_TO_INT_ROUND.
* soft-fp/op-common.h (_FP_TO_INT): Handle rsigned == 2.
|
|
As previously discussed
<https://sourceware.org/ml/libc-alpha/2013-10/msg00345.html>, it would
be desirable to be able to use the same version of the soft-fp code in
the Linux kernel as well as in glibc and libgcc (instead of an old
version in the kernel that's missing ten years of bug fixes,
performance improvements and new features), and to that end it is
useful to add to glibc's copy features in the kernel's copy, even when
they are not directly useful in glibc.
To that end, this patch adds one of those features: support for more
precise "invalid" exceptions describing the particular kind of invalid
operation. These are relevant for powerpc emulation, and are also as
described in IEEE 754-2008 as sub-exceptions.
The set of sub-exceptions here is the union of those supported on
powerpc and those from IEEE 754-2008 (the former adds a distinction
between 0/0 and Inf/Inf; the latter adds a distinction between Inf*0
from multiplication and the same from fma). This includes
sub-exceptions for sqrt, conversions to integer and comparisons that
are not supported in the kernel; I see no obvious reason for these
being missing from the kernel support, given that they are supported
on powerpc so accurate powerpc emulation should generate them.
Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.
* soft-fp/soft-fp.h (FP_EX_INVALID_SNAN): New macro.
(FP_EX_INVALID_IMZ): Likewise.
(FP_EX_INVALID_IMZ_FMA): Likewise.
(FP_EX_INVALID_ISI): Likewise.
(FP_EX_INVALID_ZDZ): Likewise.
(FP_EX_INVALID_IDI): Likewise.
(FP_EX_INVALID_SQRT): Likewise.
(FP_EX_INVALID_CVI): Likewise.
(FP_EX_INVALID_VC): Likewise.
* soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Specify more precise
"invalid" exceptions.
(_FP_CHECK_SIGNAN_SEMIRAW): Likewise.
(_FP_ADD_INTERNAL): Likewise.
(_FP_MUL): Likewise.
(_FP_FMA): Likewise.
(_FP_DIV): Likewise.
(_FP_CMP_CHECK_NAN): Likewise.
(_FP_SQRT): Likewise.
(_FP_TO_INT): Likewise.
(FP_EXTEND): Likewise.
|
|
Continuing the addition of soft-fp features used in the Linux kernel,
this patch adds soft-fp support for FP_DENORM_ZERO (flushing input
subnormal operands to zero of the same sign).
There are some differences from the kernel version. In the kernel,
the "inexact" exception is set when flushing to zero. This does not
appear to match the documented semantics for either of the
architectures (alpha and sh) for which the kernel uses FP_DENORM_ZERO,
so this patch does not set "inexact" in this case. More operations
now use raw or semi-raw unpacking for optimization than did in the
ten-year-old soft-fp version in the kernel, so checks of
FP_DENORM_ZERO are inserted in those operations. They are also
inserted for comparisons (which already used raw unpacking in the old
version) as I believe that's the correct thing to do when input
subnormals are flushed to zero. They are *not* inserted for _FP_NEG.
(If any processors do flush input subnormals to zero for negation, or
otherwise vary from the rules implemented when FP_DENORM_ZERO is set,
further macros for sfp-machine.h to control this may need to be
added.)
Although the addition for comparisons will cause FP_EX_DENORM to be
set in this case, it still won't be set for comparisons involving
subnormals when not flushed to zero. It's quite possible that
accurate emulation of processors that have such an exception for
subnormal operands will require further changes relating to when
FP_EX_DENORM is set (in general, the support for things defined by
IEEE should be considered more reliable and mature than the support
for things outside the scope of IEEE floating point).
Although some processors also have a mode for abrupt underflow -
producing zeroes instead of output subnormals - there is no such mode
in the kernel's soft-fp, so no such mode is added to glibc's soft-fp
(although it could be if someone wanted to emulate such processor
support).
Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.
* soft-fp/soft-fp.h (FP_DENORM_ZERO): New macro.
* soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Check
FP_DENORM_ZERO.
(_FP_CHECK_FLUSH_ZERO): New macro.
(_FP_ADD_INTERNAL): Call _FP_CHECK_FLUSH_ZERO.
(_FP_CMP): Likewise.
(_FP_CMP_EQ): Likewise.
(_FP_TO_INT): Do not set inexact for subnormal arguments if
FP_DENORM_ZERO.
(FP_EXTEND): Call _FP_CHECK_FLUSH_ZERO.
(FP_TRUNC): Likewise.
|
|
This patch fixes a latent bug in _FP_TO_INT regarding handling of
arguments with maximum exponent (infinities and NaNs). If the maximum
exponent is below that calculated as an overflow threshold, such
values would incorrectly be treated as normal values for the purposes
of the conversion. This could not occur for any of the conversions
actually occurring in glibc, libgcc or the Linux kernel (the maximum
exponent for float is, just, big enough to ensure overflow for
unsigned __int128), but would apply if soft-fp were used for IEEE
binary16. Appropriate checks are inserted to ensure that the maximum
exponent is always treated as an overflowing exponent, and never as a
normal one.
Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.
* soft-fp/op-common.h (_FP_TO_INT): Ensure maximum exponent is
treated as invalid conversion, not as normal exponent.
|
|
This patch refactors how soft-fp comparisons handle setting exceptions
for NaN operands, so that exceptions are set through the FP_CMP macros
rather than directly in the C files calling them.
The _FP_CMP* and FP_CMP* macros gain an extra argument to specify when
exceptions should be set, 0 for no exception setting (I'm not sure
this is actually needed - at least it's not needed for IEEE operations
in glibc / libgcc, but might be relevant in some cases for kernel
use), 1 for exceptions only for signaling NaNs and 2 for exceptions
for all NaNs. This argument is handled through _FP_CMP_CHECK_NAN,
newly called by the _FP_CMP* macros when a NaN is encountered. Calls
to these macros are updated, which eliminates all the existing
checking and exception setting in soft-fp *.c files in glibc.
Tested for powerpc-nofpu. (The __unord* functions have no code
changes; the __eq* / __ge* / __le* functions get slightly larger, but
I don't think that's significant.)
* soft-fp/op-common.h (_FP_CMP_CHECK_NAN): New macro.
(_FP_CMP): Add extra argument EX. Call _FP_CMP_CHECK_NAN.
(_FP_CMP_EQ): Likewise.
(_FP_CMP_UNORD): Likewise.
* soft-fp/double.h (FP_CMP_D): Add extra argument EX.
(FP_CMP_EQ_D): Likewise.
(FP_CMP_UNORD_D): Likewise.
* soft-fp/extended.h (FP_CMP_E): Likewise.
(FP_CMP_EQ_E): Likewise.
(FP_CMP_UNORD_E): Likewise.
* soft-fp/quad.h (FP_CMP_Q): Likewise.
(FP_CMP_EQ_Q): Likewise.
(FP_CMP_UNORD_Q): Likewise.
* soft-fp/single.h (FP_CMP_S): Likewise.
(FP_CMP_EQ_S): Likewise.
(FP_CMP_UNORD_S): Likewise.
* soft-fp/eqdf2.c (__eqdf2): Update call to FP_CMP_EQ_D.
* soft-fp/eqsf2.c (__eqsf2): Update call to FP_CMP_EQ_S.
* soft-fp/eqtf2.c (__eqtf2): Update call to FP_CMP_EQ_Q.
* soft-fp/gedf2.c (__gedf2): Update call to FP_CMP_D.
* soft-fp/gesf2.c (__gesf2): Update call to FP_CMP_S.
* soft-fp/getf2.c (__getf2): Update call to FP_CMP_Q.
* soft-fp/ledf2.c (__ledf2): Update call to FP_CMP_D.
* soft-fp/lesf2.c (__lesf2): Update call to FP_CMP_S.
* soft-fp/letf2.c (__letf2): Update call to FP_CMP_Q.
* soft-fp/unorddf2.c (__unorddf2): Update call to FP_CMP_UNORD_D.
* soft-fp/unordsf2.c (__unordsf2): Update call to FP_CMP_UNORD_S.
* soft-fp/unordtf2.c (__unordtf2): Update call to FP_CMP_UNORD_Q.
* sysdeps/alpha/soft-fp/ots_cmpe.c (internal_compare): Update call
to FP_CMP_Q.
* sysdeps/sparc/sparc32/soft-fp/q_cmp.c (_Q_cmp): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc32/soft-fp/q_cmpe.c (_Q_cmpe): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_feq.c (_Q_feq): Update call to
FP_CMP_EQ_Q.
* sysdeps/sparc/sparc32/soft-fp/q_fge.c (_Q_fge): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc32/soft-fp/q_fgt.c (_Q_fgt): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_fle.c (_Q_fle): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_flt.c (_Q_flt): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_fne.c (_Q_fne): Update call to
FP_CMP_EQ_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_cmp.c (_Qp_cmp): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c (_Qp_cmpe): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_feq.c (_Qp_feq): Update call to
FP_CMP_EQ_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_fge.c (_Qp_fge): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_fgt.c (_Qp_fgt): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_fle.c (_Qp_fle): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_flt.c (_Qp_flt): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_fne.c (_Qp_fne): Update call to
FP_CMP_EQ_Q.
|
|
underflow if traps enabled.
This patch fixes a soft-fp corner case I previously noted in
<https://sourceware.org/ml/libc-alpha/2013-10/msg00349.html>: when
trapping on underflow is enabled, extensions of subnormals from XFmode
to TFmode need to signal underflow because the result is tiny (but
exact, so the underflow flag is not raised unless trapping is
enabled).
To avoid any excess initialization or tests for other cases of
floating-point extensions, a new FP_INIT_TRAPPING_EXCEPTIONS is added
that does the initialization required for this particular case (more
than FP_INIT_EXCEPTIONS, less than FP_INIT_ROUNDMODE, in general), and
FP_NO_EXACT_UNDERFLOW is added to stub out FP_TRAPPING_EXCEPTIONS
tests for those cases of extensions where the test would be dead code,
to avoid any uninitialized variable warnings.
As the relevant case only applies in libgcc, not to any use of soft-fp
in glibc, there is no bug report in Bugzilla and no non-default
definitions of FP_INIT_TRAPPING_EXCEPTIONS are added by the patch. A
testcase will be added to GCC as part of an update of soft-fp in
libgcc once this patch is in libc.
Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch. Bootstrapped GCC with updated
soft-fp with no regressions on x86_64-unknown-linux-gnu and verified
that a test of the relevant case passes where it failed before.
* soft-fp/op-common.h (FP_EXTEND): When a subnormal input produces
a subnormal result, set the underflow exception if trapping on
underflow is enabled.
* soft-fp/soft-fp.h (FP_INIT_TRAPPING_EXCEPTIONS): New macro.
(FP_INIT_EXCEPTIONS): Default to FP_INIT_TRAPPING_EXCEPTIONS.
[FP_NO_EXACT_UNDERFLOW] (FP_TRAPPING_EXCEPTIONS): Undefine and
redefine to 0.
* soft-fp/extenddftf2.c (FP_NO_EXACT_UNDERFLOW): Define.
* soft-fp/extendsfdf2.c (FP_NO_EXACT_UNDERFLOW): Likewise.
* soft-fp/extendsftf2.c (FP_NO_EXACT_UNDERFLOW): Likewise.
* soft-fp/extendxftf2.c (__extendxftf2): Use
FP_INIT_TRAPPING_EXCEPTIONS instead of FP_INIT_ROUNDMODE.
|
|
This patch fixes formatting of comments in soft-fp (in particular, the
normal style in glibc does not have a leading '*' on each line, and
comments should start with capital letters and end with ". */").
Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.
* soft-fp/extended.h: Fix comment formatting.
* soft-fp/op-1.h: Likewise.
* soft-fp/op-2.h: Likewise.
* soft-fp/op-4.h: Likewise.
* soft-fp/op-8.h: Likewise.
* soft-fp/op-common.h: Likewise.
* soft-fp/soft-fp.h: Likewise.
|
|
This patch corrects some soft-fp formatting that failed to follow the
GNU Coding Standards.
Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.
* soft-fp/op-common.h (_FP_TO_INT): Correct formatting.
|
|
In <https://sourceware.org/ml/libc-alpha/2013-06/msg00851.html>, I
fixed a bug caused by multiple soft-fp macros using the same variable
names, resulting in shadowing when one macro called another that used
the same variable name, with an argument involving the variable in the
outer macro. The fix was to rename the local variables so their names
included the containing macro name, to ensure uniqueness.
I noted then that this would make sense more systematically for all
variables in any soft-fp macro. Since then, I've used such variable
names in new soft-fp macros. This patch now converts existing macros
in extended.h and op-common.h to use this convention. (op-[1248].h
are intended to be converted separately.)
(Name conflicts could arise for label names as well, but because those
are function-scope in C any such conflict will give an immediate
compile error rather than a subtle bug, so there's no need for
preemptive renaming in that case.)
Tested for powerpc32 (soft-float) and mips64 that this makes no change
to the disassembly of installed shared libraries.
* soft-fp/extended.h (FP_UNPACK_RAW_E): Rename local variables to
include macro name.
(FP_UNPACK_RAW_EP): Likewise.
(FP_PACK_RAW_E): Likewise.
(FP_PACK_RAW_EP): Likewise.
* soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Likewise.
(_FP_ISSIGNAN): Likewise.
(_FP_ADD_INTERNAL): Likewise.
(_FP_FMA): Likewise.
(_FP_CMP): Likewise.
(_FP_SQRT): Likewise.
(_FP_TO_INT): Likewise.
(_FP_FROM_INT): Likewise.
(FP_EXTEND): Likewise.
(_FP_DIV_MEAT_N_loop): Likewise.
|
|
IEEE 754-2008 defines two ways in which tiny results can be detected,
"before rounding" (based on the infinite-precision result) and "after
rounding" (based on the result when rounded to normal precision as if
the exponent range were unbounded). All binary operations on an
architecture must use the same choice of how tininess is detected.
soft-fp has so far implemented only before-rounding tininess
detection. This patch adds support for after-rounding tininess
detection. A new macro _FP_TININESS_AFTER_ROUNDING is added that
sfp-machine.h must define (soft-fp is meant to be self-contained so
the existing tininess.h files aren't used here, though the information
going in sfp-machine.h has been taken from them). The soft-fp macros
dealing with raising underflow exceptions then handle the cases where
the choice matters specially, rounding a copy of the input to the
appropriate precision to see if a value that's tiny before rounding
isn't tiny after rounding.
Tested for mips64 using GCC trunk (which now uses soft-fp on MIPS, so
supporting exceptions and rounding modes for long double where not
previously supported - this is the immediate motivation for doing this
patch now) together with (a) a patch to sysdeps/mips/math-tests.h to
enable exceptions / rounding modes tests for long double for GCC 4.9
and later, and (b) corresponding changes applied to libgcc's soft-fp
and sfp-machine.h files. In the libgcc context this is also tested on
x86_64 (also an after-rounding architecture) with testcases for
__float128 that I intend to add to the GCC testsuite when updating
soft-fp there.
(To be clear: this patch does not fix any glibc bugs that were
user-visible in past releases, since after-rounding architectures
didn't use soft-fp in any affected case with support for
floating-point exceptions - so there is no corresponding Bugzilla bug.
Rather, it works together with the GCC changes to use soft-fp on MIPS
to allow previously absent long double functionality to work properly,
and allows soft-fp to be used in glibc on after-rounding architectures
in cases where it couldn't previously be used.)
* soft-fp/op-common.h (_FP_DECL): Mark exponent as possibly
unused.
(_FP_PACK_SEMIRAW): Determine tininess based on rounding shifted
value if _FP_TININESS_AFTER_ROUNDING and unrounded value is in
subnormal range.
(_FP_PACK_CANONICAL): Determine tininess based on rounding to
normal precision if _FP_TININESS_AFTER_ROUNDING and unrounded
value has largest subnormal exponent.
* soft-fp/soft-fp.h [FP_NO_EXCEPTIONS]
(_FP_TININESS_AFTER_ROUNDING): Undefine and redefine to 0.
* sysdeps/aarch64/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): New macro.
* sysdeps/alpha/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/arm/soft-fp/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
Likewise.
* sysdeps/mips/mips64/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/mips/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/powerpc/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/sh/soft-fp/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
Likewise.
* sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/tile/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[BZ #15442] This adds support for the inverse interpretation of the
quiet bit of IEEE 754 floating-point NaN data that some processors
use. This includes in particular MIPS architecture processors; the
payload used for the canonical qNaN encoding is updated accordingly
so as not to interfere with the quiet bit.
|
|
|
|
|
|
Seen in, e.g. ports/sysdeps/alpha/soft-fp/ots_mul.c.
The problem here is we have a switch on the class of X*Y, followed by
a switch on the class of R. The exponent field of R really is not set
by the first switch for NaN outputs, because we know it's not going to
be used. The compiler is not smart enough to see through this.
By pulling the exponent computation out of the NORMAL*NORMAL path, we
will not be pessimizing the most common case, while still providing an
arbitrary value to satisfy the compiler.
|
|
|
|
|
|
* soft-fp/soft-fp.h (FP_CUR_EXCEPTIONS): Define.
(FP_TRAPPING_EXCEPTIONS): Provide default implementation.
* sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
(FP_TRAPPING_EXCEPTIONS): Define.
* sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
(FP_TRAPPING_EXCEPTIONS): Define.
* soft-fp/op-common.h (_FP_PACK_SEMIRAW): Signal underflow for
subnormals only when inexact has been signalled or underflow
exceptions are enabled.
(_FP_PACK_CANONICAL): Likewise.
|
|
|