]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: intrinsify math.Sqrt on 386
authorAlberto Donizetti <alb.donizetti@gmail.com>
Fri, 23 Feb 2018 09:40:12 +0000 (10:40 +0100)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Fri, 23 Feb 2018 13:49:55 +0000 (13:49 +0000)
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>
src/cmd/compile/internal/gc/ssa.go

index a740e455c90640f5c55a7389c12d07c2a253f65b..5061c6eef100cf6ad583a20238f304c2ee94093e 100644 (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])