From: Cherry Zhang Date: Thu, 6 Oct 2016 14:16:17 +0000 (-0400) Subject: cmd/compile: intrinsify math.Sqrt when compiling "math" itself X-Git-Tag: go1.8beta1~996 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8aadcc551e1610d4185c36624c8105f4303fe7ec;p=gostls13.git cmd/compile: intrinsify math.Sqrt when compiling "math" itself Fixes #17354. Change-Id: I0e018c8c3e791fc6cc1925dbbc18c2151ba9a111 Reviewed-on: https://go-review.googlesource.com/30539 Run-TryBot: Cherry Zhang TryBot-Result: Gobot Gobot Reviewed-by: Russ Cox --- diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index e385d3e3c8..3d4a49bebe 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -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()