[libcxx-commits] [libcxx] [libc++] <experimental/simd> Add compound assignment operators for simd reference (PR #86761)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 19 00:24:05 PDT 2024
================
@@ -60,6 +63,24 @@ class __simd_reference {
return {__s_, __idx_};
}
+# define _LIBCXX_SIMD_REFERENCE_OP_(__op) \
+ template <class _Up, class = decltype(std::declval<value_type&>() __op## = std::declval<_Up>())> \
+ __simd_reference _LIBCPP_HIDE_FROM_ABI operator __op##=(_Up&& __v) && noexcept { \
+ __set(__get() __op static_cast<value_type>(std::forward<_Up>(__v))); \
+ return {__s_, __idx_}; \
+ }
+ _LIBCXX_SIMD_REFERENCE_OP_(+)
+ _LIBCXX_SIMD_REFERENCE_OP_(-)
+ _LIBCXX_SIMD_REFERENCE_OP_(*)
+ _LIBCXX_SIMD_REFERENCE_OP_(/)
+ _LIBCXX_SIMD_REFERENCE_OP_(%)
+ _LIBCXX_SIMD_REFERENCE_OP_(&)
+ _LIBCXX_SIMD_REFERENCE_OP_(|)
+ _LIBCXX_SIMD_REFERENCE_OP_(^)
+ _LIBCXX_SIMD_REFERENCE_OP_(<<)
+ _LIBCXX_SIMD_REFERENCE_OP_(>>)
+# undef _LIBCXX_SIMD_REFERENCE_OP_
----------------
philnik777 wrote:
I think we should just expand this. Macros result in notoriously bad error messages and here it really doesn't seem that bad to just expand the macros.
https://github.com/llvm/llvm-project/pull/86761
More information about the libcxx-commits
mailing list