diff options
author | Damjan Marion <damarion@cisco.com> | 2022-01-31 17:42:44 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-02-10 16:31:41 +0000 |
commit | 137d4ca67bb525f2e2214cc42c2cb3866fc16dc4 (patch) | |
tree | 4b172034220e628a768739c0a3df0ed53087af27 | |
parent | bc0ef7aef5624fefdc5592f9a2c179993a78bfcc (diff) |
vppinfra: small optimization in clib_memset_u64
Type: improvement
Change-Id: I4b89c32c224caf8a3a4ac94b26ecefffd26c7038
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/vppinfra/string.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h index 8c5bea16393..0b187672816 100644 --- a/src/vppinfra/string.h +++ b/src/vppinfra/string.h @@ -320,9 +320,17 @@ clib_memset_u64 (void *p, u64 val, uword count) if (count == 0) return; #else +#if defined(CLIB_HAVE_VEC128) + u64x2 v = u64x2_splat (val); +#endif while (count >= 4) { +#if defined(CLIB_HAVE_VEC128) + u64x2_store_unaligned (v, ptr); + u64x2_store_unaligned (v, ptr + 2); +#else ptr[0] = ptr[1] = ptr[2] = ptr[3] = val; +#endif ptr += 4; count -= 4; } |