Commit b94eec3b by Segher Boessenkool Committed by Segher Boessenkool

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
parent d5c15d68
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> 2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/vector.md: Fix shift count operand printing. * config/s390/vector.md: Fix shift count operand printing.
......
...@@ -32100,7 +32100,16 @@ rs6000_force_indexed_or_indirect_mem (rtx x) ...@@ -32100,7 +32100,16 @@ rs6000_force_indexed_or_indirect_mem (rtx x)
addr = reg; 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; return x;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment