[libcxx-commits] [libcxx] [libc++] Vectorize std::find (PR #156431)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 30 01:21:28 PDT 2025
philnik777 wrote:
> This breaks compilation with `-flax-vector-conversions=none`, which projects like libaom uses e.g. here: https://aomedia.googlesource.com/aom/+/refs/tags/v3.13.1/build/cmake/aom_configure.cmake#399
>
> To reproduce:
>
> ```
> $ clang -target x86_64-w64-mingw32 -flax-vector-conversions=none -include memory -c -x c++ - < /dev/null
> In file included from <built-in>:1:
> In file included from /home/martin/clang-nightly-tue/x86_64-w64-mingw32/include/c++/v1/memory:998:
> In file included from /home/martin/clang-nightly-tue/x86_64-w64-mingw32/include/c++/v1/iterator:693:
> In file included from /home/martin/clang-nightly-tue/x86_64-w64-mingw32/include/c++/v1/__iterator/istreambuf_iterator.h:19:
> In file included from /home/martin/clang-nightly-tue/x86_64-w64-mingw32/include/c++/v1/__string/char_traits.h:13:
> /home/martin/clang-nightly-tue/x86_64-w64-mingw32/include/c++/v1/__algorithm/find.h:80:41: error: cannot convert between vector values of different size ('__vec' (aka '__simd_vector<const char32_t, __vec_size>') and '__simd_vector<char32_t, __vec_size>' (vector of 4 'char32_t' values))
> 80 | if (auto __cmp_res = __lhs[__i] == __values; std::__any_of(__cmp_res)) {
> | ~~~~~~~~~~ ^ ~~~~~~~~
> /home/martin/clang-nightly-tue/x86_64-w64-mingw32/include/c++/v1/__algorithm/find.h:135:17: note: in instantiation of function template specialization 'std::__find_vectorized<const char32_t, char32_t>' requested here
> 135 | return std::__find_vectorized(__first, __last, __value);
> | ^
> /home/martin/clang-nightly-tue/x86_64-w64-mingw32/include/c++/v1/__string/char_traits.h:320:37: note: in instantiation of function template specialization 'std::__find<const char32_t, char32_t, std::__identity, 0>' requested here
> 320 | const char_type* __match = std::__find(__s, __s + __n, __a, __proj);
> | ^
> ```
That looks a lot like a Clang bug to me. The vector elements have the same size AFAICT. Could you file a bug for that? I'll try to think of a way to work around the problem in the meantime.
https://github.com/llvm/llvm-project/pull/156431
More information about the libcxx-commits
mailing list