Skip to content

winch(x64): Avoid undefined behavior on ctz/clz#13829

Merged
fitzgen merged 1 commit into
bytecodealliance:mainfrom
saulecabrera:winch-fix-clz-ctz
Jul 6, 2026
Merged

winch(x64): Avoid undefined behavior on ctz/clz#13829
fitzgen merged 1 commit into
bytecodealliance:mainfrom
saulecabrera:winch-fix-clz-ctz

Conversation

@saulecabrera

Copy link
Copy Markdown
Member

Fixes #13746

Optimizes the fallback sequence emitted in clz/ctz for the x64 backend, emitting a conditional move to ensure that the destination register is always defined when the source register is zero.

Fixes bytecodealliance#13746

Optimizes the fallback sequence emitted in clz/ctz for the x64 backend,
emitting a conditional move to ensure that the destination register is
always defined when the source register is zero.
@saulecabrera saulecabrera requested review from a team as code owners July 6, 2026 19:35
@saulecabrera saulecabrera requested review from fitzgen and removed request for a team July 6, 2026 19:35

@fitzgen fitzgen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fitzgen fitzgen added this pull request to the merge queue Jul 6, 2026
Merged via the queue into bytecodealliance:main with commit 8c4618a Jul 6, 2026
53 checks passed
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.

winch x86: unspecified behavior in clz/ctz on hosts without lzcnt/bmi1

2 participants