|
16125 | 16125 |
|
16126 | 16126 | template<class V, class T> using @\exposidnc{make-compatible-simd-t} = \seebelownc@; // \expos |
16127 | 16127 |
|
| 16128 | +template<class V> |
| 16129 | + concept @\defexposconceptnc{simd-type}@ = // \expos |
| 16130 | + @\libconcept{same_as}@<V, basic_simd<typename V::value_type, typename V::abi_type>> && |
| 16131 | + is_default_constructible_v<V>; |
| 16132 | + |
16128 | 16133 | template<class V> |
16129 | 16134 | concept @\defexposconceptnc{simd-floating-point}@ = // \expos |
16130 | 16135 | @\libconcept{same_as}@<V, basic_simd<typename V::value_type, typename V::abi_type>> && |
|
16738 | 16743 | template<@\exposconcept{math-floating-point}@ V> |
16739 | 16744 | @\exposid{deduced-simd-t}@<V> |
16740 | 16745 | sph_neumann(const rebind_simd_t<unsigned, @\exposid{deduced-simd-t}@<V>>& n, const V& x); |
| 16746 | + |
| 16747 | + // \ref{simd.bit}, Bit manipulation |
| 16748 | + template<@\exposconcept{simd-type}@ V> constexpr V byteswap(const V& v) noexcept; |
| 16749 | + template<@\exposconcept{simd-type}@ V> constexpr V bit_ceil(const V& v) noexcept; |
| 16750 | + template<@\exposconcept{simd-type}@ V> constexpr V bit_floor(const V& v) noexcept; |
| 16751 | + |
| 16752 | + template<@\exposconcept{simd-type}@ V> |
| 16753 | + constexpr typename V::mask_type has_single_bit(const V& v) noexcept; |
| 16754 | + |
| 16755 | + template<@\exposconcept{simd-type}@ V0, @\exposconcept{simd-type}@ V1> |
| 16756 | + constexpr V0 rotl(const V0& v, const V1& s) noexcept; |
| 16757 | + template<@\exposconcept{simd-type}@ V> |
| 16758 | + constexpr V rotl(const V& v, int s) noexcept; |
| 16759 | + |
| 16760 | + template<@\exposconcept{simd-type}@ V0, @\exposconcept{simd-type}@ V1> |
| 16761 | + constexpr V0 rotr(const V0& v, const V1& s) noexcept; |
| 16762 | + template<@\exposconcept{simd-type}@ V> |
| 16763 | + constexpr V rotr(const V& v, int s) noexcept; |
| 16764 | + |
| 16765 | + template<@\exposconcept{simd-type}@ V> |
| 16766 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 16767 | + bit_width(const V& v) noexcept; |
| 16768 | + template<@\exposconcept{simd-type}@ V> |
| 16769 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 16770 | + countl_zero(const V& v) noexcept; |
| 16771 | + template<@\exposconcept{simd-type}@ V> |
| 16772 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 16773 | + countl_one(const V& v) noexcept; |
| 16774 | + template<@\exposconcept{simd-type}@ V> |
| 16775 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 16776 | + countr_zero(const V& v) noexcept; |
| 16777 | + template<@\exposconcept{simd-type}@ V> |
| 16778 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 16779 | + countr_one(const V& v) noexcept; |
| 16780 | + template<@\exposconcept{simd-type}@ V> |
| 16781 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 16782 | + popcount(const V& v) noexcept; |
16741 | 16783 | } |
16742 | 16784 | \end{codeblock} |
16743 | 16785 |
|
@@ -18438,6 +18480,165 @@ |
18438 | 18480 | \tcode{ret.first}. |
18439 | 18481 | \end{itemdescr} |
18440 | 18482 |
|
| 18483 | +\rSec3[simd.bit]{\tcode{basic_simd} bit library} |
| 18484 | + |
| 18485 | +\begin{itemdecl} |
| 18486 | +template<@\exposconcept{simd-type}@ V> constexpr V byteswap(const V& v) noexcept; |
| 18487 | +\end{itemdecl} |
| 18488 | + |
| 18489 | +\begin{itemdescr} |
| 18490 | +\pnum |
| 18491 | +\constraints |
| 18492 | +The type \tcode{V::value_type} models \tcode{integral}. |
| 18493 | + |
| 18494 | +\pnum |
| 18495 | +\returns |
| 18496 | +A \tcode{basic_simd} object where the $i^\text{th}$ element is initialized to |
| 18497 | +the result of \tcode{std::byteswap(v[$i$])} for all $i$ in the range |
| 18498 | +\range{0}{V::size()}. |
| 18499 | +\end{itemdescr} |
| 18500 | + |
| 18501 | +\begin{itemdecl} |
| 18502 | +template<@\exposconcept{simd-type}@ V> constexpr V bit_ceil(const V& v) noexcept; |
| 18503 | +\end{itemdecl} |
| 18504 | + |
| 18505 | +\begin{itemdescr} |
| 18506 | +\pnum |
| 18507 | +\constraints |
| 18508 | +The type \tcode{V::value_type} is an unsigned integer type\iref{basic.fundamental}. |
| 18509 | + |
| 18510 | +\pnum |
| 18511 | +\expects |
| 18512 | +For every $i$ in the range \range{0}{V::size()}, the smallest power of 2 |
| 18513 | +greater than or equal to \tcode{v[$i$]} is representable as a value of type |
| 18514 | +\tcode{V::value_type}. |
| 18515 | + |
| 18516 | +\pnum |
| 18517 | +\returns |
| 18518 | +A \tcode{basic_simd} object where the $i^\text{th}$ element is initialized to |
| 18519 | +the result of \tcode{std::bit_ceil(v[$i$])} for all $i$ in the range |
| 18520 | +\range{0}{V::size()}. |
| 18521 | + |
| 18522 | +\pnum |
| 18523 | +\remarks |
| 18524 | +A function call expression that violates the precondition in the \expects |
| 18525 | +element is not a core constant expression\iref{expr.const}. |
| 18526 | +\end{itemdescr} |
| 18527 | + |
| 18528 | +\begin{itemdecl} |
| 18529 | +template<@\exposconcept{simd-type}@ V> constexpr V bit_floor(const V& v) noexcept; |
| 18530 | +\end{itemdecl} |
| 18531 | + |
| 18532 | +\begin{itemdescr} |
| 18533 | +\pnum |
| 18534 | +\constraints |
| 18535 | +The type \tcode{V::value_type} is an unsigned integer type\iref{basic.fundamental}. |
| 18536 | + |
| 18537 | +\pnum |
| 18538 | +\returns |
| 18539 | +A \tcode{basic_simd} object where the $i^\text{th}$ element is initialized to |
| 18540 | +the result of \tcode{std::bit_floor(v[$i$])} for all $i$ in the range |
| 18541 | +\range{0}{V::size()}. |
| 18542 | +\end{itemdescr} |
| 18543 | + |
| 18544 | +\begin{itemdecl} |
| 18545 | +template<@\exposconcept{simd-type}@ V> |
| 18546 | + constexpr typename V::mask_type has_single_bit(const V& v) noexcept; |
| 18547 | +\end{itemdecl} |
| 18548 | + |
| 18549 | +\begin{itemdescr} |
| 18550 | +\pnum |
| 18551 | +\constraints |
| 18552 | +The type \tcode{V::value_type} is an unsigned integer type\iref{basic.fundamental}. |
| 18553 | + |
| 18554 | +\pnum |
| 18555 | +\returns |
| 18556 | +A \tcode{basic_simd_mask} object where the $i^\text{th}$ element is initialized |
| 18557 | +to the result of \tcode{std::has_single_bit(v[$i$])} for all $i$ in the range |
| 18558 | +\range{0}{V::size()}. |
| 18559 | +\end{itemdescr} |
| 18560 | + |
| 18561 | +\begin{itemdecl} |
| 18562 | +template<@\exposconcept{simd-type}@ V0, @\exposconcept{simd-type}@ V1> |
| 18563 | + constexpr V0 rotl(const V0& v0, const V1& v1) noexcept; |
| 18564 | +template<@\exposconcept{simd-type}@ V0, @\exposconcept{simd-type}@ V1> |
| 18565 | + constexpr V0 rotr(const V0& v0, const V1& v1) noexcept; |
| 18566 | +\end{itemdecl} |
| 18567 | + |
| 18568 | +\begin{itemdescr} |
| 18569 | +\pnum |
| 18570 | +\constraints |
| 18571 | +\begin{itemize} |
| 18572 | + \item |
| 18573 | + The type \tcode{V0::value_type} is an unsigned integer type\iref{basic.fundamental}, |
| 18574 | + \item |
| 18575 | + the type \tcode{V1::value_type} models \tcode{integral}, |
| 18576 | + \item |
| 18577 | + \tcode{V0::size() == V1::size()} is \tcode{true}, and |
| 18578 | + \item |
| 18579 | + \tcode{sizeof(typename V0::value_type) == sizeof(typename V1::value_type)} is \tcode{true}. |
| 18580 | +\end{itemize} |
| 18581 | + |
| 18582 | +\pnum |
| 18583 | +\returns |
| 18584 | +A \tcode{basic_simd} object where the $i^\text{th}$ element is initialized to |
| 18585 | +the result of \tcode{\placeholder{bit-func}(v0[$i$], |
| 18586 | +static_cast<int>(v1[$i$]))} for all $i$ in the range \range{0}{V0::size()}, |
| 18587 | +where \placeholder{bit-func} is the corresponding scalar function from \libheader{bit}. |
| 18588 | +\end{itemdescr} |
| 18589 | + |
| 18590 | +\begin{itemdecl} |
| 18591 | +template<@\exposconcept{simd-type}@ V> constexpr V rotl(const V& v, int s) noexcept; |
| 18592 | +template<@\exposconcept{simd-type}@ V> constexpr V rotr(const V& v, int s) noexcept; |
| 18593 | +\end{itemdecl} |
| 18594 | + |
| 18595 | +\begin{itemdescr} |
| 18596 | +\pnum |
| 18597 | +\constraints |
| 18598 | +The type \tcode{V::value_type} is an unsigned integer type\iref{basic.fundamental} |
| 18599 | + |
| 18600 | +\pnum |
| 18601 | +\returns |
| 18602 | +A \tcode{basic_simd} object where the $i^\text{th}$ element is initialized to |
| 18603 | +the result of \tcode{\placeholder{bit-func}(v[$i$], s)} for all $i$ in the |
| 18604 | +range \range{0}{V::size()}, where \placeholder{bit-func} is the corresponding |
| 18605 | +scalar function from \libheader{bit}. |
| 18606 | +\end{itemdescr} |
| 18607 | + |
| 18608 | +\begin{itemdecl} |
| 18609 | +template<@\exposconcept{simd-type}@ V> |
| 18610 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 18611 | + bit_width(const V& v) noexcept; |
| 18612 | +template<@\exposconcept{simd-type}@ V> |
| 18613 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 18614 | + countl_zero(const V& v) noexcept; |
| 18615 | +template<@\exposconcept{simd-type}@ V> |
| 18616 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 18617 | + countl_one(const V& v) noexcept; |
| 18618 | +template<@\exposconcept{simd-type}@ V> |
| 18619 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 18620 | + countr_zero(const V& v) noexcept; |
| 18621 | +template<@\exposconcept{simd-type}@ V> |
| 18622 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 18623 | + countr_one(const V& v) noexcept; |
| 18624 | +template<@\exposconcept{simd-type}@ V> |
| 18625 | + constexpr rebind_simd_t<make_signed_t<typename V::value_type>, V> |
| 18626 | + popcount(const V& v) noexcept; |
| 18627 | +\end{itemdecl} |
| 18628 | + |
| 18629 | +\begin{itemdescr} |
| 18630 | +\pnum |
| 18631 | +\constraints |
| 18632 | +The type \tcode{V::value_type} is an unsigned integer type\iref{basic.fundamental} |
| 18633 | + |
| 18634 | +\pnum |
| 18635 | +\returns |
| 18636 | +A \tcode{basic_simd} object where the $i^\text{th}$ element is initialized to |
| 18637 | +the result of \tcode{\placeholder{bit-func}(v[$i$])} for all $i$ in the range |
| 18638 | +\range{0}{V::size()}, where \placeholder{bit-func} is the corresponding scalar |
| 18639 | +function from \libheader{bit}. |
| 18640 | +\end{itemdescr} |
| 18641 | + |
18441 | 18642 | \rSec2[simd.mask.class]{Class template \tcode{basic_simd_mask}} |
18442 | 18643 |
|
18443 | 18644 | \rSec3[simd.mask.overview]{Class template \tcode{basic_simd_mask} overview} |
|
0 commit comments