This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The perennial i386 floating-point rounding issue...


On 07-Jun-2002, Zack Weinberg <zack@codesourcery.com> wrote:
> I believe I saw this go by again just a few days back, but I can't
> find it anymore.  Anyhow, while digging through C99 for something else
> I found this paragraph:
> 
> 5.1.2.3p12 
>   EXAMPLE 4 Implementations employing wide registers have to take care
>   to honor appropriate semantics.  Values are independent of whether
>   they are represented in a register or in memory. For example, an
>   implicit spilling of a register is not permitted to alter the value.
> 
> This sure sounds like we are required to do 80-bit spills, if we use
> the extended precision mode.

Nope, that's not what it means.

This non-normative example is in a section saying that the implemented
semantics must match the C standard's abstract semantics.  That's
all this section says, really.  (It's the "as if" rule.)

The implementation is permitted to use extended precision mode
and not do 80-bit spills, provided that it meets the requirements
of the standard, e.g. that the value of a variable does not change
implicitly.  So live-range splitting of local variables with
type `double' might be ruled out, if it means the value of the
local variables would change spontaneously.  But using extended precision
for intermediate expression results is fine, because this is permitted
by the C standard's abstract semantics:

 |        5.2.4.2.2  Characteristics of floating types <float.h>
 | 
 |        [#7] The values of operations  with  floating  operands  and
 |        values  subject  to  the usual arithmetic conversions and of
 |        floating constants are evaluated to a format whose range and
 |        precision may be greater than required by the type.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]