Skip to content

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
@StephanTLavavej StephanTLavavej self-assigned this Jan 6, 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