[libcxx-commits] [libcxx] [libc++] Vectorize std::find (PR #156431)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 24 06:51:22 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- libcxx/include/__algorithm/find.h libcxx/include/__algorithm/simd_utils.h libcxx/test/benchmarks/algorithms/nonmodifying/find.bench.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__algorithm/find.h b/libcxx/include/__algorithm/find.h
index 28ac2db14..5f32ae8fc 100644
--- a/libcxx/include/__algorithm/find.h
+++ b/libcxx/include/__algorithm/find.h
@@ -123,18 +123,18 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T
       return __ret;
     return __last;
   }
-#if _LIBCPP_HAS_WIDE_CHARACTERS
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
   else if constexpr (sizeof(_Tp) == sizeof(wchar_t) && _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t)) {
     if (auto __ret = std::__constexpr_wmemchr(__first, __value, __last - __first))
       return __ret;
     return __last;
   }
-#endif
-#if _LIBCPP_VECTORIZE_ALGORITHMS
+#  endif
+#  if _LIBCPP_VECTORIZE_ALGORITHMS
   else if constexpr (is_integral<_Tp>::value) {
     return std::__find_vectorized(__first, __last, __value);
   }
-#endif
+#  endif
   else {
     __identity __proj;
     return std::__find_loop(__first, __last, __value, __proj);

``````````

</details>


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


More information about the libcxx-commits mailing list