Add an explicit SSE2 path for batch_bool_constant masks where the three#1372
Merged
serge-sans-paille merged 1 commit intoJul 7, 2026
Merged
Conversation
serge-sans-paille
requested changes
Jul 6, 2026
| } | ||
| else XSIMD_IF_CONSTEXPR(mask.countr_one() == 3) | ||
| { | ||
| __m128 const lo2 = _mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64 const*>(mem)); |
Contributor
There was a problem hiding this comment.
looks like _mm_loadl_epi64 would be slightly better.
low lanes are active and lane 3 is zero ({T,T,T,F} = countr_one()==3).
load_masked<float>: movsd (lanes 0,1) + movss (lane 2) + shufps into
[lo0, lo1, ss0, 0].
store_masked<float>: storel_pi (lanes 0,1) + movehl+store_ss (lane 2).
Without this both paths fell through to the common-arch scalar-buffer
fallback (zero-init std::array + element-wise scatter + aligned reload),
e220b07 to
099b5a7
Compare
Contributor
Author
serge-sans-paille
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an explicit SSE2 path for batch_bool_constant masks where the three
low lanes are active and lane 3 is zero ({T,T,T,F} = countr_one()==3).
load_masked: movsd (lanes 0,1) + movss (lane 2) + shufps into
[lo0, lo1, ss0, 0].
store_masked: storel_pi (lanes 0,1) + movehl+store_ss (lane 2).
Without this both paths fell through to the common-arch scalar-buffer
fallback (zero-init std::array + element-wise scatter + aligned reload) (when compiler optimization was < -O3)