Skip to content

Commit e216d8d

Browse files
committed
Introduce [parallel.simd.casts]
1 parent 8d9cea7 commit e216d8d

File tree

1 file changed

+276
-0
lines changed

1 file changed

+276
-0
lines changed

data_parallel_types.html

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,6 +1982,282 @@ <h1><ins><code>simd</code> compare operators</ins></h1>
19821982
</cxx-throws>
19831983
</cxx-function>
19841984
</cxx-section>
1985+
1986+
<cxx-section id="parallel.simd.casts">
1987+
<h1><ins><code>simd</code> casts</ins></h1>
1988+
1989+
<cxx-function>
1990+
<cxx-signature><ins>template&lt;class T, class U, class Abi&gt; <em>see-below</em> simd_cast(const simd&lt;U, Abi&gt;& x)</ins></cxx-signature>
1991+
1992+
<p>
1993+
<ins>
1994+
Let <code>To</code> identify <code>T::value_type</code> if <code>is_simd_v&lt;T&gt;</code> is <code>true</code>, or <code>T</code> otherwise.
1995+
</ins>
1996+
</p>
1997+
1998+
<cxx-returns>
1999+
<ins>
2000+
A <code>simd</code> object with the <em>i</em>-th element initialized to <code>static_cast&lt;To&gt;(x[i])</code> for all <code>i</code> &#8714; <code>[0, size())</code>.
2001+
</ins>
2002+
</cxx-returns>
2003+
2004+
<cxx-throws>
2005+
<ins>
2006+
Nothing.
2007+
</ins>
2008+
</cxx-throws>
2009+
2010+
<cxx-remarks>
2011+
<ins>
2012+
The function shall not participate in overload resolution unless
2013+
2014+
<bl>
2015+
<li>
2016+
<ins>
2017+
every possible value of type <code>U</code> can be represented with type <code>To</code>, and
2018+
</ins>
2019+
</li>
2020+
2021+
<li>
2022+
<ins>
2023+
either
2024+
2025+
<ul>
2026+
<li>
2027+
<ins>
2028+
<code>is_simd_v&lt;T&gt;</code> is <code>false</code>, or
2029+
</ins>
2030+
</li>
2031+
2032+
<li>
2033+
<ins>
2034+
<code>T::size() == simd&lt;U, Abi&gt;::size()</code> is <code>true</code>.
2035+
</ins>
2036+
</li>
2037+
</ul>
2038+
</ins>
2039+
</li>
2040+
</bl>
2041+
</ins>
2042+
</cxx-remarks>
2043+
2044+
<p>
2045+
<ins>
2046+
The return type is
2047+
</ins>
2048+
2049+
<bl>
2050+
<li>
2051+
<ins>
2052+
<code>T</code> if <code>is_simd_v&lt;T&gt;</code> is <code>true</code>, otherwise
2053+
</ins>
2054+
</li>
2055+
2056+
<li>
2057+
<ins>
2058+
<code>simd&lt;T, Abi&gt;</code> is <code>U</code> is <code>T</code>, otherwise
2059+
</ins>
2060+
</li>
2061+
2062+
<li>
2063+
<ins>
2064+
<code>simd&lt;T, simd_abi::fixed_size&lt;simd&lt;U, Abi&gt;::size()&gt;&gt;</code>
2065+
</ins>
2066+
</li>
2067+
</bl>
2068+
<br>
2069+
</cxx-function>
2070+
2071+
<cxx-function>
2072+
<cxx-signature><ins>template&lt;class T, class U, class Abi&gt; <em>see-below</em> static_simd_cast(const simd&lt;U, Abi&gt;& x);</ins></cxx-signature>
2073+
2074+
<p>
2075+
<ins>
2076+
Let <code>To</code> identify <code>T::value_type</code> if <code>is_simd_v&lt;T&gt;</code> is <code>true</code> or <code>T</code> otherwise.
2077+
</ins>
2078+
</p>
2079+
2080+
<cxx-returns>
2081+
<ins>
2082+
A <code>simd</code> object with the <em>i</em>-th element initialized to <code>static_cast&lt;To&gt;(x[i])</code> for all <code>i</code> &#8714; <code>[0, size())</code>.
2083+
</ins>
2084+
</cxx-returns>
2085+
2086+
<cxx-throws>
2087+
<ins>
2088+
Nothing.
2089+
</ins>
2090+
</cxx-throws>
2091+
2092+
<cxx-remarks>
2093+
<ins>
2094+
The function shall not participate in overload resolution unless either
2095+
2096+
<bl>
2097+
<li>
2098+
<ins>
2099+
<code>is_simd_v&lt;T&gt;</code> is <code>false</code>, or
2100+
</ins>
2101+
</li>
2102+
2103+
<li>
2104+
<ins>
2105+
<code>T::size() == simd&lt;U, Abi&gt;::size()</code> is <code>true</code>.
2106+
</ins>
2107+
</li>
2108+
</bl>
2109+
</ins>
2110+
</cxx-remarks>
2111+
2112+
<p>
2113+
<ins>The return type is</ins>
2114+
2115+
<bl>
2116+
<li>
2117+
<ins>
2118+
<code>T</code> if <code>is_simd_v&lt;T&gt;</code> is <code>true</code>, otherwise
2119+
</ins>
2120+
</li>
2121+
2122+
<li>
2123+
<ins>
2124+
<code>simd&lt;T, Abi&gt;</code> if either <code>U</code> is <code>T</code> or <code>U</code> and <code>T</code> are integral types that only differ in signedness, otherwise
2125+
</ins>
2126+
</li>
2127+
2128+
<li>
2129+
<ins>
2130+
<code>simd&lt;T, simd_abi::fixed_size&lt;simd&lt;U, Abi&gt;::size()&gt;&gt;</code>.
2131+
</ins>
2132+
</li>
2133+
</bl>
2134+
<br>
2135+
</cxx-function>
2136+
2137+
<cxx-function>
2138+
<cxx-signature><ins>
2139+
template&lt;class T, class Abi&gt;
2140+
fixed_size_simd&lt;T, simd_size_v&lt;T, Abi&gt;&gt; to_fixed_size(const simd&lt;T, Abi&gt;& x) noexcept;
2141+
template&lt;class T, class Abi&gt;
2142+
fixed_size_simd_mask&lt;T, simd_size_v&lt;T, Abi&gt;&gt; to_fixed_size(const simd_mask&lt;T, Abi&gt;& x) noexcept;
2143+
</ins></cxx-signature>
2144+
2145+
<cxx-returns>
2146+
<ins>
2147+
A data-parallel object with the <em>i</em>-th element initialized to <code>x[i]</code> for all <code>i</code> &#8714; <code>[0, size())</code>.
2148+
</ins>
2149+
</cxx-returns>
2150+
</cxx-function>
2151+
2152+
<cxx-function>
2153+
<cxx-signature><ins>
2154+
template&lt;class T, int N&gt; native_simd&lt;T&gt; to_native(const fixed_size_simd&lt;T, N&gt;& x) noexcept;
2155+
template&lt;class T, int N&gt; native_simd_mask&lt;T&gt; to_native(const fixed_size_simd_mask&lt;T, N&gt;& x) noexcept;
2156+
</ins></cxx-signature>
2157+
2158+
<cxx-returns>
2159+
<ins>
2160+
A data-parallel object with the <em>i</em>-th element initialized to <code>x[i]</code> for all <code>i</code> &#8714; <code>[0, size())</code>.
2161+
</ins>
2162+
</cxx-returns>
2163+
2164+
<cxx-remarks>
2165+
<ins>
2166+
These functions shall not participate in overload resolution unless <code>simd_size_v&lt;T, simd_abi::native&lt;T&gt;&gt; == N</code> is <code>true</code>.
2167+
</ins>
2168+
</cxx-remarks>
2169+
</cxx-function>
2170+
2171+
<cxx-function>
2172+
<cxx-signature><ins>
2173+
template&lt;class T, int N&gt; simd&lt;T&gt; to_compatible(const fixed_size_simd&lt;T, N&gt;& x) noexcept;
2174+
template&lt;class T, int N&gt; simd_mask&lt;T&gt; to_compatible(const fixed_size_simd_mask&lt;T, N&gt;& x) noexcept;
2175+
</ins></cxx-signature>
2176+
2177+
<cxx-returns>
2178+
<ins>
2179+
A data-parallel object with the <em>i</em>-th element initialized to <code>x[i]</code> for all <code>i</code> &#8714; <code>[0, size())</code>.
2180+
</ins>
2181+
</cxx-returns>
2182+
2183+
<cxx-remarks>
2184+
<ins>
2185+
These functions shall not participate in overload resolution unless <code>simd_size_v&lt;T, simd_abi::compatible&lt;T&gt;&gt; == N</code> is <code>true</code>.
2186+
</ins>
2187+
</cxx-remarks>
2188+
</cxx-function>
2189+
2190+
<cxx-function>
2191+
<cxx-signature><ins>
2192+
template&lt;size_t... Sizes, class T, class Abi&gt;
2193+
tuple&lt;simd&lt;T, simd_abi::deduce_t&lt;T, Sizes&gt;&gt;...&gt; split(const simd&lt;T, Abi&gt;& x);
2194+
template&lt;size_t... Sizes, class T, class Abi&gt;
2195+
tuple&lt;simd_mask&lt;T, simd_abi::deduce_t&lt;T, Sizes&gt;&gt;...&gt; split(const simd_mask&lt;T, Abi&gt;& x);
2196+
</ins></cxx-signature>
2197+
2198+
<cxx-returns>
2199+
<ins>
2200+
A <code>tuple</code> of data-parallel objects with the <em>i</em>-th <code>simd</code>/<code>simd_mask</code> element of the <em>j</em>-th <code>tuple</code> element initialized to the value of the element <code>x</code> with index <em>i</em> + sum of the first <em>j</em> values in the <code>Sizes</code> pack.
2201+
</ins>
2202+
</cxx-returns>
2203+
2204+
<cxx-remarks>
2205+
<ins>
2206+
These functions shall not participate in overload resolution unless the sum of all values in the <code>Sizes</code> pack is equal to <code>simd_size_v&lt;T, Abi&gt;</code>.
2207+
</ins>
2208+
</cxx-remarks>
2209+
</cxx-function>
2210+
2211+
<cxx-function>
2212+
<cxx-signature><ins>
2213+
template&lt;class V, class Abi&gt;
2214+
array&lt;V, simd_size_v&lt;typename V::value_type, Abi&gt; / V::size()&gt; split(const simd&lt;typename V::value_type, Abi&gt;& x);
2215+
template&lt;class V, class Abi&gt;
2216+
array&lt;V, simd_size_v&lt;typename V::value_type, Abi&gt; / V::size()&gt; split(const simd_mask&lt;typename V::value_type, Abi&gt;& x);
2217+
</ins></cxx-signature>
2218+
2219+
<cxx-returns>
2220+
<ins>
2221+
An <code>array</code> of data-parallel objects with the <em>i</em>-th <code>simd</code>/<code>simd_mask</code> element of the <em>j</em>-th <code>array</code> element initialized to the value of the element in <code>x</code> with index <code><em>i</em> + <em>j</em> * V::size()</code>.
2222+
</ins>
2223+
</cxx-returns>
2224+
2225+
<cxx-remarks>
2226+
<ins>
2227+
These functions shall not participate in overload resolution unless
2228+
2229+
<bl>
2230+
<li>
2231+
<ins>
2232+
<code>simd_size_v&lt;typename V::value_type, Abi&gt;</code> is an integral multiple of <code>V::size()</code>, and
2233+
</ins>
2234+
</li>
2235+
2236+
<li>
2237+
<ins>
2238+
for the overload with a <code>simd</code> parameter <code>is_simd_v&lt;V&gt;</code> is <code>true</code>, for the overload with a <code>simd_mask</code> parameter <code>is_simd_mask_v&lt;V&gt;</code> is <code>true</code>.
2239+
</ins>
2240+
</li>
2241+
</bl>
2242+
</ins>
2243+
</cxx-remarks>
2244+
</cxx-function>
2245+
2246+
<cxx-function>
2247+
<cxx-signature><ins>
2248+
template&lt;class T, class... Abis&gt;
2249+
simd&lt;T, simd_abi::deduce_t&lt;T, (simd_size_v&lt;T, Abis&gt; + ...)&gt;&gt; concat(const simd&lt;T, Abis&gt;&... xs);
2250+
template&lt;class T, class... Abis&gt;
2251+
simd_mask&lt;T, simd_abi::deduce_t&lt;T, (simd_size_v&lt;T, Abis&gt; + ...)&gt;&gt; concat(const simd_mask&lt;T, Abis&gt;&... xs);
2252+
</ins></cxx-signature>
2253+
2254+
<cxx-returns>
2255+
<ins>
2256+
A data-parallel object initialized with the concatenated values in the <code>xs</code> pack of data-parallel objects: The <em>i</em>-th <code>simd</code>/<code>simd_mask</code> element of the <em>j</em>-th parameter in the <code>xs</code> pack is copied to the return value's element with index <em>i</em> + the sum of the width of the first <em>j</em> parameters in the <code>xs</code> pack.
2257+
</ins>
2258+
</cxx-returns>
2259+
</cxx-function>
2260+
</cxx-section>
19852261
</cxx-section>
19862262
</cxx-section>
19872263
</cxx-clause>

0 commit comments

Comments
 (0)