[libc-commits] [PATCH] D150433: [libc] Add optimized memset for RISCV

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 15 00:25:19 PDT 2023


gchatelet marked an inline comment as done.
gchatelet added a comment.

In D150433#4341209 <https://reviews.llvm.org/D150433#4341209>, @sivachandra wrote:

> Looks like the best case improvement is ~6x and the worst case improvement is ~3x? Am I reading the numbers correctly?

Yes, that's correct.



================
Comment at: libc/src/string/memory_utils/memset_implementations.h:36
+  constexpr size_t kAlign = sizeof(uint32_t);
+  if (count <= 2 * kAlign)
+    return inline_memset_byte_per_byte(dst, 0, value, count);
----------------
sivachandra wrote:
> I missed asking this in the memcpy patch also: how was the factor of 2 times of the alignment value arrived at?
It is so that we do at least one round of the for loop.
I have several ideas to improve the implementation further.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150433/new/

https://reviews.llvm.org/D150433



More information about the libc-commits mailing list