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}.abs instructions #476

Merged
merged 4 commits into from
Aug 12, 2020
Merged

Implement f{32,64}.abs instructions #476

merged 4 commits into from
Aug 12, 2020

Conversation

gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Aug 12, 2020

image

@gumb0 gumb0 force-pushed the fabs branch 3 times, most recently from 3fc7b84 to 937faee Compare August 12, 2020 11:16
@gumb0 gumb0 changed the title Fabs Implement f{32,64}.abs instructions Aug 12, 2020
@codecov
Copy link

codecov bot commented Aug 12, 2020

Codecov Report

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

@@           Coverage Diff           @@
##           master     #476   +/-   ##
=======================================
  Coverage   99.53%   99.54%           
=======================================
  Files          54       54           
  Lines       16075    16123   +48     
=======================================
+ Hits        16001    16049   +48     
  Misses         74       74           

@gumb0 gumb0 force-pushed the fabs branch 2 times, most recently from b51941f to 66809d4 Compare August 12, 2020 12:51
@@ -1521,12 +1521,26 @@ ExecutionResult execute(Instance& instance, FuncIdx func_idx, span<const Value>
break;
}

case Instr::f32_abs:
{
// TODO: This can be optimized https://godbolt.org/z/aPqvfo
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Included link to the same goldbolt as in #471

case Instr::f32_abs:
{
// TODO: This can be optimized https://godbolt.org/z/aPqvfo
unary_op(stack, static_cast<float (*)(float)>(std::fabs));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

std::fabs is unfortunately not a template, but several overloaded variants.

Copy link
Collaborator Author

@gumb0 gumb0 Aug 12, 2020

Choose a reason for hiding this comment

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

(Also would work without casts: fabsf and fabs C functions.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

(Also would work without casts: fabsf and fabs C functions.)

That would only work for fabsf...

@gumb0 gumb0 marked this pull request as ready for review August 12, 2020 12:59
@gumb0 gumb0 requested review from chfast and axic August 12, 2020 13:11
@@ -363,6 +385,27 @@ TYPED_TEST(execute_floating_point_types, add)
EXPECT_THAT(exec(TypeParam{0x0.287p2}, TypeParam{0x1.FFp4}), Result(TypeParam{0x1.048Ep5}));
}

TYPED_TEST(execute_floating_point_types, abs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put the test by the opcode value, i.e. before add.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved.

@gumb0 gumb0 merged commit a1f001d into master Aug 12, 2020
@gumb0 gumb0 deleted the fabs branch August 12, 2020 14:06
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