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] for PR18942


Hello,

> My personal preference would be to avoid the nested conditional and
> instead write this as
> 
>   /* (eq/ne (plus x c1) c2) simplifies to (eq/ne x (c2 - c1)).  */
>   if ((code == EQ || code == NE)
>       && CONSTANT_P (op1)
>       && GET_CODE (op0) == PLUS
>       && CONSTANT_P (XEXP (op0, 1)))
>     {
>       rtx c = XEXP (op0, 1);
>       ...
> 
> 
> Then finally this transformation can also be generalized to handle the
> MINUS case as well, i.e. "(x - C1) == C2" -> "x == (C2 + C1)".

I thought we canonicalize (minus x cst) to (plus x (-cst))? Although I
cannot find it anywhere just now.

Zdenek


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