]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
MEMMOVE_OR_MEMCPY: unroll word-copying loops in the hope of a small speedup.
authorJulian Seward <jseward@acm.org>
Fri, 9 Mar 2018 17:51:39 +0000 (18:51 +0100)
committerJulian Seward <jseward@acm.org>
Fri, 9 Mar 2018 17:51:39 +0000 (18:51 +0100)
shared/vg_replace_strmem.c

index 215ab7f5ce2b3d4037e21e6b6b47441a15f1f329..d6927f08e0da1f22c5ebb63990ad38c6024b42bc 100644 (file)
@@ -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) \