This is the mail archive of the
mailing list for the GCC project.
Re: Draft "Unsafe fp optimizations" project description.
- To: "Toon Moene" <toon at moene dot indiv dot nluug dot nl>, <dewar at gnat dot com>
- Subject: Re: Draft "Unsafe fp optimizations" project description.
- From: "Tim Prince" <tprince at computer dot org>
- Date: Sat, 4 Aug 2001 09:34:02 -0700
- Cc: <gcc at gcc dot gnu dot org>, <lucier at math dot purdue dot edu>
- References: <20010804134535.DDEF3F2B6C@nile.gnat.com> <3B6C1279.C73F3F1B@moene.indiv.nluug.nl>
----- Original Message -----
From: "Toon Moene" <email@example.com>
Cc: <firstname.lastname@example.org>; <email@example.com>
Sent: Saturday, August 04, 2001 8:19 AM
Subject: Re: Draft "Unsafe fp optimizations" project description.
> firstname.lastname@example.org wrote:
> > Some comments
> Thanks !
I want to thank Toon for undertaking this. It looks like a good start
toward filling in a deficiency which many compilers share. Most
compilers leave it up to the individual to find out what they do in this
area, how to control it, and spring surprises with new releases.
One of my original reasons for provoking this discussion was my hope of
dealing with the need to conform with C and Fortran standards, which
require re-association to be preventable by parentheses, even though
optimizations such as -ffast-math are in effect. According to my
understanding, it is not feasible to guarantee that gcc will do this,
and thus I believed it important to have additional sub-options
under -ffast-math which would turn off individual types of alterations,
such as those which re-arrange division in a way which could produce
I think that, strictly speaking, A/B -> A*(1/B) should not occur by
default under -ffast-math, as writing (A/B) could never suffice to
prevent it. Such a position, though justifiable, would be contrary to
long standing practice and would make it quite difficult to obtain good
performance with code which was not written with optimization in mind.
So, I don't have a position on it other than to wish for a documented
provision to control whether it happens, without disabling all
other -ffast-math treatments.
> The problem is: What constitutes a surprise ? If I ask for "force
> denormals to zero" I know that I might run into a divide-by-zero
> so I do not think of that as a surprise. To make it "not-a-surprise"
> anyone, it should be documented.
Instituting abrupt underflow also avoids, on an an otherwise
IEEE-compliant system, the possibility of unexpected overflow in the
replacement A/B -> A*(1/B) . Old-fashioned code which checks for a zero
value before dividing comes back to working order. Not to mention the
totally unexpected abysmal performance when moving to a system which
lacks hardware support for de-normalized storage.