Skip to content

Implement nontrapping-f2i proposal#1651

Merged
dcodeIO merged 2 commits intomasterfrom
nontrapping-f2i
Jan 31, 2021
Merged

Implement nontrapping-f2i proposal#1651
dcodeIO merged 2 commits intomasterfrom
nontrapping-f2i

Conversation

@dcodeIO
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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