[libcxx-commits] [PATCH] D156225: [libcxx] <experimental/simd> Add broadcast constructor of class simd/simd_mask

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 1 11:33:06 PDT 2023


philnik added inline comments.


================
Comment at: libcxx/include/experimental/__simd/simd.h:47
+  // broadcast constructor
+  template <class _Up, enable_if_t<__can_broadcast_v<value_type, remove_cv_t<remove_reference_t<_Up>>>, int> = 0>
+  _LIBCPP_HIDE_FROM_ABI simd(_Up&& __v) noexcept : __s_(_Impl::__broadcast(static_cast<value_type>(__v))) {}
----------------



================
Comment at: libcxx/include/experimental/__simd/utility.h:60-65
+template <typename __From, typename __To, typename = void>
+struct __is_value_preserving_convertible : std::false_type {};
+
+template <typename __From, typename __To>
+struct __is_value_preserving_convertible<__From, __To, decltype(static_cast<__To>(std::declval<__From>()))>
+    : std::true_type {};
----------------
Isn't this just `is_constructible<__To, __From>`?


================
Comment at: libcxx/include/experimental/__simd/utility.h:60-65
+template <typename __From, typename __To, typename = void>
+struct __is_value_preserving_convertible : std::false_type {};
+
+template <typename __From, typename __To>
+struct __is_value_preserving_convertible<__From, __To, decltype(static_cast<__To>(std::declval<__From>()))>
+    : std::true_type {};
----------------



================
Comment at: libcxx/include/experimental/__simd/vec_ext.h:67
+    _MaskStorage __result;
+    auto __all_bits_v = std::experimental::parallelism_v2::__set_all_bits<_Tp>(__v);
+    for (int __i = 0; __i < _Np; ++__i) {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156225/new/

https://reviews.llvm.org/D156225



More information about the libcxx-commits mailing list