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:
> Now, if we start with -~(x, 5) then first we fold that to -(x, -5) and
> leave it this way.

No, we won't because (x, 5) is not "negatable" (because 5 is negatable
but 5 is not).  I'm speaking of negate_expr, not fold_unary.

fold_unary() ... case CONJ_EXPR: if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE) return fold_convert (type, arg0); if (TREE_CODE (arg0) == COMPLEX_EXPR) { tree itype = TREE_TYPE (type); tree rpart = fold_convert (itype, TREE_OPERAND (arg0, 0)); tree ipart = fold_convert (itype, TREE_OPERAND (arg0, 1)); return fold_build2 (COMPLEX_EXPR, type, rpart, negate_expr (ipart)); }

and negate_expr falls back to build1 (NEGATE_EXPR,...).

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

Again, we won't do the initial folding in negate_expr.

Paolo



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