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

Fix generation of immediates for and/or/xor. #1553

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

ltratt
Copy link
Contributor

@ltratt ltratt commented Jan 18, 2025

We were incorrectly sign extending immediates in these cases, which was particularly obvious in the i1 case where things like xor %0, 1i1 would become (in x64) xor r11d, 0xffffffff. This commit splits apart zero and sign extension cases more carefully so that xor r11d, 0x01 is generated.

We were incorrectly sign extending immediates in these cases, which was
particularly obvious in the `i1` case where things like `xor %0, 1i1`
would become (in x64) `xor r11d, 0xffffffff`. This commit splits apart
zero and sign extension cases more carefully so that `xor r11d, 0x01` is
generated.
@vext01
Copy link
Contributor

vext01 commented Jan 20, 2025

So this is an optimisation, right?

@ltratt
Copy link
Contributor Author

ltratt commented Jan 20, 2025

No -- it's a fix!

@vext01
Copy link
Contributor

vext01 commented Jan 20, 2025

We spoke about this offline and, although the old generated code harder for a human to read, it appears to be correct.

The new generated code is also correct, so I'm merging this on the grounds that it makes the generated code easier for a human to read.

That it fixes something suggests that some other operation is failing to zero off undefined bits before doing its computation, but @ltratt says he's cooking something up to make it harder for that to happen in the future.

@vext01 vext01 added this pull request to the merge queue Jan 20, 2025
Merged via the queue into ykjit:master with commit 0a39cfc Jan 20, 2025
2 checks passed
@ltratt ltratt deleted the fix_immediates branch January 20, 2025 11:12
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.

2 participants