diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-05-22 02:32:12 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-05-22 02:32:12 -0700 |
commit | 7b87222f9b23c858533f765ee3d0c693ededac3e (patch) | |
tree | 1e458a9d94a7523dd0e50902b16888fd9d25fd61 /glibc | |
parent | 38a711ca51c4a9981911f29b91a2a5bfe4fa449f (diff) | |
download | riscv-gnu-toolchain-7b87222f9b23c858533f765ee3d0c693ededac3e.zip riscv-gnu-toolchain-7b87222f9b23c858533f765ee3d0c693ededac3e.tar.gz riscv-gnu-toolchain-7b87222f9b23c858533f765ee3d0c693ededac3e.tar.bz2 |
glibc/newlib: unroll strcmp further for RV32
This reduces the performance cliff between RV32 and RV64 slightly,
without an egregious increase in code size.
Diffstat (limited to 'glibc')
-rw-r--r-- | glibc/sysdeps/riscv/strcmp.S | 24 |
1 files changed, 20 insertions, 4 deletions
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) |