diff options
author | Richard Henderson <rth@redhat.com> | 2016-03-02 13:09:54 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2016-03-02 13:09:54 -0800 |
commit | 08c1904dccf3073bd93f154f5eefdd2d33bc273b (patch) | |
tree | baae125ee96286848093048fcb31ae88608f9fe0 /gcc | |
parent | 82ee0cf2f7e46ef7ebc67fb770587c9a2bbafd3b (diff) | |
download | gcc-08c1904dccf3073bd93f154f5eefdd2d33bc273b.zip gcc-08c1904dccf3073bd93f154f5eefdd2d33bc273b.tar.gz gcc-08c1904dccf3073bd93f154f5eefdd2d33bc273b.tar.bz2 |
re PR rtl-optimization/67145 (associativity from pseudo-reg ordering)
PR rtl-opt/67145
* simplify-rtx.c (simplify_plus_minus): Allow reassoc without
simplification when all args are positive non-fixed registers.
From-SVN: r233916
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/simplify-rtx.c | 22 |
2 files changed, 26 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a37ecbd..2adcc5f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-03-02 Richard Henderson <rth@redhat.com> + + PR rtl-opt/67145 + * simplify-rtx.c (simplify_plus_minus): Allow reassoc without + simplification when all args are positive non-fixed registers. + 2016-03-02 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * target.def (lra_p): Specify that new ports should use LRA. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 450fa8b..e1a0319 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -4421,9 +4421,26 @@ simplify_plus_minus (enum rtx_code code, machine_mode mode, rtx op0, n_ops = i; } - /* If nothing changed, fail. */ + /* If nothing changed, check that rematerialization of rtl instructions + is still required. */ if (!canonicalized) - return NULL_RTX; + { + /* Perform rematerialization if only all operands are registers and + all operations are PLUS. */ + /* ??? Also disallow (non-global, non-frame) fixed registers to work + around rs6000 and how it uses the CA register. See PR67145. */ + for (i = 0; i < n_ops; i++) + if (ops[i].neg + || !REG_P (ops[i].op) + || (REGNO (ops[i].op) < FIRST_PSEUDO_REGISTER + && fixed_regs[REGNO (ops[i].op)] + && !global_regs[REGNO (ops[i].op)] + && ops[i].op != frame_pointer_rtx + && ops[i].op != arg_pointer_rtx + && ops[i].op != stack_pointer_rtx)) + return NULL_RTX; + goto gen_result; + } /* Create (minus -C X) instead of (neg (const (plus X C))). */ if (n_ops == 2 @@ -4465,6 +4482,7 @@ simplify_plus_minus (enum rtx_code code, machine_mode mode, rtx op0, } /* Now make the result by performing the requested operations. */ + gen_result: result = ops[0].op; for (i = 1; i < n_ops; i++) result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS, |