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] | |
I am not sure I understand this. I tried doing this. If I add -1 and rhs1 for the NEGATE_EXPR to ops list, when it come to rewrite_expr_tree constant will be sorted early and would make it hard to generate: x + (-y * z * z) => x - y * z * z Do you want to swap the constant in MULT_EXPR chain (if present) like in swap_ops_for_binary_stmt and then create a NEGATE_EXPR ?In addition to linearize_expr handling you need to handle a -1 in the MULT_EXPR chain specially at rewrite_expr_tree time by emitting a NEGATE_EXPR instead of a MULT_EXPR (which also means you should sort the -1 "last").
Hi Richard, Thanks. Here is an attempt which does this.Regression tested and bootstrapped on x86-64-linux-gnu with no new regressions.
Is this OK for trunk? Thanks, Kugan 2016-04-23 Kugan Vivekanandarajah <kuganv@linaro.org> PR middle-end/40921 * gcc.dg/tree-ssa/pr40921.c: New test. gcc/ChangeLog: 2016-04-23 Kugan Vivekanandarajah <kuganv@linaro.org> PR middle-end/40921 * tree-ssa-reassoc.c (try_special_add_to_ops): New. (linearize_expr_tree): Call try_special_add_to_ops. (reassociate_bb): Convert MULT_EXPR by (-1) to NEGATE_EXPR.
Attachment:
p.txt
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |