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 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.
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.
Continuing the soft-fp variable renaming from
<https://sourceware.org/ml/libc-alpha/2014-06/msg00434.html> to avoid
shadowing if two macros happen to use the same variable name and that
variable is involved in an argument one of those macros passes to
another, this patch renames variables in op-[1248].h. (The two
patches are to different files and are independent of each other.)
Tested for powerpc32 (soft-float) and mips64 that this makes no change
to the disassembly of installed shared libraries.
* soft-fp/op-1.h (_FP_UNPACK_RAW_1): Rename local variables to
include macro name.
(_FP_UNPACK_RAW_1_P): Likewise.
(_FP_PACK_RAW_1): Likewise.
(_FP_PACK_RAW_1_P): Likewise.
(_FP_MUL_MEAT_1_wide): Likewise.
(_FP_MUL_MEAT_DW_1_hard): Likewise.
(_FP_MUL_MEAT_1_hard): Likewise.
(_FP_DIV_MEAT_1_imm): Likewise.
(_FP_DIV_MEAT_1_udiv_norm): Likewise.
(_FP_DIV_MEAT_1_udiv): Likewise.
* soft-fp/op-2.h (__FP_FRAC_DEC_2): Likewise.
(_FP_UNPACK_RAW_2): Likewise.
(_FP_UNPACK_RAW_2_P): Likewise.
(_FP_PACK_RAW_2): Likewise.
(_FP_PACK_RAW_2_P): Likewise.
(_FP_MUL_MEAT_DW_2_wide): Likewise.
(_FP_MUL_MEAT_2_wide): Likewise.
(_FP_MUL_MEAT_DW_2_wide_3mul): Likewise.
(_FP_MUL_MEAT_2_wide_3mul): Likewise.
(_FP_MUL_MEAT_DW_2_gmp): Likewise.
(_FP_MUL_MEAT_2_gmp): Likewise.
(_FP_DIV_MEAT_2_udiv): Likewise.
* soft-fp/op-4.h (_FP_FRAC_SLL_4): Likewise.
(_FP_FRAC_SRL_4): Likewise.
(_FP_FRAC_SRST_4): Likewise.
(_FP_FRAC_SRS_4): Likewise.
(_FP_UNPACK_RAW_4): Likewise.
(_FP_UNPACK_RAW_4_P): Likewise.
(_FP_PACK_RAW_4): Likewise.
(_FP_PACK_RAW_4_P): Likewise.
(_FP_MUL_MEAT_DW_4_wide): Likewise.
(_FP_MUL_MEAT_4_wide): Likewise.
(_FP_MUL_MEAT_4_gmp): Likewise.
(umul_ppppmnnn): Likewise.
(_FP_DIV_MEAT_4_udiv): Likewise.
(__FP_FRAC_ADD_4): Likewise.
(__FP_FRAC_SUB_3): Likewise.
(__FP_FRAC_SUB_4): Likewise.
(__FP_FRAC_DEC_3): Likewise.
(__FP_FRAC_DEC_4): Likewise.
(__FP_FRAC_ADDI_4): Likewise.
* soft-fp/op-8.h (_FP_FRAC_SLL_8): Likewise.
(_FP_FRAC_SRL_8): Likewise.
(_FP_FRAC_SRS_8): Likewise.
with setting the sticky bit.
* math/test-misc.c (main): Add more truncation tests.
* soft-fp/floatunsidf.c (__floatunsidf): Use DFtype instead of
double in the function declaration.
* soft-fp/floatundidf.c (__floatundidf): Use DFtype instead of
double in the function declaration.
* soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
float in the function declaration.
* soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
float in the function declaration.
* soft-fp/extended.h (FP_UNPACK_RAW_E): Do not increase X##_e for
denormal operands. Do not generate FP_EX_DENORM exception.
(FP_UNPACK_RAW_EP): Ditto.
(FP_UNPACK_SEMIRAW_E): Use FP_UNPACK_RAW_E instead of
undefined _FP_UNPACK_RAW_E.
(FP_UNPACK_SEMIRAW_EP): Use FP_UNPACK_RAW_EP instead of
undefined _FP_UNPACK_RAW_EP.
(FP_PACK_SEMIRAW_E): Use FP_PACK_RAW_E instead of
undefined _FP_PACK_RAW_E.
(FP_PACK_SEMIRAW_EP): Use FP_PACK_RAW_EP instead of
undefined _FP_PACK_RAW_EP.
* op-2.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_2.
* op-4.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_4.
* soft-fp/op-common.h (FP_EXTEND): Do not abort when
_FP_EXPBIAS_##dfs == _FP_EXPBIAS_##sfs. Handle denormals for
this case.
* soft-fp/op-common.h (FP_TRUNC): Ditto.
* soft-fp/op-common.h (FP_TRUNC): Replace raising of FP_EX_INEXACT
with setting the sticky bit.
* math/test-misc.c (main): Add more truncation tests.
2007-04-14 Uros Bizjak <ubizjak@gmail.com>
* soft-fp/floatunsidf.c (__floatunsidf): Use DFtype instead of
double in the function declaration.
* soft-fp/floatundidf.c (__floatundidf): Use DFtype instead of
double in the function declaration.
* soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
float in the function declaration.
* soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
float in the function declaration.
* soft-fp/extended.h (FP_UNPACK_RAW_E): Do not increase X##_e for
denormal operands. Do not generate FP_EX_DENORM exception.
(FP_UNPACK_RAW_EP): Ditto.
(FP_UNPACK_SEMIRAW_E): Use FP_UNPACK_RAW_E instead of
undefined _FP_UNPACK_RAW_E.
(FP_UNPACK_SEMIRAW_EP): Use FP_UNPACK_RAW_EP instead of
undefined _FP_UNPACK_RAW_EP.
(FP_PACK_SEMIRAW_E): Use FP_PACK_RAW_E instead of
undefined _FP_PACK_RAW_E.
(FP_PACK_SEMIRAW_EP): Use FP_PACK_RAW_EP instead of
undefined _FP_PACK_RAW_EP.
* op-2.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_2.
* op-4.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_4.
2007-04-16 Uros Bizjak <ubizjak@gmail.com>
Jakub Jelinek <jakub@redhat.com>
* soft-fp/op-common.h (FP_EXTEND): Do not abort when
_FP_EXPBIAS_##dfs == _FP_EXPBIAS_##sfs. Handle denormals for
this case.
* soft-fp/op-common.h (FP_TRUNC): Ditto.
2007-05-03 Jakub Jelinek <jakub@redhat.com>
2002-05-17 David S. Miller <davem@redhat.com>
* sysdeps/unix/sysv/linux/sparc/fork.S: Define _internal aliases.
2002-05-16 David S. Miller <davem@redhat.com>
* sysdeps/sparc/sparc32/dl-machine.h (LOAD_PIC_REG): Define.
(elf_machine_dynamic): Use it to force PIC register to be loaded.
(elf_machine_load_address): Likewise.
* sysdeps/sparc/sparc64/dl-machine.h: Mirror sparc32 changes.
* sysdeps/sparc/sparc64/strncmp.S: When second argument pointer
is unaligned, do not forget to fully initialize %g1 magic value.
* sysdeps/unix/sysv/linux/sparc/sys/procfs.h: Fix 64-bit elf
register definitions and provide 32-bit variants of structures
during 64-bit builds.
* soft-fp/op-1.h (_FP_FRAC_CLEAR_OVERP_1): Define.
* soft-fp/op-2.h (_FP_FRAC_CLEAR_OVERP_2): Define.
* soft-fp/op-4.h (_FP_FRAC_CLEAR_OVERP_4): Define.
* soft-fp/op-common.h (_FP_PACK_CANONICAL): After rounding, if
_FP_FRAC_OVERP_X is set, use _FP_FRAC_CLEAR_OVERP_X to clear it.
(_FP_FROM_INT): Perform right shifts on unsigned integer type.
Do not clear implicit one bit here, it must be done post-rounding.
Only pad to the left using left shift if value uses less than the
available fractional bits.
2001-07-06 Paul Eggert <eggert@twinsun.com>
* manual/argp.texi: Remove ignored LGPL copyright notice; it's
not appropriate for documentation anyway.
* manual/libc-texinfo.sh: "Library General Public License" ->
"Lesser General Public License".
2001-07-06 Andreas Jaeger <aj@suse.de>
* All files under GPL/LGPL version 2: Place under LGPL version
2.1.
1999-12-29 Ulrich Drepper <drepper@cygnus.com>
* soft-fp/*: Tons of new files to implement floating-point arithmetic
in software.
Contributed by Richard Henderson, Jakub Jelinek and others.