-
Notifications
You must be signed in to change notification settings - Fork 34
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
Implement f64.promote_f32 instruction #457
Conversation
bd3ae4a
to
e5a3d18
Compare
128ebd3
to
d677203
Compare
{-FP32::Limits::infinity(), -FP64::Limits::infinity()}, | ||
|
||
// The canonical NaN must result in canonical NaN (only the top bit set). | ||
{FP32::nan(FP32::canon), FP64::nan(FP64::canon)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add -FP32::nan(FP32::canon)
case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And anan cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
-FP32::nan(FP32::canon)
case
Added.
And anan cases?
Outside of the loop as they require sophisticated checks.
850f0d5
to
89cd563
Compare
6faf11b
to
4fe85a3
Compare
Codecov Report
@@ Coverage Diff @@
## master #457 +/- ##
=======================================
Coverage 99.53% 99.53%
=======================================
Files 54 54
Lines 16015 16075 +60
=======================================
+ Hits 15941 16001 +60
Misses 74 74 |
// An arithmetic NaN must result in any arithmetic NaN (payload >= canonical payload). | ||
// The spec allows the result to be the canonical NaN, but in the current implementation it | ||
// is not the case and the check is more restrictive than the spec requires. | ||
const auto res1 = execute(*instance, 0, {FP32::nan(FP32::canon + 1)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add also -FP32::nan(FP32::canon + 1)
and -FP32::nan(1)
cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This is rather straight forward as conversion
f32
tof64
is lossless. The only fancy checks are forNaN
values. Canonical NaN must be converted to canonical one, and any other NaN must be converted to any arithmetic NaN.https://webassembly.github.io/spec/core/exec/numerics.html#op-promote