This is the mail archive of the gcc-patches@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: [PATCH] Negation related constant folding improvements


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
--


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