-
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 f{32,64}.abs instructions #476
Conversation
gumb0
commented
Aug 12, 2020
•
edited
Loading
edited
3fc7b84
to
937faee
Compare
Codecov Report
@@ Coverage Diff @@
## master #476 +/- ##
=======================================
Coverage 99.53% 99.54%
=======================================
Files 54 54
Lines 16075 16123 +48
=======================================
+ Hits 16001 16049 +48
Misses 74 74 |
b51941f
to
66809d4
Compare
@@ -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 |
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.
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)); |
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.
std::fabs
is unfortunately not a template, but several overloaded variants.
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.
(Also would work without casts: fabsf
and fabs
C functions.)
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.
(Also would work without casts:
fabsf
andfabs
C functions.)
That would only work for fabsf
...
@@ -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) |
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.
Put the test by the opcode value, i.e. before add
.
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.
Moved.