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

Add hw sqrt for x86_64 #681

Merged
merged 1 commit into from Jan 10, 2018
Merged

Add hw sqrt for x86_64 #681

merged 1 commit into from Jan 10, 2018

Conversation

@tiehuis
Copy link
Member

@tiehuis 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
Copy link
Member

@andrewrk 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
@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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants