Skip to content

x64: Drop the REX prefix in a few more cases #11022

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

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

alexcrichton
Copy link
Member

This commit fixes a few cases where a REX prefix is emitted for an instruction but was not actually required. The REX prefix is unconditionally emitted in situations where 8-bit registers are referenced and one of the registers referenced has an encoding between 4-7. This logic was mistakenly applied to addressing modes as well, however, where 8-bit registers are not referenced and instead 64-bit registers are used.

This commit adds a few comments, refactors a few things, and makes it such that "special registers" are not tested for operands to addressing modes (e.g. the base register).

This commit fixes a few cases where a REX prefix is emitted for an
instruction but was not actually required. The REX prefix is
unconditionally emitted in situations where 8-bit registers are
referenced and one of the registers referenced has an encoding between
4-7. This logic was mistakenly applied to addressing modes as well,
however, where 8-bit registers are not referenced and instead 64-bit
registers are used.

This commit adds a few comments, refactors a few things, and makes it
such that "special registers" are not tested for operands to addressing
modes (e.g. the base register).
@alexcrichton alexcrichton requested review from a team as code owners June 12, 2025 01:15
@alexcrichton alexcrichton requested review from abrown and fitzgen and removed request for a team June 12, 2025 01:15
@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Jun 12, 2025
@fitzgen fitzgen added this pull request to the merge queue Jun 12, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2025
@alexcrichton alexcrichton added this pull request to the merge queue Jun 12, 2025
Merged via the queue into bytecodealliance:main with commit cd830c7 Jun 12, 2025
41 checks passed
@alexcrichton alexcrichton deleted the x64-less-rex branch June 12, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants