utf16fix_block_rvv: improve mask shift #842
Merged
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.
This shifts the mask register directly, instead of shifting the vector elements and recomputing the mask.
It allows us to operate on a reduced LMUL, instead of the original 4 LMUL=8 instructions, it's now 3 LMUL=1/2, which should be a lot faster: https://godbolt.org/z/5Wc11z7f6
Sadly there are no dedicated mask shift instructions in RVV yet, so we have to emulate it with element slide and element-wise bit-shifts.
While this works, for right shifts it requires vl=vlmax, otherwise the vslide1down may shift in undefined bits.
So I adjusted the code to use the mask shift in the inner loop and handle the tail with the old behavior.
I also moved the
implementation::*functions to the respectivervv_*.cppfiles to keep the coding style consistent.