]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix Mul->Mul64 intrinsic alias
authorKeith Randall <khr@golang.org>
Thu, 25 Oct 2018 16:18:48 +0000 (09:18 -0700)
committerKeith Randall <khr@golang.org>
Thu, 25 Oct 2018 23:12:46 +0000 (23:12 +0000)
The alias declaration needs to come after the function it is aliasing.

It isn't a big deal in this case, as bits.Mul inlines and has as its
body bits.Mul64, so the desired code gets generated regardless.
The alias should only have an effect on inlining cost estimates
(for functions that call bits.Mul).

Change-Id: I0d814899ce7049a0fb36e8ce1ad5ababbaf6265f
Reviewed-on: https://go-review.googlesource.com/c/144597
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
src/cmd/compile/internal/gc/ssa.go

index 0d1a1a24e2d38f6eb223859eac4d50d157f4899e..65271df360a6bf05df1825b122e82ff6564d298b 100644 (file)
@@ -3474,12 +3474,12 @@ func init() {
        addF("math/bits", "OnesCount",
                makeOnesCountAMD64(ssa.OpPopCount64, ssa.OpPopCount32),
                sys.AMD64)
-       alias("math/bits", "Mul", "math/bits", "Mul64", sys.ArchAMD64, sys.ArchARM64, sys.ArchPPC64)
        addF("math/bits", "Mul64",
                func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
                        return s.newValue2(ssa.OpMul64uhilo, types.NewTuple(types.Types[TUINT64], types.Types[TUINT64]), args[0], args[1])
                },
                sys.AMD64, sys.ARM64, sys.PPC64)
+       alias("math/bits", "Mul", "math/bits", "Mul64", sys.ArchAMD64, sys.ArchARM64, sys.ArchPPC64)
 
        addF("math/bits", "Add64",
                func(s *state, n *Node, args []*ssa.Value) *ssa.Value {