|
From: Julian S. <se...@so...> - 2018-03-09 17:53:25
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=c182a3c8758a218cee45fc55e20e29de597f08a4 commit c182a3c8758a218cee45fc55e20e29de597f08a4 Author: Julian Seward <js...@ac...> Date: Fri Mar 9 18:51:39 2018 +0100 MEMMOVE_OR_MEMCPY: unroll word-copying loops in the hope of a small speedup. Diff: --- shared/vg_replace_strmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c index 215ab7f..d6927f0 100644 --- a/shared/vg_replace_strmem.c +++ b/shared/vg_replace_strmem.c @@ -964,6 +964,11 @@ static inline void my_exit ( int x ) while ((s & WM) != 0 && n >= 1) \ { *(UChar*)d = *(UChar*)s; s += 1; d += 1; n -= 1; } \ /* Copy UWords. */ \ + while (n >= WS * 4) \ + { *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; \ + *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; \ + *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; \ + *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; } \ while (n >= WS) \ { *(UWord*)d = *(UWord*)s; s += WS; d += WS; n -= WS; } \ if (n == 0) \ @@ -991,6 +996,11 @@ static inline void my_exit ( int x ) while ((s & WM) != 0 && n >= 1) \ { s -= 1; d -= 1; *(UChar*)d = *(UChar*)s; n -= 1; } \ /* Copy UWords. */ \ + while (n >= WS * 4) \ + { s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; \ + s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; \ + s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; \ + s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; } \ while (n >= WS) \ { s -= WS; d -= WS; *(UWord*)d = *(UWord*)s; n -= WS; } \ if (n == 0) \ |