diff options
author | Jerry Zhao <jerryz123@berkeley.edu> | 2023-05-22 14:49:31 -0700 |
---|---|---|
committer | Jerry Zhao <jerryz123@berkeley.edu> | 2023-05-22 14:49:31 -0700 |
commit | f22a2108c4eabe7313c698ed04024b73850d405e (patch) | |
tree | cfa3b4edebf18ebc6ef610f2c6bb9290e8431cbd /benchmarks/common | |
parent | 466a4bec914b2b883d58b22193221106ffbc9be0 (diff) | |
download | riscv-tests-f22a2108c4eabe7313c698ed04024b73850d405e.zip riscv-tests-f22a2108c4eabe7313c698ed04024b73850d405e.tar.gz riscv-tests-f22a2108c4eabe7313c698ed04024b73850d405e.tar.bz2 |
Improve performance of syscalls/memcpy
Diffstat (limited to 'benchmarks/common')
-rw-r--r-- | benchmarks/common/syscalls.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c index 39547b3..7a7b7fd 100644 --- a/benchmarks/common/syscalls.c +++ b/benchmarks/common/syscalls.c @@ -381,7 +381,21 @@ void* memcpy(void* dest, const void* src, size_t len) if ((((uintptr_t)dest | (uintptr_t)src | len) & (sizeof(uintptr_t)-1)) == 0) { const uintptr_t* s = src; uintptr_t *d = dest; - while (d < (uintptr_t*)(dest + len)) + uintptr_t *end = dest + len; + while (d + 8 < end) { + uintptr_t reg[8] = {s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]}; + d[0] = reg[0]; + d[1] = reg[1]; + d[2] = reg[2]; + d[3] = reg[3]; + d[4] = reg[4]; + d[5] = reg[5]; + d[6] = reg[6]; + d[7] = reg[7]; + d += 8; + s += 8; + } + while (d < end) *d++ = *s++; } else { const char* s = src; |