[PATCH] Negation related constant folding improvements
Roger Sayle
roger@eyesopen.com
Tue Aug 12 00:29:00 GMT 2003
On Mon, 11 Aug 2003, Richard Henderson wrote:
> On Sun, Aug 10, 2003 at 10:04:31PM -0600, Roger Sayle wrote:
> > case INTEGER_CST:
> > - case REAL_CST:
> > if (! TREE_UNSIGNED (type)
> > && 0 != (tem = fold (build1 (NEGATE_EXPR, type, t)))
> > && ! TREE_OVERFLOW (tem))
> > return tem;
> > break;
> >
> > + case REAL_CST:
> > + return fold (build1 (NEGATE_EXPR, type, t));
>
> This is correct only if the fp representation is sign+magnitude.
> This is not true of the C4X format.
>
> Rounding problem pointed out upthread.
I'm currently regression testing a fix for the sign dependent rounding
problem based upon HONOR_SIGN_DEPENDENT_ROUNDING.
However, I'm looking for a convenient way to disable these optimizations
on processors that don't have the sign+magnitude floating point format
required by many language standards. I'd rather disable the optimization
on non-friendly FP hardware, than slow down everyone else by testing
whether a floating point constant can be negated in negate_expr_p.
Is there a target macro that can be used? Otherwise, I'll have to come
up with an API to expose struct real_format's signbit field for a given
RTL mode.
Roger
--
More information about the Gcc-patches
mailing list