simd_mask<complex<double>>::operator+/-/~ return a disabled simd specializationSection: 29.10.9.4 [simd.mask.unary] Status: New Submitter: Matthias Kretz Opened: 2025-03-27 Last modified: 2025-06-12
Priority: 1
View other active issues in [simd.mask.unary].
View all other issues in [simd.mask.unary].
View all issues with New status.
Discussion:
Consider:
simd<complex<double>> c = {};
simd_mask<complex<double>> k = (c == c); // sizeof(complex<double>) == 16
auto i = -k; // simd<__int128> !
basic_simd_mask unary +, -, and ~ return basic_simd<integer-from<Bytes, Abi>>.
29.10.2.1 [simd.expos.defn]/2 says:
integer-from<Bytes>is an alias for a signed integer typeTsuch thatsizeof(T)equalsBytes.
But __int128 isn't a vectorizable type. Consequently, simd<__int128> currently
is a disabled specialization. So it seems simd<complex<double>> wants __int128
to be added to the list of vectorizable types.
"Specialize" basic_simd_mask<16, Abi> to return
rebind_t<integer-from<8>, basic_simd_mask<integer-from<16>, Abi>>
(reduces a 128-bit value of a vector-mask to a 64-bit value in the simd)
"Specialize" basic_simd_mask<16, Abi> to return
resize_t<size() * 2, rebind_t<integer-from<8>,
basic_simd_mask<integer-from<16>, Abi>>>
(duplicates a 128-bit value of a vector-mask to two 64-bit values in the simd)
delete unary +, -, and ~ for basic_simd_mask<16, Abi>
(closest to the status quo)
[2025-06-12; Reflector poll]
Set priority to 1 after reflector poll.
Proposed resolution:
This wording is relative to N5008.
Modify 29.10.9.4 [simd.mask.unary] as indicated:
constexpr basic_simd_mask operator!() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator+() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator-() const noexcept; constexpr basic_simd<integer-from<Bytes>, Abi> operator~() const noexcept;-1- Let
-2- Returns: A data-parallel object where theopbe the operator.ith element is initialized to the results of applyingoptooperator[](i)for alliin the range of[0, size()). -?- Remarks: IfBytesis greater than8,operator+(),operator-(), andoperator~()are deleted.