From 7b87222f9b23c858533f765ee3d0c693ededac3e Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sun, 22 May 2016 02:32:12 -0700 Subject: glibc/newlib: unroll strcmp further for RV32 This reduces the performance cliff between RV32 and RV64 slightly, without an egregious increase in code size. --- glibc/sysdeps/riscv/strcmp.S | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'glibc') diff --git a/glibc/sysdeps/riscv/strcmp.S b/glibc/sysdeps/riscv/strcmp.S index 89827ea..d6b6eec 100644 --- a/glibc/sysdeps/riscv/strcmp.S +++ b/glibc/sysdeps/riscv/strcmp.S @@ -54,10 +54,18 @@ ENTRY(strcmp) .endm .Lloop: - # examine full words + # examine full words at a time, favoring strings of a couple dozen chars +#ifdef __riscv32 + check_one_word 0 5 + check_one_word 1 5 + check_one_word 2 5 + check_one_word 3 5 + check_one_word 4 5 +#else check_one_word 0 3 check_one_word 1 3 check_one_word 2 3 +#endif # backwards branch to .Lloop contained above .Lmismatch: @@ -108,9 +116,17 @@ ENTRY(strcmp) ret # cases in which a null byte was detected - foundnull 0, 3 - foundnull 1, 3 - foundnull 2, 3 +#ifdef __riscv32 + foundnull 0 5 + foundnull 1 5 + foundnull 2 5 + foundnull 3 5 + foundnull 4 5 +#else + foundnull 0 3 + foundnull 1 3 + foundnull 2 3 +#endif END(strcmp) -- cgit v1.1