]> Cypherpunks repositories - gostls13.git/commit
runtime: fix software FP regs corruption when emulating SQRT on ARM
authorShenghou Ma <minux@golang.org>
Thu, 30 Apr 2015 23:03:31 +0000 (19:03 -0400)
committerMinux Ma <minux@golang.org>
Tue, 5 May 2015 07:32:58 +0000 (07:32 +0000)
commit102436e800d161dfd8b884278d1ddc5101f562dd
tree36b589806b48cdaa4c3371d3732edecd58624940
parent62ea2c9093eb54ca4f84f9d6e0fd014ad9fe547c
runtime: fix software FP regs corruption when emulating SQRT on ARM

When emulating ARM FSQRT instruction, the sqrt function itself
should not use any floating point arithmetics, otherwise it will
clobber the user software FP registers.

Fortunately, the sqrt function only uses floating point instructions
to test for corner cases, so it's easy to make that function does
all it job using pure integer arithmetic only. I've verified that
after this change, runtime.stepflt and runtime.sqrt doesn't contain
any call to _sfloat. (Perhaps we should add //go:nosfloat to make
the compiler enforce this?)

Fixes #10641.

Change-Id: Ida4742c49000fae4fea4649f28afde630ce4c576
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/9570
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/export_test.go
src/runtime/softfloat_arm.go
src/runtime/sqrt.go
src/runtime/sqrt_test.go [new file with mode: 0644]