Skip to content

Commit

Permalink
Use to_address on contiguous iterators
Browse files Browse the repository at this point in the history
ChangeLog:

	* P1928/changelog.tex:
	* P1928/wording.tex:
  • Loading branch information
mattkretz committed Jul 16, 2024
1 parent 4b9dba6 commit 78f3310
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions P1928/changelog.tex
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ \section{Changelog}
\item Apply improved wording from \ref{sec:simd.overview} to \ref{sec:simd.mask.overview}.
\item Add comments for LWG to address to broadcast ctor (\ref{sec:simd.ctor}).
\item Respecify generator ctor to not reuse broadcast constraint (\ref{sec:simd.ctor}).
\item Use \code{to_address} on contiguous iterators (\ref{sec:simd.ctor} and \ref{sec:simd.copy}).
This is more explicit about allowing memcpy on the complete range rather than
having to iterate the range per element.

%\todo Reorder \code{simd} and \code{simd_mask} specification in the wording (mask first).
\end{revision}
18 changes: 10 additions & 8 deletions P1928/wording.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

\newcommand\flagsRequires[2]{
\item If the template parameter pack \tcode{Flags} contains
\tcode{\alignedflag}, \tcode{addressof(*first)} points to storage
\tcode{\alignedflag}, \tcode{to_address(first)} points to storage
aligned by \tcode{simd_alignment_v<#1>}.
\item If the template parameter pack \tcode{Flags} contains
\tcode{\overalignedflag<N>}, \tcode{addressof(*first)}
\tcode{\overalignedflag<N>}, \tcode{to_address(first)}
points to storage aligned by \tcode{N}.
}

Expand Down Expand Up @@ -725,7 +725,8 @@
\begin{itemdescr}
\SimdLoadDescr
{\range{first}{first + size()} is a valid range.}
{Initializes the $i^\text{th}$ element with \tcode{static_cast<T>(first[$i$])} \foralli.}
{Initializes the $i^\text{th}$ element with \tcode{static_cast<T>(to_address(first)[$i$])}
\foralli.}
\end{itemdescr}

\begin{itemdecl}
Expand All @@ -736,7 +737,8 @@
\begin{itemdescr}
\SimdLoadDescr
{\validMaskedRange}
{Initializes the $i^\text{th}$ element with \tcode{mask[$i$] ? static_cast<T>(first[$i$]) : T()}
{Initializes the $i^\text{th}$ element with \tcode{mask[$i$] ?
static_cast<T>(to_address(first)[$i$]) : T()}
\foralli.}
\end{itemdescr}

Expand All @@ -751,7 +753,7 @@
\SimdLoadDescr
{\range{first}{first + size()} is a valid range.}
{Replaces the elements of the \tcode{basic_simd} object such that the $i^\text{th}$ element is
assigned with \tcode{static_cast<T>(first[$i$])} \foralli.}
assigned with \tcode{static_cast<T>(to_address(first)[$i$])} \foralli.}
\end{itemdescr}

\begin{itemdecl}
Expand All @@ -763,7 +765,7 @@
\SimdLoadDescr
{\validMaskedRange}
{Replaces the selected elements of the \tcode{basic_simd} object such that the $i^\text{th}$
element is replaced with \tcode{static_cast<T>(first[$i$])} \forallmaskedi.}
element is replaced with \tcode{static_cast<T>(to_address(first)[$i$])} \forallmaskedi.}
\end{itemdescr}

\newcommand\SimdStoreDescr[2]{
Expand Down Expand Up @@ -794,7 +796,7 @@
\begin{itemdescr}
\SimdStoreDescr
{\range{first}{first + size()} is a valid range.}
{Copies all \tcode{basic_simd} elements as if \tcode{first[$i$] =
{Copies all \tcode{basic_simd} elements as if \tcode{to_address(first)[$i$] =
static_cast<iter_value_t<Out>>(operator[]($i$))} \foralli.}
\end{itemdescr}

Expand All @@ -806,7 +808,7 @@
\begin{itemdescr}
\SimdStoreDescr
{\validMaskedRange}
{Copies the selected elements as if \tcode{first[$i$] =
{Copies the selected elements as if \tcode{to_address(first)[$i$] =
static_cast<iter_value_t<Out>>(operator[]($i$))} \forallmaskedi.}
\end{itemdescr}

Expand Down

0 comments on commit 78f3310

Please sign in to comment.