Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2025-02 LWG Motion 11] P3430R3 simd issues: explicit, unsequenced, identity-element position, and members of disabled simd #7687

Merged
merged 1 commit into from
Mar 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -17204,7 +17204,7 @@
constexpr basic_simd() noexcept = default;

// \ref{simd.ctor}, \tcode{basic_simd} constructors
template<class U> constexpr basic_simd(U&& value) noexcept;
template<class U> constexpr explicit(@\seebelow@) basic_simd(U&& value) noexcept;
template<class U, class UAbi>
constexpr explicit(@\seebelow@) basic_simd(const basic_simd<U, UAbi>&) noexcept;
template<class G> constexpr explicit basic_simd(G&& gen) noexcept;
Expand Down Expand Up @@ -17310,7 +17310,7 @@

\pnum
\recommended
Implementations should support explicit conversions between specializations of
Implementations should support implicit conversions between specializations of
\tcode{basic_simd} and appropriate \impldef{conversions of \tcode{basic_simd}
from/to implementation-specific vector types} types.
\begin{note}
Expand All @@ -17321,7 +17321,7 @@
\rSec3[simd.ctor]{\tcode{basic_simd} constructors}

\begin{itemdecl}
template<class U> constexpr basic_simd(U&&) noexcept;
template<class U> constexpr explicit(@\seebelow@) basic_simd(U&& value) noexcept;
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -17330,24 +17330,29 @@

\pnum
\constraints
\tcode{From} satisfies \tcode{convertible_to<value_type>}, and either
\tcode{value_type} satisfies \tcode{constructible_from<U>}.

\pnum
\effects
Initializes each element to the value of the argument after conversion to
\tcode{value_type}.

\pnum
\remarks
The expression inside \tcode{explicit} evaluates to \tcode{false} if and only if
\tcode{U} satisfies \tcode{convertible_to<value_type>}, and either
\begin{itemize}
\item
\tcode{From} is not an arithmetic type and does not satisfy
\exposconcept{constexpr-wrapper-like},
\item
\tcode{From} is an arithmetic type and the conversion from \tcode{From} to
\tcode{value_type} is value-preserving\iref{simd.general}, or
\item
\tcode{From} is not an arithmetic type and does not satisfy
\tcode{\exposconcept{constexpr-wrapper-like}}, or
\item
\tcode{From} satisfies \tcode{\exposconcept{constexpr-wrapper-like}},
\tcode{From} satisfies \exposconcept{constexpr-wrapper-like},
\tcode{remove_const_t<decltype(From::value)>} is an arithmetic type, and
\tcode{From::value} is representable by \tcode{value_type}.
\end{itemize}

\pnum
\effects
Initializes each element to the value of the argument after conversion to
\tcode{value_type}.
\end{itemdescr}

\begin{itemdecl}
Expand Down Expand Up @@ -17384,7 +17389,7 @@
\end{itemdescr}

\begin{itemdecl}
template<class G> constexpr explicit basic_simd(G&& gen) noexcept;
template<class G> constexpr explicit basic_simd(G&& gen);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -17408,10 +17413,7 @@

\pnum
\remarks
The calls to \tcode{gen} are unsequenced with respect to each other.
Vectorization-unsafe\iref{algorithms.parallel.defns} standard library functions
may not be invoked by \tcode{gen}.
\tcode{gen} is invoked exactly once for each $i$.
\tcode{gen} is invoked exactly once for each $i$, in increasing order of $i$.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wording is hand-wavy; is that ok because it's just a remark? Same for this wording added elsewhere...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is hand-wavy about it? And what would you say instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "each $i$"? The closest wording prior to this paper is "if $N = 0$ or if for each $i$ where $0 \le i &lt; N$ in increasing order"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preceding paragraph says:

Initializes the $i^\text{th}$ element with
static_cast<value_type>(gen(integral_constant<simd-size-type, i>())) for all $i$ in the range of [0,size()).

Doesn't that sufficiently explain what "each $i$" means? (And there's no $N = 0$ case to consider here.)

\end{itemdescr}

\begin{itemdecl}
Expand Down Expand Up @@ -19180,7 +19182,7 @@
\tcode{basic_simd_mask<Bytes, Abi>} is trivially copyable.

\pnum
\recommended Implementations should support explicit conversions between
\recommended Implementations should support implicit conversions between
specializations of \tcode{basic_simd_mask} and appropriate \impldef{conversions
of \tcode{basic_simd_mask} from/to implementation-specific vector types} types.
\begin{note}
Expand Down Expand Up @@ -19218,7 +19220,7 @@
\end{itemdescr}

\begin{itemdecl}
template<class G> constexpr explicit basic_simd_mask(G&& gen) noexcept;
template<class G> constexpr explicit basic_simd_mask(G&& gen);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -19236,10 +19238,7 @@

\pnum
\remarks
The calls to \tcode{gen} are unsequenced with respect to each other.
Vectorization-unsafe\iref{algorithms.parallel.defns} standard library
functions may not be invoked by \tcode{gen}.
\tcode{gen} is invoked exactly once for each $i$.
\tcode{gen} is invoked exactly once for each $i$, in increasing order of $i$.
\end{itemdescr}

\rSec3[simd.mask.subscr]{\tcode{basic_simd_mask} subscript operator}
Expand Down