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

[SR-2045] Optimization of FloatingPoint .round for Float/Double/Float80 #44654

Closed
stephentyrone opened this issue Jul 11, 2016 · 7 comments
Closed
Assignees
Labels
improvement standard library Area: Standard library umbrella

Comments

@stephentyrone
Copy link
Member

Previous ID SR-2045
Radar None
Original Reporter @stephentyrone
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement
Assignee @stephentyrone
Priority Medium

md5: 087779091399356b02a215851a43df40

Issue Description:

These functions contain an extra layer of indirection as currently implemented; they call e.g. `_swift_stdlib_ceilf( )`, which turns around and either calls `ceilf( )` or contains a lowering of `ceilf( )` (arm64).

This extra overhead is especially significant for these functions in particular because they have single-instruction implementations for `Float` and `Double` on arm64 and x86. We're eating a function call where we should simply have a single instruction instead.

@stephentyrone
Copy link
Member Author

#3454

@xwu
Copy link
Collaborator

xwu commented Jul 11, 2016

Out of curiosity, is the same indirection also worth addressing for fused multiply-add and remainder?

@stephentyrone
Copy link
Member Author

Yes, definitely (especially for FMA, remainder is relatively rare and expensive no matter what). I think there's a bug for that kicking around somewhere, but if there isn't I'll take a look.

@stephentyrone
Copy link
Member Author

@xwu I threw fma and sqrt in with this change. Remainder requires more fiddling, and is much less important.

@xwu
Copy link
Collaborator

xwu commented Jul 12, 2016

Thanks! I'd offer to pitch in, but one look at the plumbing in lib/AST/* and it's clear I don't have that skill.

@stephentyrone
Copy link
Member Author

Found a solution for remainder too. No AST plumbing necessary.

@stephentyrone
Copy link
Member Author

Done for Apple platforms. `squareRoot` and `remainder` will need special handling for Linux, but that can be done under a separate bug.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants