This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC][PATCH] MIPS: IEEE 754-2008 NaN encoding support
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: <libc-ports at sourceware dot org>, <libc-alpha at sourceware dot org>, Doug Gilmore <Doug dot Gilmore at imgtec dot com>
- Date: Fri, 23 Aug 2013 15:26:49 +0000
- Subject: Re: [RFC][PATCH] MIPS: IEEE 754-2008 NaN encoding support
- References: <alpine dot DEB dot 1 dot 10 dot 1308222343480 dot 8514 at tp dot orcam dot me dot uk>
On Fri, 23 Aug 2013, Maciej W. Rozycki wrote:
> Finally a new name has been defined for the dynamic linker so that
> 2008-NaN and legacy-NaN binaries can coexist on a single system that
> supports dual-mode operation and that a legacy dynamic linker that
> does not support verifying the 2008-NaN ELF file header flag is not
> chosen to interpret a 2008-NaN binary by accident.
Adding a new name is the correct thing to do, but it means you need to
update ports/sysdeps/unix/sysv/linux/mips/{configure.in,Makefile} to
reflect that there are now twelve rather than six ABI variants that one or
more generated installed header needs to reflect - as in ../arm/Makefile,
you will need to set the *-ld-soname variables for each of the twelve
ABIs, so that gnu/lib-names.h is correct for all the variants.
(gnu/lib-names.h will only depend on the NaN encoding in fact,
bits/syscall.h only on whether the ABI is o32, n32 or n64, and gnu/stubs.h
on both whether the ABI is o32, n32 or n64 and whether it's hard or soft
float. But the build system doesn't do anything special regarding headers
depending only on a subset of ABI information like that; the twelve ABIs
will just be treated as completely distinct for that purpose.)
> Index: glibc-fsf-trunk-quilt/ports/sysdeps/mips/fpu/fesetenv.c
> ===================================================================
> --- glibc-fsf-trunk-quilt.orig/ports/sysdeps/mips/fpu/fesetenv.c 2013-05-16 18:17:13.000000000 +0100
> +++ glibc-fsf-trunk-quilt/ports/sysdeps/mips/fpu/fesetenv.c 2013-08-22 10:32:05.447640501 +0100
I don't see why you need changes here. If someone has somehow created an
fenv_t value with an inappropriate NAN2008 bit, that's definitely outside
the scope of what gives defined behavior - such values should only come
from other functions such as fegetenv (or the standard values defined in
fenv.h).
> /* The fdlibm code requires strict IEEE double precision arithmetic,
> and no interrupts for exceptions, rounding to nearest. */
> -
> +#ifdef __mips_nan2008
> +#define _FPU_DEFAULT 0x00040000
> +#else
> #define _FPU_DEFAULT 0x00000000
> +#endif
>
> -/* IEEE: same as above, but exceptions */
> +/* IEEE: same as above, but exceptions. */
> +#ifdef __mips_nan2008
> +#define _FPU_IEEE 0x00040F80
> +#else
> #define _FPU_IEEE 0x00000F80
> +#endif
"# define" indentation inside #if.
--
Joseph S. Myers
joseph@codesourcery.com