mirror of
https://github.com/golang/go.git
synced 2025-05-30 19:52:53 +00:00
cmd/compile: add intrinsics for runtime/internal/math on MIPS64x
name old time/op new time/op delta MulUintptr/small 8.42ns ± 0% 5.93ns ± 0% -29.66% (p=0.000 n=9+10) MulUintptr/large 11.1ns ± 0% 7.4ns ± 0% -33.17% (p=0.000 n=10+9) Change-Id: I6659a886389660461fc2c90bd248243f6e7c29d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/210897 Run-TryBot: Meng Zhuo <mengzhuo1203@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
12d02e7d8e
commit
ab7ecea0c8
@ -3269,7 +3269,7 @@ func init() {
|
||||
}
|
||||
return s.newValue2(ssa.OpMul64uover, types.NewTuple(types.Types[TUINT], types.Types[TUINT]), args[0], args[1])
|
||||
},
|
||||
sys.AMD64, sys.I386)
|
||||
sys.AMD64, sys.I386, sys.MIPS64)
|
||||
add("runtime", "KeepAlive",
|
||||
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
|
||||
data := s.newValue1(ssa.OpIData, s.f.Config.Types.BytePtr, args[0])
|
||||
|
@ -11,6 +11,8 @@
|
||||
(Mul(64|32|16|8) x y) -> (Select1 (MULVU x y))
|
||||
(Mul(32|64)F ...) -> (MUL(F|D) ...)
|
||||
(Mul64uhilo ...) -> (MULVU ...)
|
||||
(Select0 (Mul64uover x y)) -> (Select1 <typ.UInt64> (MULVU x y))
|
||||
(Select1 (Mul64uover x y)) -> (SGTU <typ.Bool> (Select0 <typ.UInt64> (MULVU x y)) (MOVVconst <typ.UInt64> [0]))
|
||||
|
||||
(Hmul64 x y) -> (Select0 (MULV x y))
|
||||
(Hmul64u x y) -> (Select0 (MULVU x y))
|
||||
|
@ -6927,6 +6927,24 @@ func rewriteValueMIPS64_OpRsh8x8(v *Value) bool {
|
||||
}
|
||||
func rewriteValueMIPS64_OpSelect0(v *Value) bool {
|
||||
v_0 := v.Args[0]
|
||||
b := v.Block
|
||||
typ := &b.Func.Config.Types
|
||||
// match: (Select0 (Mul64uover x y))
|
||||
// result: (Select1 <typ.UInt64> (MULVU x y))
|
||||
for {
|
||||
if v_0.Op != OpMul64uover {
|
||||
break
|
||||
}
|
||||
y := v_0.Args[1]
|
||||
x := v_0.Args[0]
|
||||
v.reset(OpSelect1)
|
||||
v.Type = typ.UInt64
|
||||
v0 := b.NewValue0(v.Pos, OpMIPS64MULVU, types.NewTuple(typ.UInt64, typ.UInt64))
|
||||
v0.AddArg(x)
|
||||
v0.AddArg(y)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
// match: (Select0 (DIVVU _ (MOVVconst [1])))
|
||||
// result: (MOVVconst [0])
|
||||
for {
|
||||
@ -7010,6 +7028,29 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool {
|
||||
}
|
||||
func rewriteValueMIPS64_OpSelect1(v *Value) bool {
|
||||
v_0 := v.Args[0]
|
||||
b := v.Block
|
||||
typ := &b.Func.Config.Types
|
||||
// match: (Select1 (Mul64uover x y))
|
||||
// result: (SGTU <typ.Bool> (Select0 <typ.UInt64> (MULVU x y)) (MOVVconst <typ.UInt64> [0]))
|
||||
for {
|
||||
if v_0.Op != OpMul64uover {
|
||||
break
|
||||
}
|
||||
y := v_0.Args[1]
|
||||
x := v_0.Args[0]
|
||||
v.reset(OpMIPS64SGTU)
|
||||
v.Type = typ.Bool
|
||||
v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
|
||||
v1 := b.NewValue0(v.Pos, OpMIPS64MULVU, types.NewTuple(typ.UInt64, typ.UInt64))
|
||||
v1.AddArg(x)
|
||||
v1.AddArg(y)
|
||||
v0.AddArg(v1)
|
||||
v.AddArg(v0)
|
||||
v2 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
|
||||
v2.AuxInt = 0
|
||||
v.AddArg(v2)
|
||||
return true
|
||||
}
|
||||
// match: (Select1 (MULVU x (MOVVconst [-1])))
|
||||
// result: (NEGV x)
|
||||
for {
|
||||
|
Loading…
x
Reference in New Issue
Block a user