]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: intrinsify math.Sqrt when compiling "math" itself
authorCherry Zhang <cherryyz@google.com>
Thu, 6 Oct 2016 14:16:17 +0000 (10:16 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 6 Oct 2016 14:57:00 +0000 (14:57 +0000)
Fixes #17354.

Change-Id: I0e018c8c3e791fc6cc1925dbbc18c2151ba9a111
Reviewed-on: https://go-review.googlesource.com/30539
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/compile/internal/gc/walk.go

index e385d3e3c8bbc51ac7511fb231df08d84576f428..3d4a49bebe2ed2d2bc76aec61b7463c4576adce6 100644 (file)
@@ -693,7 +693,8 @@ opswitch:
                n.Left = walkexpr(n.Left, init)
                walkexprlist(n.List.Slice(), init)
 
-               if n.Left.Op == ONAME && n.Left.Sym.Name == "Sqrt" && n.Left.Sym.Pkg.Path == "math" {
+               if n.Left.Op == ONAME && n.Left.Sym.Name == "Sqrt" &&
+                       (n.Left.Sym.Pkg.Path == "math" || n.Left.Sym.Pkg == localpkg && myimportpath == "math") {
                        if Thearch.LinkArch.InFamily(sys.AMD64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) {
                                n.Op = OSQRT
                                n.Left = n.List.First()