Skip to content
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

<bit>: Remove tzcnt special case for small integers in countr_zero #1540

Merged
merged 7 commits into from
Jan 15, 2021
Merged

<bit>: Remove tzcnt special case for small integers in countr_zero #1540

merged 7 commits into from
Jan 15, 2021

Conversation

sylveon
Copy link
Contributor

@sylveon sylveon commented Dec 17, 2020

Fixes #1534

This moves the check for tzcnt inside the else case, improving codegen for small integer types (short and char)

Here's a Godbolt sample comparing the assembly output before and after: https://godbolt.org/z/K6nz8z

@sylveon sylveon requested a review from a team as a code owner December 17, 2020 05:26
@sylveon sylveon changed the title <bit>: Remove special case for small integers in countr_zero <bit>: Remove tzcnt special case for small integers in countr_zero Dec 17, 2020
@StephanTLavavej StephanTLavavej added the performance Must go faster label Dec 17, 2020
stl/inc/limits Outdated Show resolved Hide resolved
stl/inc/limits Show resolved Hide resolved
stl/inc/limits Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej self-assigned this Jan 6, 2021
stl/inc/limits Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Jan 9, 2021
@StephanTLavavej StephanTLavavej self-assigned this Jan 12, 2021
@StephanTLavavej StephanTLavavej merged commit 4115106 into microsoft:master Jan 15, 2021
@StephanTLavavej
Copy link
Member

Thanks for improving the performance of these functions, and for verifying the before-and-after codegen! 🚀 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<bit>: countr_zero() doesn't need to special-case 0 for uint8_t and uint16_t
5 participants