Skip to content

Commit

Permalink
deploy: 7e162d1
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Oct 22, 2024
1 parent 3f79b14 commit 544ace3
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core_simd/simd/struct.Simd.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ <h2 id="safe-simd-with-unsafe-rust"><a class="doc-anchor" href="#safe-simd-with-

<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = u32x4::from_array([<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);
<span class="macro">assert_eq!</span>(x.extract::&lt;<span class="number">1</span>, <span class="number">2</span>&gt;().to_array(), [<span class="number">1</span>, <span class="number">2</span>]);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Simd%3Cu8,+N%3E" class="impl"><a class="src rightside" href="../../src/core_simd/swizzle_dyn.rs.html#4-99">source</a><a href="#impl-Simd%3Cu8,+N%3E" class="anchor">§</a><h3 class="code-header">impl&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>&gt; <a class="struct" href="struct.Simd.html" title="struct core_simd::simd::Simd">Simd</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>, N&gt;<div class="where">where
<a class="struct" href="struct.LaneCount.html" title="struct core_simd::simd::LaneCount">LaneCount</a>&lt;N&gt;: <a class="trait" href="trait.SupportedLaneCount.html" title="trait core_simd::simd::SupportedLaneCount">SupportedLaneCount</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.swizzle_dyn" class="method"><a class="src rightside" href="../../src/core_simd/swizzle_dyn.rs.html#17-98">source</a><h4 class="code-header">pub fn <a href="#method.swizzle_dyn" class="fn">swizzle_dyn</a>(self, idxs: <a class="struct" href="struct.Simd.html" title="struct core_simd::simd::Simd">Simd</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>, N&gt;) -&gt; Self</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>portable_simd</code>)</span></div></span></summary><div class="docblock"><p>Swizzle a vector of bytes according to the index vector.
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Simd%3Cu8,+N%3E" class="impl"><a class="src rightside" href="../../src/core_simd/swizzle_dyn.rs.html#4-106">source</a><a href="#impl-Simd%3Cu8,+N%3E" class="anchor">§</a><h3 class="code-header">impl&lt;const N: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>&gt; <a class="struct" href="struct.Simd.html" title="struct core_simd::simd::Simd">Simd</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>, N&gt;<div class="where">where
<a class="struct" href="struct.LaneCount.html" title="struct core_simd::simd::LaneCount">LaneCount</a>&lt;N&gt;: <a class="trait" href="trait.SupportedLaneCount.html" title="trait core_simd::simd::SupportedLaneCount">SupportedLaneCount</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.swizzle_dyn" class="method"><a class="src rightside" href="../../src/core_simd/swizzle_dyn.rs.html#17-105">source</a><h4 class="code-header">pub fn <a href="#method.swizzle_dyn" class="fn">swizzle_dyn</a>(self, idxs: <a class="struct" href="struct.Simd.html" title="struct core_simd::simd::Simd">Simd</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>, N&gt;) -&gt; Self</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>portable_simd</code>)</span></div></span></summary><div class="docblock"><p>Swizzle a vector of bytes according to the index vector.
Indices within range select the appropriate byte.
Indices “out of bounds” instead select 0.</p>
<p>Note that the current implementation is selected during build-time
Expand Down
58 changes: 58 additions & 0 deletions src/core_simd/swizzle_dyn.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,35 @@
<a href="#173" id="173">173</a>
<a href="#174" id="174">174</a>
<a href="#175" id="175">175</a>
<a href="#176" id="176">176</a>
<a href="#177" id="177">177</a>
<a href="#178" id="178">178</a>
<a href="#179" id="179">179</a>
<a href="#180" id="180">180</a>
<a href="#181" id="181">181</a>
<a href="#182" id="182">182</a>
<a href="#183" id="183">183</a>
<a href="#184" id="184">184</a>
<a href="#185" id="185">185</a>
<a href="#186" id="186">186</a>
<a href="#187" id="187">187</a>
<a href="#188" id="188">188</a>
<a href="#189" id="189">189</a>
<a href="#190" id="190">190</a>
<a href="#191" id="191">191</a>
<a href="#192" id="192">192</a>
<a href="#193" id="193">193</a>
<a href="#194" id="194">194</a>
<a href="#195" id="195">195</a>
<a href="#196" id="196">196</a>
<a href="#197" id="197">197</a>
<a href="#198" id="198">198</a>
<a href="#199" id="199">199</a>
<a href="#200" id="200">200</a>
<a href="#201" id="201">201</a>
<a href="#202" id="202">202</a>
<a href="#203" id="203">203</a>
<a href="#204" id="204">204</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::simd::{LaneCount, Simd, SupportedLaneCount};
<span class="kw">use </span>core::mem;

Expand Down Expand Up @@ -232,6 +261,13 @@
target_endian = <span class="string">"little"
</span>))]
</span><span class="number">16 </span>=&gt; transize(vqtbl1q_u8, <span class="self">self</span>, idxs),
<span class="attr">#[cfg(all(
target_arch = <span class="string">"arm"</span>,
target_feature = <span class="string">"v7"</span>,
target_feature = <span class="string">"neon"</span>,
target_endian = <span class="string">"little"
</span>))]
</span><span class="number">16 </span>=&gt; transize(armv7_neon_swizzle_u8x16, <span class="self">self</span>, idxs),
<span class="attr">#[cfg(all(target_feature = <span class="string">"avx2"</span>, not(target_feature = <span class="string">"avx512vbmi"</span>)))]
</span><span class="number">32 </span>=&gt; transize(avx2_pshufb, <span class="self">self</span>, idxs),
<span class="attr">#[cfg(all(target_feature = <span class="string">"avx512vl"</span>, target_feature = <span class="string">"avx512vbmi"</span>))]
Expand Down Expand Up @@ -273,6 +309,28 @@
}
}

<span class="doccomment">/// armv7 neon supports swizzling `u8x16` by swizzling two u8x8 blocks
/// with a u8x8x2 lookup table.
///
/// # Safety
/// This requires armv7 neon to work
</span><span class="attr">#[cfg(all(
target_arch = <span class="string">"arm"</span>,
target_feature = <span class="string">"v7"</span>,
target_feature = <span class="string">"neon"</span>,
target_endian = <span class="string">"little"
</span>))]
</span><span class="kw">unsafe fn </span>armv7_neon_swizzle_u8x16(bytes: Simd&lt;u8, <span class="number">16</span>&gt;, idxs: Simd&lt;u8, <span class="number">16</span>&gt;) -&gt; Simd&lt;u8, <span class="number">16</span>&gt; {
<span class="kw">use </span>core::arch::arm::{uint8x8x2_t, vcombine_u8, vget_high_u8, vget_low_u8, vtbl2_u8};
<span class="comment">// SAFETY: Caller promised arm neon support
</span><span class="kw">unsafe </span>{
<span class="kw">let </span>bytes = uint8x8x2_t(vget_low_u8(bytes.into()), vget_high_u8(bytes.into()));
<span class="kw">let </span>lo = vtbl2_u8(bytes, vget_low_u8(idxs.into()));
<span class="kw">let </span>hi = vtbl2_u8(bytes, vget_high_u8(idxs.into()));
vcombine_u8(lo, hi).into()
}
}

<span class="doccomment">/// "vpshufb like it was meant to be" on AVX2
///
/// # Safety
Expand Down
2 changes: 1 addition & 1 deletion type.impl/core_simd/simd/struct.Simd.js

Large diffs are not rendered by default.

0 comments on commit 544ace3

Please sign in to comment.