Skip to content

Avoid CMOV with CFeq #2571

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 3 commits into from
May 15, 2024
Merged

Avoid CMOV with CFeq #2571

merged 3 commits into from
May 15, 2024

Conversation

gretay-js
Copy link
Contributor

@gretay-js gretay-js commented May 14, 2024

Improve code generation for Icsel when the condition is float equality. This condition is not directly expressible as a CMOV mnemonic. To work around it, the compiler emits a jump instruction (to correctly handle the special case of Nan argument), defeating the purpose of CMOV. This PR adds an ad-hoc pattern during Selection to detect this case, negate the condition and swap the arguments of CMOV.

Added a test to exercise this special case. I'm not adding any assembly grepping, because it's too fragile.

@gretay-js gretay-js requested review from xclerc and TheNumbat May 14, 2024 16:24
@gretay-js gretay-js merged commit 39103eb into oxcaml:main May 15, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants