From: Matthew Fortune <matthew.fort...@imgtec.com> Expose it with an option: -mblockmov-limit. A memcpy strictly less than this value will be considered for inlining.
gcc/ChangeLog: * config/mips/mips.cc (mips_expand_block_move): Add support to control size of inlined memcpy. * config/mips/mips.opt (mblockmov-limit): New option. Cherry-picked cf1e4960a4f80301e4c8f71a35cbbc8fef1ce6fd from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune <matthew.fort...@imgtec.com> Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com> Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com> --- gcc/config/mips/mips.cc | 21 ++++++++++++--------- gcc/config/mips/mips.opt | 3 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index 32fe62ce79b..d9c913f2e23 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -9360,16 +9360,19 @@ mips_expand_block_move (rtx dest, rtx src, rtx length) || MEM_ALIGN (dest) < MIPS_MIN_MOVE_MEM_ALIGN)) return false; - if (INTVAL (length) <= MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER) + if (mips_movmem_limit == -1 || INTVAL (length) < mips_movmem_limit) { - mips_block_move_straight (dest, src, INTVAL (length)); - return true; - } - else if (optimize) - { - mips_block_move_loop (dest, src, INTVAL (length), - MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER); - return true; + if (INTVAL (length) <= MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER) + { + mips_block_move_straight (dest, src, INTVAL (length)); + return true; + } + else if (optimize) + { + mips_block_move_loop (dest, src, INTVAL (length), + MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER); + return true; + } } return false; diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt index 012ca91560f..a4b93de924d 100644 --- a/gcc/config/mips/mips.opt +++ b/gcc/config/mips/mips.opt @@ -556,3 +556,6 @@ munique-sections=FILE Use to specify sections that should be made unique. mfunc-opt-list= Target RejectNegative Joined Var(mips_func_opt_list_file) Init(0) Defer mfunc-opt-list=FILE Use to specify per function optimizations. + +mblockmov-limit= +Target RejectNegative Undocumented Joined UInteger Var(mips_movmem_limit) Init(-1) -- 2.34.1