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

Add hw sqrt for x86_64 #681

Merged
merged 1 commit into from Jan 10, 2018

Conversation

Projects
None yet
2 participants
@tiehuis
Member

tiehuis commented Jan 10, 2018

In the process of doing the remaining i386/x86_64 instructions too. Need to work out some inline assembly issues first.

@andrewrk

This comment has been minimized.

Member

andrewrk commented Jan 10, 2018

hmm, if there's a hardware instruction for sqrt, maybe we should add @sqrt because there is an LLVM intrinsic that can probably lower to this sqrt instruction (and the sqrt instructions on the other architectures too): http://llvm.org/docs/LangRef.html#llvm-sqrt-intrinsic

The other problem a builtin would solve is executing std.math.sqrt at compile time. Without a builtin, we would need some kind of feature to detect whether we're executing at compile time or not. (because inline assembly cannot be executed at compile time).

We would still need the zig implementation of sqrt (with the modification proposed here) to put into builtin.o, because the sqrt llvm intrinsic can lower to a call to that function. So this is good to merge. I'll add a new issue.

@andrewrk andrewrk merged commit 891c93c into master Jan 10, 2018

4 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@andrewrk andrewrk deleted the hw-math branch Jan 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment