Commit 8aadcc55 authored by Cherry Zhang's avatar Cherry Zhang

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 <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 4f3a641e
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment