diff options
author | dje <dje@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-01-21 17:15:54 +0000 |
---|---|---|
committer | dje <dje@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-01-21 17:15:54 +0000 |
commit | 20634b96b076063bc5f7cc35ff5f24a945252c23 (patch) | |
tree | f46252d0d92d72617c4cff7d3bf736a77fdfb44f /gcc/reload1.c | |
parent | e25e239d5ce58c63fdbdd4728c8377031928a111 (diff) | |
download | ppe42-gcc-20634b96b076063bc5f7cc35ff5f24a945252c23.tar.gz ppe42-gcc-20634b96b076063bc5f7cc35ff5f24a945252c23.zip |
* reload1.c (eliminate_regs, case MINUS): Canonicalize
(minus (plus reg const) reg) to (plus (minus reg reg) const).
* reload.c (find_reloads_address): Treat (plus (minus reg reg) const)
the same as (plus (plus reg reg) const).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r-- | gcc/reload1.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c index b5e9394550e..d4f21408954 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -2853,7 +2853,7 @@ eliminate_regs (x, mem_mode, insn) context. If we have (plus (eliminable) (reg)), we want to produce - (plus (plus (replacement) (reg) (const))). If this was part of a + (plus (plus (replacement) (reg)) (const)). If this was part of a normal add insn, (plus (replacement) (reg)) will be pushed as a reload. This is the desired action. */ @@ -2892,6 +2892,28 @@ eliminate_regs (x, mem_mode, insn) } return x; + case MINUS: + /* If we have (minus (eliminable) (reg)), we want to produce + (plus (minus (replacement) (reg)) (const)). The main reason being + to be consistent with what is done for PLUS. find_reloads_address + assumes that we do this. */ + { + rtx new0 = eliminate_regs (XEXP (x, 0), mem_mode, insn); + rtx new1 = eliminate_regs (XEXP (x, 1), mem_mode, insn); + + if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1)) + { + if (GET_CODE (new0) == PLUS) + return gen_rtx (PLUS, GET_MODE (x), + gen_rtx (MINUS, GET_MODE (x), + XEXP (new0, 0), new1), + XEXP (new0, 1)); + else + return gen_rtx (MINUS, GET_MODE (x), new0, new1); + } + } + return x; + case MULT: /* If this is the product of an eliminable register and a constant, apply the distribute law and move the constant out @@ -2920,7 +2942,6 @@ eliminate_regs (x, mem_mode, insn) case CALL: case COMPARE: - case MINUS: case DIV: case UDIV: case MOD: case UMOD: case AND: case IOR: case XOR: |