On 5/19/23 00:11, YunQiang Su wrote:
On platform with LWL/LWR, mips_block_move_loop is always used,
which expand __buildin_memcpy/strcpy to a loop of lwl/lwr/swl/swl etc.
For short (normally <=64), it has better performance,
but when the src/dest are long, use memcpy/strcpy lib call may have
better performance.
At the same time, lib call may be optimized with SIMD, so,
on the platform with SIMD, lib call may have much better performace.
gcc/ChangeLog:
* config/mips/mips.cc (mips_expand_block_move): don't expand
if length>=64.
gcc/testsuite/ChangeLog:
* gcc.target/mips/expand-block-move-large.c: New test.
---
gcc/config/mips/mips.cc | 6 ++++++
.../gcc.target/mips/expand-block-move-large.c | 17 +++++++++++++++++
2 files changed, 23 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/mips/expand-block-move-large.c
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index ca491b981a3..00f26d5e923 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -8313,6 +8313,12 @@ mips_expand_block_move (rtx dest, rtx src, rtx length)
}
else if (optimize)
{
+ /* When the length is big enough, the lib call has better performace
+ than load/store insns.
+ In most platform, the value is about 64-128.
+ And in fact lib call may be optimized with SIMD */
+ if (INTVAL(length) >= 64)
+ return false;
Just a formatting nit. Space between INTVAL and the open paren for its
argument list.
OK with that change.
jeff