From 32d0fc4be52cb7029f7359d516c881e3229ba4fc Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Mon, 4 Apr 2016 12:33:35 +0000 Subject: [PATCH] memset replacement: unroll vectorised loops. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15848 --- 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 8de085a57b..f3be419421 100644 --- a/shared/vg_replace_strmem.c +++ b/shared/vg_replace_strmem.c @@ -1200,6 +1200,11 @@ static inline void my_exit ( int x ) c8 = (c8 << 32) | c8; \ while ((a & 7) != 0 && n >= 1) \ { *(UChar*)a = (UChar)c; a += 1; n -= 1; } \ + while (n >= 32) \ + { *(ULong*)a = c8; a += 8; n -= 8; \ + *(ULong*)a = c8; a += 8; n -= 8; \ + *(ULong*)a = c8; a += 8; n -= 8; \ + *(ULong*)a = c8; a += 8; n -= 8; } \ while (n >= 8) \ { *(ULong*)a = c8; a += 8; n -= 8; } \ while (n >= 1) \ @@ -1212,6 +1217,11 @@ static inline void my_exit ( int x ) c4 = (c4 << 16) | c4; \ while ((a & 3) != 0 && n >= 1) \ { *(UChar*)a = (UChar)c; a += 1; n -= 1; } \ + while (n >= 16) \ + { *(UInt*)a = c4; a += 4; n -= 4; \ + *(UInt*)a = c4; a += 4; n -= 4; \ + *(UInt*)a = c4; a += 4; n -= 4; \ + *(UInt*)a = c4; a += 4; n -= 4; } \ while (n >= 4) \ { *(UInt*)a = c4; a += 4; n -= 4; } \ while (n >= 1) \ -- 2.47.2