Skip to content
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

Use 32-bit XORRegReg to zero registers on x64 #7295

Closed
0xdaryl opened this issue Mar 27, 2024 · 0 comments
Closed

Use 32-bit XORRegReg to zero registers on x64 #7295

0xdaryl opened this issue Mar 27, 2024 · 0 comments

Comments

@0xdaryl
Copy link
Contributor

0xdaryl commented Mar 27, 2024

When XORRegReg is used to zero a register on x64, the 32-bit operand form should be used because the upper 32-bits of the result are automatically zero extended. This will save a REX prefix on each of these instructions (1 byte savings).

Sweep through the x86 code generator looking at where XORRegReg or XOR8RegReg is used for the purpose of zeroing a register and ensure it uses XOR4RegReg instead. I found a few on inspection.

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

No branches or pull requests

1 participant