From: Julian Seward Date: Fri, 9 Mar 2018 17:51:39 +0000 (+0100) Subject: MEMMOVE_OR_MEMCPY: unroll word-copying loops in the hope of a small speedup. X-Git-Tag: VALGRIND_3_14_0~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c182a3c8758a218cee45fc55e20e29de597f08a4;p=thirdparty%2Fvalgrind.git MEMMOVE_OR_MEMCPY: unroll word-copying loops in the hope of a small speedup. --- diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c index 215ab7f5ce..d6927f08e0 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) \