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

Additional intrinsic optimizations? #214

Open
Lokathor opened this issue Aug 2, 2019 · 2 comments
Open

Additional intrinsic optimizations? #214

Lokathor opened this issue Aug 2, 2019 · 2 comments

Comments

@Lokathor
Copy link
Contributor

Lokathor commented Aug 2, 2019

At the moment there's the llvm_intrinsically_optimized! macro which, when using the unstable flag, will call an unstable LLVM intrinsic.

However, there's some opportunities for using intrinsics (edit: hardware intrinsics) in stable, and even in core, if we wanted to reach for SSE / SSE2 / etc when available (compile time detected).

For example, libm defines sqrt with a full software implementation, but if people call it in std they get either (in debug) the sqrtss instruction with some indirection in between or (in release) the sqrtss instruction without any indirection. Based on this, I think it would be fine to have libm also just use the sqrtss instruction when available.

Of course this should probably be behind its own feature flag, but I think it would be a reasonable progression to develop in this direction of using stable hardware intrinsics when possible.

@Lokathor
Copy link
Contributor Author

Lokathor commented Aug 2, 2019

Note: this is related to, but not quite the same as, the #145 discussion

@alexcrichton
Copy link
Member

I think it's fine to improve on the implementations here at any time basically. These intrinsics may not be used in libstd at this time on all platforms, but having optimized implementations would certainly help, and they'll all be well tested anyway

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

No branches or pull requests

2 participants