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


Roger,

> Then having made heavy use of negate_expr_p and negate, I thought
> it best to add support optimizing negation of multiplications and
> divisions.  These operations may be efficiently negated by negating
> either of their operands, so -(X*C) is conveniently implemented as
> X*(-C) for a constant value, C.  Similarly, -(X/C) is X/(-C) and
> -(C/X) is (-C)/X.

I believe this part is not correct for IEEE arithmetic, if you consider
rounding modes towards some infinity.
I don't have the impression that your patch checks for this, but
at least the explanation doesn't mention this.
Can you double check ?

-- 
Sylvain


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