https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128440
mateuszb at poczta dot onet.pl changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mateuszb at poczta dot onet.pl
--- Comment #8 from mateuszb at poczta dot onet.pl ---
For the move "backwards" starting from SRC + SIZE we must start from the last
byte of "remainder" bytes and finish with copy in chunks as large as alignment
permits in "backwards" order.
1) code:
/* Emit the "backwards" unrolled loop. */
emit_move_loop (src, dst, mode, (size_bytes - inc), -inc, iters,
remainder);
should be replaced by:
/* Emit the "backwards" unrolled loop. */
emit_move_loop (src, dst, mode, size_bytes, -inc, iters, remainder);
2) in:
static void
emit_move_loop (rtx src, rtx dst, machine_mode mode, int offset, int inc,
unsigned iters, unsigned remainder)
for memmove "backwards" (inc < 0) we should start with:
if (remainder & 1)
{
offset -= 1;
remainder -= 1;
emit_insn (gen_rtx_SET (adjust_address (dst, QImode, offset),
adjust_address (src, QImode, offset)));
}
and so on for 2 and 4 until:
for (unsigned int i = 0; i < iters; i++)
{
offset += inc;
emit_insn (gen_rtx_SET (adjust_address (dst, mode, offset),
adjust_address (src, mode, offset)));
}