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

refactor: using emit_cmp helper to refactor lowering of selection ins… #7344

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

Solo-steven
Copy link
Contributor

@Solo-steven Solo-steven commented Oct 24, 2023

This PR implements the second part of issue #5869 .

As lowering the select instruction based on fcmp. I declare a helper function for lowering icmp-based select instruction.

@Solo-steven Solo-steven requested a review from a team as a code owner October 24, 2023 07:43
@Solo-steven Solo-steven requested review from cfallin and removed request for a team October 24, 2023 07:43
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:x64 Issues related to x64 codegen labels Oct 24, 2023
Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

Thanks! One formatting nit below, otherwise this seems correct.

Do you expect codegen to improve for any combination of compare and select instructions? If so, could we add a test showing that?

@@ -2082,8 +2082,7 @@
;; than one instruction for certain types (e.g., XMM-held, I128).

(rule (lower (has_type ty (select (maybe_uextend (icmp cc a @ (value_type (fits_in_64 a_ty)) b)) x y)))
(let ((size OperandSize (raw_operand_size_of_type a_ty)))
(with_flags (x64_cmp size b a) (cmove_from_values ty cc x y))))
(lower_select_icmp ty (emit_cmp cc a b ) x y))
Copy link
Member

Choose a reason for hiding this comment

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

formatting nit: remove the space between b and the right-paren?

@Solo-steven
Copy link
Contributor Author

Hi @cfallin thanks for your review, I think this change will behave the same as before, just a simple refactor to using emit_cmp to generate the same x64 code, so I do not expect any improvements.

Because I am new to both ISLE and clif IR, I might be missing some potential improvements we can make. if so please point it out to me , thanks ~

Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! I didn't necessarily expect any codegen changes either, I was just curious if there were any intended. This looks like a pure refactor which is perfectly fine!

@cfallin cfallin added this pull request to the merge queue Oct 26, 2023
Merged via the queue into bytecodealliance:main with commit b1b37f4 Oct 26, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants