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 float comparison operators to Winch #7379

Merged

Conversation

jeffcharles
Copy link
Contributor

Part of #6528. Adds support for the f32.eq, f64.eq, f32.ne, f64.ne, f32.lt, f64.lt, f32.gt, f64.gt, f32.le, f64.le, f32.ge, and f64.ge operators to Winch.

Also renames the macroassembler CmpKind enum to IntCmpKind due to the introduction of a FloatCmpKind enum.

@jeffcharles jeffcharles requested review from a team as code owners October 26, 2023 14:44
@jeffcharles jeffcharles requested review from elliottt and alexcrichton and removed request for a team October 26, 2023 14:44
@alexcrichton alexcrichton requested review from saulecabrera and removed request for alexcrichton October 26, 2023 14:50
Copy link
Member

@saulecabrera saulecabrera 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 to me overall -- one minor documentation change and I think we can land this.

Comment on lines 682 to 689
let (src1, src2, set_kind) = match kind {
FloatCmpKind::Eq => (src1, src2, IntCmpKind::Eq),
FloatCmpKind::Ne => (src1, src2, IntCmpKind::Ne),
FloatCmpKind::Lt => (src2, src1, IntCmpKind::GtU),
FloatCmpKind::Le => (src2, src1, IntCmpKind::GeU),
FloatCmpKind::Gt => (src2, src1, IntCmpKind::LtU),
FloatCmpKind::Ge => (src2, src1, IntCmpKind::LeU),
};
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a comment here explaining why we use the comp kind complement? (e.g. Ge => LeU)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's fair. I realized when writing the comments that we only need to perform the complementary comparisons for lt and le given we need to have the PF checks for gt and ge so we're not saving any instructions by swapping those so we no longer swap those.

@github-actions github-actions bot added fuzzing Issues related to our fuzzing infrastructure winch Winch issues or pull requests labels Oct 26, 2023
@github-actions
Copy link

Subscribe to Label Action

cc @fitzgen, @saulecabrera

This issue or pull request has been labeled: "fuzzing", "winch"

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

  • fitzgen: fuzzing
  • saulecabrera: winch

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

Learn more.

@saulecabrera saulecabrera added this pull request to the merge queue Oct 26, 2023
Merged via the queue into bytecodealliance:main with commit 0d797f7 Oct 26, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzzing Issues related to our fuzzing infrastructure winch Winch issues or pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants