[PATCH] Optimize abs(x) < 0.0

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Jul 22 10:24:00 GMT 2002


Richard Henderson <rth@redhat.com> writes:

| On Mon, Jul 22, 2002 at 09:34:03AM +0200, Gabriel Dos Reis wrote:
| > Then, what does GCC return for fabs(x) when x is a signaling NaN?
| 
| An SNaN with the sign bit clear.

Therefore the expression fabs(x) < 0.0 may trap. 

Removing that expression in the proposed transformation changes
that behaviour.  

The proposed transformation doesn't preserve semantics in presence
of signaling NaNs. I suggest it to be applied only either unsafe-math
or say -fno-nan-values or whatever.

-- Gaby



More information about the Gcc-patches mailing list