-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
runtime, cmd/compile: sqrt support on arm #15542
Labels
Comments
The reason we have both is that we support not only ARM chips with FPU
(VFP, GOARM=6/7) but also those without (GOARM=5).
|
It looks to me like we have an ARM5 bug then. package x
import "math"
func root2() float64 {
return math.Sqrt(2)
} Compiling with GOARM=5 yields:
Note that call to SQRTD. I don't have an arm5 device to test on. Anyone else want to do the honors? |
Note the call to _sfloat function. We do soft fp on arm by generating the
regular fp instructions and insert a call to _sfloat before a contiguous
sequence of fp instructions, and _sfloat will emulate those instructions.
Very nice trick.
|
Whoah. Snazz. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
According to cmd/compile/internal/gc/walk.go, we assume that ARM has hardware sqrt support:
But we have a runtime sqrt routine (runtime/sqrt.go), used only in runtime/softfloat_arm.go, which suggests that we are prepared for ARM not to have hardware support.
It seems like either:
(1) we can delete the runtime sqrt routine and use the hardware instruction instead by adding a check to walk.go that recognizes runtime.sqrt in addition to math.Sqrt
(2) we should have an extra ARM-related check somehow in walk.go
(3) I'm missing something
Which is it? :)
cc @davecheney @minux @cherrymui
The text was updated successfully, but these errors were encountered: