[libc-commits] [libc] [libc] Implement wide read strlen with LLVM vector type (PR #152605)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Sat Aug 9 19:54:12 PDT 2025


================
@@ -48,4 +48,13 @@
 #define LIBC_PREFERED_TYPE(TYPE)
 #endif
 
+#if __has_attribute(ext_vector_type) && defined(__clang__) &&                  \
+    __clang_major__ >= 15 &&                                                   \
+    (defined(LIBC_TARGET_ARCH_IS_X86) || defined(LIBC_TARGET_ARCH_IS_ARM))
+#define LIBC_HAS_VECTOR_TYPE 1
+#define LIBC_VECTOR_TYPE(N) __attribute__((ext_vector_type(N)))
+#else
+#define LIBC_HAS_VECTOR_TYPE 0
+#endif
----------------
jhuber6 wrote:

It's because clang 15 added support for bool vectors, which is what emits to something optimal here. Before clang 15 it was an error.

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


More information about the libc-commits mailing list