diff options
| author | Joseph Huber <huberjn@outlook.com> | 2025-09-26 08:18:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-26 08:18:00 -0500 |
| commit | e2d5efd59ff2d448d371f0f72630934e42a8c12c (patch) | |
| tree | 5c2f0d44ad3f602514a3a6d2458d0d3ecb0f9476 /libc/src/string | |
| parent | bb38b48910967041045997a0c1293ee2ba834196 (diff) | |
[libc] Update the memory helper functions for simd types (#160174)
Summary:
This unifies the interface to just be a bunch of `load` and `store`
functions that optionally accept a mask / indices for gathers and
scatters with masks.
I had to rename this from `load` and `store` because it conflicts with
the other version in `op_generic`. I might just work around that with a
trait instead.
Diffstat (limited to 'libc/src/string')
| -rw-r--r-- | libc/src/string/memory_utils/generic/inline_strlen.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libc/src/string/memory_utils/generic/inline_strlen.h b/libc/src/string/memory_utils/generic/inline_strlen.h index 5e553e301d4d..d7435afb0371 100644 --- a/libc/src/string/memory_utils/generic/inline_strlen.h +++ b/libc/src/string/memory_utils/generic/inline_strlen.h @@ -32,14 +32,15 @@ string_length(const char *src) { const cpp::simd<char> *aligned = reinterpret_cast<const cpp::simd<char> *>( __builtin_align_down(src, alignment)); - cpp::simd<char> chars = cpp::load_aligned<cpp::simd<char>>(aligned); + cpp::simd<char> chars = cpp::load<cpp::simd<char>>(aligned, /*aligned=*/true); cpp::simd_mask<char> mask = chars == null_byte; size_t offset = src - reinterpret_cast<const char *>(aligned); if (cpp::any_of(shift_mask(mask, offset))) return cpp::find_first_set(shift_mask(mask, offset)); for (;;) { - cpp::simd<char> chars = cpp::load_aligned<cpp::simd<char>>(++aligned); + cpp::simd<char> chars = cpp::load<cpp::simd<char>>(++aligned, + /*aligned=*/true); cpp::simd_mask<char> mask = chars == null_byte; if (cpp::any_of(mask)) return (reinterpret_cast<const char *>(aligned) - src) + |
