From: Robert Suchanek <robert.sucha...@imgtec.com> Cherry-picked 4194c529fade9b3106d118cac63b71bc8b13f7be from https://github.com/MIPS/gcc
Signed-off-by: Robert Suchanek <robert.sucha...@imgtec.com> Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com> Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com> --- gcc/config/mips/mips.cc | 8 +++++++- gcc/config/mips/mips.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index 3185fa9633e..cd4bce71ae8 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -9631,7 +9631,13 @@ mips_expand_block_move (rtx dest, rtx src, rtx length, rtx alignment) { if (ISA_HAS_COPY) return mips16_expand_copy (dest, src, length, alignment); - else if (INTVAL (length) <= MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER) + else if (INTVAL (length) <= MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER + /* We increase slightly the maximum number of bytes in + a straight-line block if the source and destination + are aligned to the register width. */ + || (!optimize_size + && INTVAL (alignment) == UNITS_PER_WORD + && INTVAL (length) <= MIPS_MAX_MOVE_MEM_STRAIGHT)) { mips_block_move_straight (dest, src, INTVAL (length), INTVAL (alignment)); diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index efd23a262f9..0245287f9bf 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3171,6 +3171,11 @@ while (0) #define MIPS_MAX_MOVE_BYTES_STRAIGHT \ (MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER * 2) +/* The maximum number of bytes that can be copied by any expanded block move; + see mips_expand_block_move. */ +#define MIPS_MAX_MOVE_MEM_STRAIGHT \ + (MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER * 3) + /* The base cost of a memcpy call, for MOVE_RATIO and friends. These values were determined experimentally by benchmarking with CSiBE. In theory, the call overhead is higher for TARGET_ABICALLS (especially -- 2.34.1