[libcxx-commits] [libcxx] [libc++] Remove __broadcast simd function (PR #205559)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 24 08:23:48 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Nikolas Klauser (philnik777)
<details>
<summary>Changes</summary>
The simd vector type in Clang already provides a conversion operator that acts as a broadcast constructor. We can use that instead.
---
Full diff: https://github.com/llvm/llvm-project/pull/205559.diff
2 Files Affected:
- (modified) libcxx/include/__algorithm/simd_utils.h (-9)
- (modified) libcxx/include/__locale_dir/num.h (+1-2)
``````````diff
diff --git a/libcxx/include/__algorithm/simd_utils.h b/libcxx/include/__algorithm/simd_utils.h
index f73c9ea4b6ea7..c47f79ac7f1dd 100644
--- a/libcxx/include/__algorithm/simd_utils.h
+++ b/libcxx/include/__algorithm/simd_utils.h
@@ -124,15 +124,6 @@ template <class _VecT, size_t _Np, class _Iter>
return _VecT{__iter[_LoadIndices]..., ((void)_ZeroIndices, 0)...};
}(make_index_sequence<_Np>{}, make_index_sequence<__simd_vector_size_v<_VecT> - _Np>{});
}
-
-// Create a vector where every elements is __val
-template <class _VecT>
-[[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT
-__broadcast(__simd_vector_underlying_type_t<_VecT> __val) {
- return [&]<std::size_t... _Indices>(index_sequence<_Indices...>) {
- return _VecT{((void)_Indices, __val)...};
- }(make_index_sequence<__simd_vector_size_v<_VecT>>());
-}
_LIBCPP_DIAGNOSTIC_POP
template <class _Tp, size_t _Np>
diff --git a/libcxx/include/__locale_dir/num.h b/libcxx/include/__locale_dir/num.h
index 8af427ca37dbe..5b3b917384121 100644
--- a/libcxx/include/__locale_dir/num.h
+++ b/libcxx/include/__locale_dir/num.h
@@ -96,9 +96,8 @@ struct __num_get : protected __num_get_base {
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi")
using __vec = __simd_vector<char, 32>;
- __vec __chars = std::__broadcast<__vec>(__val);
__vec __cmp = std::__partial_load<__vec, __int_chr_cnt>(__atoms);
- auto __res = __chars == __cmp;
+ auto __res = __vec(__val) == __cmp;
if (std::__none_of(__res))
return __int_chr_cnt;
return std::min(__int_chr_cnt, std::__find_first_set(__res));
``````````
</details>
https://github.com/llvm/llvm-project/pull/205559
More information about the libcxx-commits
mailing list