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

Implement f{32,64}.sub instructions #474

Merged
merged 3 commits into from
Aug 14, 2020
Merged

Implement f{32,64}.sub instructions #474

merged 3 commits into from
Aug 14, 2020

Conversation

chfast
Copy link
Collaborator

@chfast chfast commented Aug 12, 2020

image

@chfast chfast requested review from axic and gumb0 August 12, 2020 08:26
EXPECT_THAT(exec(TypeParam{0.0}, q), Result(-q));
EXPECT_THAT(exec(-TypeParam{0.0}, -q), Result(q));

// Not part of the spec.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you mean?

image

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The fsub(+-0, -q) = +-q is missing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

image

This covers fsub(+-0, -q2) and shows that it negates the sign.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You cannot resolve it like that because

they must be resolved consistently: either the upper sign is chosen for all of them or the lower sign.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I see. You mean only these are defined:

fsub(+0, +q2) = -q2
fsub(-0, -q2) = +q2

But not these

fsub(-0, +q2) = -q2
fsub(+0, -q2) = +q2

Probably a bug in the spec, because text description doesn't mention any special cases, just "if z1 is zero"

@gumb0
Copy link
Collaborator

gumb0 commented Aug 13, 2020

How about adding a test that checks this?

image

@chfast
Copy link
Collaborator Author

chfast commented Aug 14, 2020

How about adding a test that checks this?

image

Added a test for it.

Base automatically changed from fp_mul to master August 14, 2020 14:28
gumb0
gumb0 previously requested changes Aug 14, 2020
test/unittests/execute_floating_point_test.cpp Outdated Show resolved Hide resolved
@chfast chfast force-pushed the fp_sub branch 2 times, most recently from 3cbf074 to a01893e Compare August 14, 2020 14:41
Copy link
Collaborator

@gumb0 gumb0 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, needs typo fix and rebase

@gumb0 gumb0 dismissed their stale review August 14, 2020 15:49

Looks good, needs typo fix and rebase

@codecov
Copy link

codecov bot commented Aug 14, 2020

Codecov Report

Merging #474 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           master     #474    +/-   ##
========================================
  Coverage   99.55%   99.56%            
========================================
  Files          54       54            
  Lines       16729    16858   +129     
========================================
+ Hits        16655    16784   +129     
  Misses         74       74            

@chfast
Copy link
Collaborator Author

chfast commented Aug 14, 2020

Please approve.

chfast added 3 commits August 14, 2020 18:31
Checks the note from the Wasm spec:
> Up to the non-determinism regarding NaNs, it always holds that
> fsub(z1, z2) = fadd(z1, fneg(z2)).
@chfast chfast merged commit 32f8fc6 into master Aug 14, 2020
@chfast chfast deleted the fp_sub branch August 14, 2020 18:43
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.

3 participants