This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] BZ#2423 Errors in long double (ldbl-128ibm) rounding functions in glibc-2.4
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Steven Munroe <munroesj at us dot ibm dot com>
- Cc: libc-alpha at sources dot redhat dot com, Dwayne McConnell <decimal at us dot ibm dot com>, Alan Modra <amodra at bigpond dot net dot au>
- Date: Tue, 7 Mar 2006 09:20:56 +0100
- Subject: Re: [PATCH] BZ#2423 Errors in long double (ldbl-128ibm) rounding functions in glibc-2.4
- References: <440CA551.4090507@us.ibm.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Mar 06, 2006 at 03:10:41PM -0600, Steven Munroe wrote:
> diff -urN libc24-cvstip-20060302/sysdeps/powerpc/fpu/fenv_libc.h libc24/sysdeps/powerpc/fpu/fenv_libc.h
> --- libc24-cvstip-20060302/sysdeps/powerpc/fpu/fenv_libc.h 2001-07-05 23:56:02.000000000 -0500
> +++ libc24/sysdeps/powerpc/fpu/fenv_libc.h 2006-03-03 14:33:43.000000000 -0600
> @@ -1,5 +1,5 @@
> /* Internal libc stuff for floating point environment routines.
> - Copyright (C) 1997 Free Software Foundation, Inc.
> + Copyright (C) 1997, 2006 Free Software Foundation, Inc.
> This file is part of the GNU C Library.
>
> The GNU C Library is free software; you can redistribute it and/or
> @@ -54,6 +54,41 @@
> unsigned int l[2];
> } fenv_union_t;
>
> +
> +static inline int
> +__fegetround (void)
> +{
> + int result;
> + asm ("mcrfs 7,7\n\t"
> + "mfcr %0" : "=r"(result) : : "cr7");
> + return result & 3;
> +}
> +#define fegetround() __fegetround()
I'd say you want the above asm volatile. See
http://sources.redhat.com/ml/libc-hacker/2006-02/msg00015.html
Jakub