mirror of https://github.com/golang/go.git
cmd/compile: declare runtime bit func aliases after math/bits intrinsics
Currently runtime/internal/sys bit-manipulation functions are aliased to math/bits functions, which are intrinsified. Unfortunately these aliases are declared before the intrinsified versions are generated, resulting in the generic version of the code being copied over. This change moves the aliases for bit operations in runtime/internal/sys after the addF calls to generate those intrinsics in SSA, so that the intrinsified SSA representation of those functions actually get copied over. This should improve the overall performance of the runtime (especially the page allocator) since these bit operations will actually be intrinsified now. Change-Id: I4377da13f9a7bb6aee608e50df0297148bf8f806 Reviewed-on: https://go-review.googlesource.com/c/go/+/224437 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
bb929b7452
commit
830ee4792e
|
|
@ -3522,13 +3522,6 @@ func init() {
|
|||
alias("runtime/internal/atomic", "Casp1", "runtime/internal/atomic", "Cas64", p8...)
|
||||
alias("runtime/internal/atomic", "CasRel", "runtime/internal/atomic", "Cas", lwatomics...)
|
||||
|
||||
alias("runtime/internal/sys", "Ctz8", "math/bits", "TrailingZeros8", all...)
|
||||
alias("runtime/internal/sys", "TrailingZeros8", "math/bits", "TrailingZeros8", all...)
|
||||
alias("runtime/internal/sys", "TrailingZeros64", "math/bits", "TrailingZeros64", all...)
|
||||
alias("runtime/internal/sys", "Len8", "math/bits", "Len8", all...)
|
||||
alias("runtime/internal/sys", "Len64", "math/bits", "Len64", all...)
|
||||
alias("runtime/internal/sys", "OnesCount64", "math/bits", "OnesCount64", all...)
|
||||
|
||||
/******** math ********/
|
||||
addF("math", "Sqrt",
|
||||
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
|
||||
|
|
@ -3950,6 +3943,13 @@ func init() {
|
|||
sys.AMD64)
|
||||
alias("math/bits", "Div", "math/bits", "Div64", sys.ArchAMD64)
|
||||
|
||||
alias("runtime/internal/sys", "Ctz8", "math/bits", "TrailingZeros8", all...)
|
||||
alias("runtime/internal/sys", "TrailingZeros8", "math/bits", "TrailingZeros8", all...)
|
||||
alias("runtime/internal/sys", "TrailingZeros64", "math/bits", "TrailingZeros64", all...)
|
||||
alias("runtime/internal/sys", "Len8", "math/bits", "Len8", all...)
|
||||
alias("runtime/internal/sys", "Len64", "math/bits", "Len64", all...)
|
||||
alias("runtime/internal/sys", "OnesCount64", "math/bits", "OnesCount64", all...)
|
||||
|
||||
/******** sync/atomic ********/
|
||||
|
||||
// Note: these are disabled by flag_race in findIntrinsic below.
|
||||
|
|
|
|||
Loading…
Reference in New Issue