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:

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

For the same reason which Kaveh explained in his previous patch.

Now, if we start with -~(x, 5) then first we fold that to -(x, -5) and leave it this way. If we start with -~(5,x) we fold this to -(5,-x) (maybe questionable, see fold_unary of CONJ_EXPR) and then to (-5,x). I think both are ok. (The wrong folding won't occur with the patch posted)

Richard.


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