1
0
mirror of https://github.com/golang/go synced 2024-10-02 04:18:33 -06:00

cmd/compile: intrinsify math.Sqrt on 386

It seems like all the pieces were already there, it only needed the
final plumbing.

Before:

	0x001b 00027 (test.go:9)	MOVSD	X0, (SP)
	0x0020 00032 (test.go:9)	CALL	math.Sqrt(SB)
	0x0025 00037 (test.go:9)	MOVSD	8(SP), X0

After:

	0x0018 00024 (test.go:9)	SQRTSD	X0, X0

name    old time/op  new time/op  delta
Sqrt-4  4.60ns ± 2%  0.45ns ± 1%  -90.33%  (p=0.000 n=10+10)

Change-Id: I0f623958e19e726840140bf9b495d3f3a9184b9d
Reviewed-on: https://go-review.googlesource.com/96615
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Alberto Donizetti 2018-02-23 10:40:12 +01:00
parent f6c6781302
commit 9ee78af806

View File

@ -2913,7 +2913,7 @@ func init() {
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
return s.newValue1(ssa.OpSqrt, types.Types[TFLOAT64], args[0])
},
sys.AMD64, sys.ARM, sys.ARM64, sys.MIPS, sys.MIPS64, sys.PPC64, sys.S390X)
sys.I386, sys.AMD64, sys.ARM, sys.ARM64, sys.MIPS, sys.MIPS64, sys.PPC64, sys.S390X)
addF("math", "Trunc",
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
return s.newValue1(ssa.OpTrunc, types.Types[TFLOAT64], args[0])