Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simplify validate_utf16be for icelake and rvv #777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025

Conversation

WojciechMula
Copy link
Collaborator

We need only inspect most significant byte. In the case of icelake kernel pshufb is replaced with shift --- it's not a big change, just noticed that AMD Zen4 has latency 1 cycle for shift , and 2 cycles for pshufb.

In the case of rvv we completely rid of endianness changing, resulting in the same code for LE and BE variants.

We really need the most significant byte to validate UTF-16,
full endianess conversion is not needed.
We really need the most significant byte to validate UTF-16,
full endianess conversion is not needed.

Manually checked that the generated for both UTF-16le
and UTF-16be validation is exactly the same.
@WojciechMula WojciechMula requested a review from lemire May 1, 2025 10:33
@WojciechMula WojciechMula merged commit 144709b into simdutf:master May 1, 2025
54 checks passed
@WojciechMula WojciechMula deleted the better-validate-utf16be branch May 1, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants