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

Add sextend_maybe and uextend_maybe to opt ISLE #7710

Merged
merged 2 commits into from
Dec 20, 2023

Conversation

scottmcm
Copy link
Contributor

Working on something else, I noticed that the (x < y) != 0 opt was written in a way that only works for C

;; Optimize icmp-of-icmp.
(rule (simplify (ne ty
(uextend _ inner @ (icmp ty _ _ _))
(iconst_u _ 0)))
(subsume inner))
(rule (simplify (eq ty
(uextend _ (icmp ty cc x y))
(iconst_u _ 0)))
(subsume (icmp ty (intcc_complement cc) x y)))

whereas in Rust, which doesn't have the "usual arithmetic conversions", the result of the comparison stays as I8 and thus without the extension it didn't match that pattern.

This picks up a suggestion that alex had made in a previous PR (#7636 (comment)) to make something like lowering ISLE's maybe_uextend extractor for optimization ISLE.

They're then used to improve the mentioned icmp-of-icmp pattern

8ef0b81#diff-fa420f878e321dc6579ac911f9ba8820a9381e4c49615584f6e6909f0e329dfcL124-R125

as well as simplify some of the duplication in the <=> patterns.

@scottmcm scottmcm requested a review from a team as a code owner December 20, 2023 01:54
@scottmcm scottmcm requested review from elliottt and removed request for a team December 20, 2023 01:54
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language labels Dec 20, 2023
Copy link

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Nice!

@fitzgen fitzgen added this pull request to the merge queue Dec 20, 2023
Merged via the queue into bytecodealliance:main with commit 37300d3 Dec 20, 2023
18 checks passed
@scottmcm scottmcm deleted the opt-extend-maybe branch December 20, 2023 22:28
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 isle Related to the ISLE domain-specific language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants