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]: Handle CONJ_EXPR in negate_expr_p and fold_negate_expr


On 2/5/07, Paolo Bonzini <paolo.bonzini@lu.unisi.ch> wrote:
Kaveh R. GHAZI wrote:
> This patch handles CONJ_EXPR in negate_expr_p and fold_negate_expr.
> (A CONJ_EXPR is negatable if its operand is negatable.)

I would say that, if its argument is a COMPLEX_EXPR, a CONJ_EXPR is
negatable even if its imaginary part is non-negatable (but the real part
is); in that case we can fold the negation by negating the real part and
leaving the imaginary part unmodified.

For example, (a,b) + -~(x,5) would change to (a,b) + (-x,5) which is
wrong; but (a,b) + -~(5,x) would change to (a,b) + (-5,x) which is ok.

The patch does fold -~z to ~-z which is ok, can you elaborate why -~(x,5) -> (-x,5) is wrong? (it wouldn't do that, beause negate_expr_p will return false for (x,5))

Richard.


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