[libc] [llvm] Add vector-based strlen implementation for x86_64 and aarch64 (PR #152389)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 12:43:03 PDT 2025


================
@@ -90,7 +102,7 @@ template <typename T> LIBC_INLINE size_t string_length(const T *src) {
   // be aligned to a word boundary, so it's the size we use for reading the
   // string a block at a time.
   if constexpr (cpp::is_same_v<T, char>)
-    return string_length_wide_read<unsigned int>(src);
+    return LIBC_SRC_STRING_MEMORY_UTILS_STRLEN_WIDE_READ<unsigned int>(src);
----------------
lntue wrote:

another option is to put each version into their one namespace, like `sse2::string_length`, `avx2::string_length`, then we alias namespace in the function body: for each option:
`namespace impl = sse2;`
and call `impl::string_length`?
to be a tad less macros?

https://github.com/llvm/llvm-project/pull/152389


More information about the llvm-commits mailing list