Skip to content

Implement nontrapping-f2i proposal #1651

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 2 commits into from
Jan 31, 2021
Merged

Implement nontrapping-f2i proposal #1651

merged 2 commits into from
Jan 31, 2021

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Jan 31, 2021

This PR implements the meanwhile finished Non-trapping float-to-int Conversion Proposal, suggesting to make it the default behavior over the respective trapping instructions. Reasoning is that trapping can lead to all sorts of breakage with the current runtime, so relying on that would be dangerous.

Keeps the feature behind a flag for now because Safari doesn't yet support it. A follow-up PR could be to explicitly opt-in to trapping operations if so desired, by using a new checked(...) builtin.

  • I've read the contributing guidelines

@dcodeIO dcodeIO requested a review from MaxGraey January 31, 2021 19:51
Copy link
Member

@MaxGraey MaxGraey left a comment

Choose a reason for hiding this comment

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

Nice!

@MaxGraey
Copy link
Member

MaxGraey commented Jan 31, 2021

Btw binaryen has special suturation mode which can help for now: --trapMode=clamp. It should polyfill f2i-saturation

@dcodeIO
Copy link
Member Author

dcodeIO commented Jan 31, 2021

Trying out trapMode, it seems this also legalizes division by zero etc. Not sure if we want that as well?

@MaxGraey
Copy link
Member

Trying out trapMode, it seems this also legalizes division by zero etc

Hmm, in this case better avoid this

@dcodeIO dcodeIO merged commit 1188b8a into master Jan 31, 2021
@dcodeIO dcodeIO deleted the nontrapping-f2i branch June 1, 2021 15:20
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