Skip to content

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

Merged
Stephan T. Lavavej (StephanTLavavej) merged 7 commits into
microsoft:masterfrom
sylveon:countr-zero-small-int
Jan 15, 2021
Merged

<bit>: Remove tzcnt special case for small integers in countr_zero#1540
Stephan T. Lavavej (StephanTLavavej) merged 7 commits into
microsoft:masterfrom
sylveon:countr-zero-small-int

Conversation

@sylveon

@sylveon Charles Milette (sylveon) commented Dec 17, 2020

Copy link
Copy Markdown
Contributor

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
Charles Milette (sylveon) requested a review from a team as a code owner December 17, 2020 05:26
@sylveon Charles Milette (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
Comment thread stl/inc/limits Outdated
Comment thread stl/inc/limits
Comment thread stl/inc/limits Outdated
Comment thread stl/inc/limits Outdated
@StephanTLavavej

Copy link
Copy Markdown
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