diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2019-07-01 17:15:41 +0200 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2019-07-01 17:15:41 +0200 |
commit | b94eec3beaf19d2bace6f4f2018d9e0bd1981f56 (patch) | |
tree | 0b7ddf6017519fecd267146cbf9d0b6c304299f0 /gcc | |
parent | d5c15d688abd1aca27202e690cc13f686051c116 (diff) | |
download | gcc-b94eec3beaf19d2bace6f4f2018d9e0bd1981f56.zip gcc-b94eec3beaf19d2bace6f4f2018d9e0bd1981f56.tar.gz gcc-b94eec3beaf19d2bace6f4f2018d9e0bd1981f56.tar.bz2 |
rs6000: Improve indexed addressing
The function rs6000_force_indexed_or_indirect_mem makes a memory
operand suitable for indexed (or indirect) addressing. If the memory
address isn't yet valid, it loads the whole thing into a register to
make it valid. That isn't optimal. This changes it to load an
address that is the sum of two things into two registers instead.
This results in lower latency code, and if inside loops, a constant
term can be moved outside the loop.
* config/rs6000/rs6000.c (rs6000_force_indexed_or_indirect_mem):
Load both operands of a PLUS into registers separately.
From-SVN: r272886
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1acb4a3..868ac76 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-07-01 Segher Boessenkool <segher@kernel.crashing.org> + + * config/rs6000/rs6000.c (rs6000_force_indexed_or_indirect_mem): + Load both operands of a PLUS into registers separately. + 2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com> * config/s390/vector.md: Fix shift count operand printing. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5e80673..f59f3a9 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -32100,7 +32100,16 @@ rs6000_force_indexed_or_indirect_mem (rtx x) addr = reg; } - x = replace_equiv_address (x, force_reg (Pmode, addr)); + if (GET_CODE (addr) == PLUS) + { + rtx op0 = XEXP (addr, 0); + rtx op1 = XEXP (addr, 1); + op0 = force_reg (Pmode, op0); + op1 = force_reg (Pmode, op1); + x = replace_equiv_address (x, gen_rtx_PLUS (Pmode, op0, op1)); + } + else + x = replace_equiv_address (x, force_reg (Pmode, addr)); } return x; |