Skip to content

Commit

Permalink
deploy: 8c31005
Browse files Browse the repository at this point in the history
  • Loading branch information
calebzulawski committed Jun 5, 2024
1 parent cc396a4 commit 24cf890
Show file tree
Hide file tree
Showing 11 changed files with 539 additions and 328 deletions.
166 changes: 97 additions & 69 deletions core_simd/simd/struct.Mask.html

Large diffs are not rendered by default.

115 changes: 62 additions & 53 deletions core_simd/simd/struct.Simd.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions core_simd/simd/trait.SimdElement.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion search-index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion search.desc/core_simd/core_simd-desc-0-.js

Large diffs are not rendered by default.

84 changes: 0 additions & 84 deletions src/core_simd/masks.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -660,48 +660,6 @@
<a href="#660" id="660">660</a>
<a href="#661" id="661">661</a>
<a href="#662" id="662">662</a>
<a href="#663" id="663">663</a>
<a href="#664" id="664">664</a>
<a href="#665" id="665">665</a>
<a href="#666" id="666">666</a>
<a href="#667" id="667">667</a>
<a href="#668" id="668">668</a>
<a href="#669" id="669">669</a>
<a href="#670" id="670">670</a>
<a href="#671" id="671">671</a>
<a href="#672" id="672">672</a>
<a href="#673" id="673">673</a>
<a href="#674" id="674">674</a>
<a href="#675" id="675">675</a>
<a href="#676" id="676">676</a>
<a href="#677" id="677">677</a>
<a href="#678" id="678">678</a>
<a href="#679" id="679">679</a>
<a href="#680" id="680">680</a>
<a href="#681" id="681">681</a>
<a href="#682" id="682">682</a>
<a href="#683" id="683">683</a>
<a href="#684" id="684">684</a>
<a href="#685" id="685">685</a>
<a href="#686" id="686">686</a>
<a href="#687" id="687">687</a>
<a href="#688" id="688">688</a>
<a href="#689" id="689">689</a>
<a href="#690" id="690">690</a>
<a href="#691" id="691">691</a>
<a href="#692" id="692">692</a>
<a href="#693" id="693">693</a>
<a href="#694" id="694">694</a>
<a href="#695" id="695">695</a>
<a href="#696" id="696">696</a>
<a href="#697" id="697">697</a>
<a href="#698" id="698">698</a>
<a href="#699" id="699">699</a>
<a href="#700" id="700">700</a>
<a href="#701" id="701">701</a>
<a href="#702" id="702">702</a>
<a href="#703" id="703">703</a>
<a href="#704" id="704">704</a>
</pre></div><pre class="rust"><code><span class="doccomment">//! Types and traits associated with masking elements of vectors.
//! Types representing
</span><span class="attr">#![allow(non_camel_case_types)]
Expand Down Expand Up @@ -1012,48 +970,6 @@
<span class="self">Self</span>(mask_impl::Mask::from_bitmask_integer(bitmask))
}

<span class="doccomment">/// Create a bitmask vector from a mask.
///
/// Each bit is set if the corresponding element in the mask is `true`.
/// The remaining bits are unset.
///
/// The bits are packed into the first N bits of the vector:
/// ```
/// # #![feature(portable_simd)]
/// # #[cfg(feature = "as_crate")] use core_simd::simd;
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::mask32x8;
/// let mask = mask32x8::from_array([true, false, true, false, false, false, true, false]);
/// assert_eq!(mask.to_bitmask_vector()[0], 0b01000101);
/// ```
</span><span class="attr">#[inline]
#[must_use = <span class="string">"method returns a new integer and does not mutate the original value"</span>]
</span><span class="kw">pub fn </span>to_bitmask_vector(<span class="self">self</span>) -&gt; Simd&lt;u8, N&gt; {
<span class="self">self</span>.<span class="number">0</span>.to_bitmask_vector()
}

<span class="doccomment">/// Create a mask from a bitmask vector.
///
/// For each bit, if it is set, the corresponding element in the mask is set to `true`.
///
/// The bits are packed into the first N bits of the vector:
/// ```
/// # #![feature(portable_simd)]
/// # #[cfg(feature = "as_crate")] use core_simd::simd;
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::{mask32x8, u8x8};
/// let bitmask = u8x8::from_array([0b01000101, 0, 0, 0, 0, 0, 0, 0]);
/// assert_eq!(
/// mask32x8::from_bitmask_vector(bitmask),
/// mask32x8::from_array([true, false, true, false, false, false, true, false]),
/// );
/// ```
</span><span class="attr">#[inline]
#[must_use = <span class="string">"method returns a new mask and does not mutate the original value"</span>]
</span><span class="kw">pub fn </span>from_bitmask_vector(bitmask: Simd&lt;u8, N&gt;) -&gt; <span class="self">Self </span>{
<span class="self">Self</span>(mask_impl::Mask::from_bitmask_vector(bitmask))
}

<span class="doccomment">/// Find the index of the first set element.
///
/// ```
Expand Down
112 changes: 0 additions & 112 deletions src/core_simd/masks/full_masks.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,62 +299,6 @@
<a href="#299" id="299">299</a>
<a href="#300" id="300">300</a>
<a href="#301" id="301">301</a>
<a href="#302" id="302">302</a>
<a href="#303" id="303">303</a>
<a href="#304" id="304">304</a>
<a href="#305" id="305">305</a>
<a href="#306" id="306">306</a>
<a href="#307" id="307">307</a>
<a href="#308" id="308">308</a>
<a href="#309" id="309">309</a>
<a href="#310" id="310">310</a>
<a href="#311" id="311">311</a>
<a href="#312" id="312">312</a>
<a href="#313" id="313">313</a>
<a href="#314" id="314">314</a>
<a href="#315" id="315">315</a>
<a href="#316" id="316">316</a>
<a href="#317" id="317">317</a>
<a href="#318" id="318">318</a>
<a href="#319" id="319">319</a>
<a href="#320" id="320">320</a>
<a href="#321" id="321">321</a>
<a href="#322" id="322">322</a>
<a href="#323" id="323">323</a>
<a href="#324" id="324">324</a>
<a href="#325" id="325">325</a>
<a href="#326" id="326">326</a>
<a href="#327" id="327">327</a>
<a href="#328" id="328">328</a>
<a href="#329" id="329">329</a>
<a href="#330" id="330">330</a>
<a href="#331" id="331">331</a>
<a href="#332" id="332">332</a>
<a href="#333" id="333">333</a>
<a href="#334" id="334">334</a>
<a href="#335" id="335">335</a>
<a href="#336" id="336">336</a>
<a href="#337" id="337">337</a>
<a href="#338" id="338">338</a>
<a href="#339" id="339">339</a>
<a href="#340" id="340">340</a>
<a href="#341" id="341">341</a>
<a href="#342" id="342">342</a>
<a href="#343" id="343">343</a>
<a href="#344" id="344">344</a>
<a href="#345" id="345">345</a>
<a href="#346" id="346">346</a>
<a href="#347" id="347">347</a>
<a href="#348" id="348">348</a>
<a href="#349" id="349">349</a>
<a href="#350" id="350">350</a>
<a href="#351" id="351">351</a>
<a href="#352" id="352">352</a>
<a href="#353" id="353">353</a>
<a href="#354" id="354">354</a>
<a href="#355" id="355">355</a>
<a href="#356" id="356">356</a>
<a href="#357" id="357">357</a>
</pre></div><pre class="rust"><code><span class="doccomment">//! Masks that take up full SIMD vector registers.

</span><span class="kw">use </span><span class="kw">crate</span>::simd::{LaneCount, MaskElement, Simd, SupportedLaneCount};
Expand Down Expand Up @@ -497,62 +441,6 @@
</span><span class="kw">unsafe </span>{ Mask(core::intrinsics::simd::simd_cast(<span class="self">self</span>.<span class="number">0</span>)) }
}

<span class="attr">#[inline]
#[must_use = <span class="string">"method returns a new vector and does not mutate the original value"</span>]
</span><span class="kw">pub fn </span>to_bitmask_vector(<span class="self">self</span>) -&gt; Simd&lt;u8, N&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>bitmask = Simd::splat(<span class="number">0</span>);

<span class="comment">// Safety: Bytes is the right size array
</span><span class="kw">unsafe </span>{
<span class="comment">// Compute the bitmask
</span><span class="kw">let </span><span class="kw-2">mut </span>bytes: &lt;LaneCount&lt;N&gt; <span class="kw">as </span>SupportedLaneCount&gt;::BitMask =
core::intrinsics::simd::simd_bitmask(<span class="self">self</span>.<span class="number">0</span>);

<span class="comment">// LLVM assumes bit order should match endianness
</span><span class="kw">if </span><span class="macro">cfg!</span>(target_endian = <span class="string">"big"</span>) {
<span class="kw">for </span>x <span class="kw">in </span>bytes.as_mut() {
<span class="kw-2">*</span>x = x.reverse_bits()
}
<span class="kw">if </span>N % <span class="number">8 </span>&gt; <span class="number">0 </span>{
bytes.as_mut()[N / <span class="number">8</span>] &gt;&gt;= <span class="number">8 </span>- N % <span class="number">8</span>;
}
}

bitmask.as_mut_array()[..bytes.as_ref().len()].copy_from_slice(bytes.as_ref());
}

bitmask
}

<span class="attr">#[inline]
#[must_use = <span class="string">"method returns a new mask and does not mutate the original value"</span>]
</span><span class="kw">pub fn </span>from_bitmask_vector(bitmask: Simd&lt;u8, N&gt;) -&gt; <span class="self">Self </span>{
<span class="kw">let </span><span class="kw-2">mut </span>bytes = &lt;LaneCount&lt;N&gt; <span class="kw">as </span>SupportedLaneCount&gt;::BitMask::default();

<span class="comment">// Safety: Bytes is the right size array
</span><span class="kw">unsafe </span>{
<span class="kw">let </span>len = bytes.as_ref().len();
bytes.as_mut().copy_from_slice(<span class="kw-2">&amp;</span>bitmask.as_array()[..len]);

<span class="comment">// LLVM assumes bit order should match endianness
</span><span class="kw">if </span><span class="macro">cfg!</span>(target_endian = <span class="string">"big"</span>) {
<span class="kw">for </span>x <span class="kw">in </span>bytes.as_mut() {
<span class="kw-2">*</span>x = x.reverse_bits();
}
<span class="kw">if </span>N % <span class="number">8 </span>&gt; <span class="number">0 </span>{
bytes.as_mut()[N / <span class="number">8</span>] &gt;&gt;= <span class="number">8 </span>- N % <span class="number">8</span>;
}
}

<span class="comment">// Compute the regular mask
</span><span class="self">Self</span>::from_int_unchecked(core::intrinsics::simd::simd_select_bitmask(
bytes,
<span class="self">Self</span>::splat(<span class="bool-val">true</span>).to_int(),
<span class="self">Self</span>::splat(<span class="bool-val">false</span>).to_int(),
))
}
}

<span class="attr">#[inline]
</span><span class="kw">unsafe fn </span>to_bitmask_impl&lt;U: ReverseBits, <span class="kw">const </span>M: usize&gt;(<span class="self">self</span>) -&gt; U
<span class="kw">where
Expand Down
Loading

0 comments on commit 24cf890

Please sign in to comment.