Skip to content

<bit>: fix countl_zero on arm64 - #2647

Merged
Stephan T. Lavavej (StephanTLavavej) merged 3 commits into
microsoft:mainfrom
barcharcraz:bit_arm64_fix
Apr 16, 2022
Merged

<bit>: fix countl_zero on arm64#2647
Stephan T. Lavavej (StephanTLavavej) merged 3 commits into
microsoft:mainfrom
barcharcraz:bit_arm64_fix

Conversation

@barcharcraz

@barcharcraz Charlie Barto (barcharcraz) commented Apr 11, 2022

Copy link
Copy Markdown
Contributor

Fix countl_zero on arm64 to properly subtract the zeros resulting from widening.

Because of a lack of test coverage, we forgot that _CountLeadingZeros takes unsigned long, and thus for types shorter than that we need to subtract the extra zeros from the result.

@barcharcraz
Charlie Barto (barcharcraz) requested a review from a team as a code owner April 11, 2022 22:37
@CaseyCarter Casey Carter (CaseyCarter) added bug Something isn't working ARM64 Related to the ARM64 architecture labels Apr 11, 2022
@CaseyCarter Casey Carter (CaseyCarter) changed the title <bit>: fix countl_zero on arm64 <bit>: fix countl_zero on arm64 Apr 11, 2022
@MikeGitb

Copy link
Copy Markdown

Did the buggy version make it into a release?

Comment thread stl/inc/bit Outdated
Comment thread stl/inc/bit Outdated
@StephanTLavavej

Copy link
Copy Markdown
Member

MikeGitb (@MikeGitb)

Did the buggy version make it into a release?

Yes, this was introduced by #795 merged on 2020-07-01, shipped in VS 2019 16.8.

@StephanTLavavej

Copy link
Copy Markdown
Member

Charlie Barto (@barcharcraz) Casey Carter (@CaseyCarter) I went ahead and pushed changes for the issue that Alex noticed, as we talked about it during the maintainer meeting.

@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 3ab44c2 into microsoft:main Apr 16, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for finding and fixing this silent bad codegen! 🐞 πŸ” βœ…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ARM64 Related to the ARM64 architecture bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants