Skip to content

Commit

Permalink
cmd/compile: add intrinsic for MulUintptr on arm64
Browse files Browse the repository at this point in the history
This CL adds intrinsic for runtime/internal/math.MulUintptr on arm64

Benchmark         master     ThisCL(ns/op)   delta
MulUintptr/small  0.95ns     0.79ns          -16%
MulUintptr/large  1.31ns     0.95ns          -27.6%

Change-Id: Ic7b453ad502826beffe93ce5531b8ba752312a1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419556
Reviewed-by: Keith Randall <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Run-TryBot: Eric Fang <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
Reviewed-by: Joedian Reid <[email protected]>
  • Loading branch information
RuinanSun authored and gopherbot committed Aug 19, 2022
1 parent f15761b commit d654117
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/cmd/compile/internal/ssa/gen/ARM64.rules
Original file line number Diff line number Diff line change
Expand Up @@ -2977,3 +2977,8 @@
=> (Move [sz] dst src mem)

((REV|REVW) ((REV|REVW) p)) => p

// runtime/internal/math.MulUintptr intrinsics

(Select0 (Mul64uover x y)) => (MUL x y)
(Select1 (Mul64uover x y)) => (NotEqual (CMPconst (UMULH <typ.UInt64> x y) [0]))
29 changes: 29 additions & 0 deletions src/cmd/compile/internal/ssa/rewriteARM64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssagen/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -3908,7 +3908,7 @@ func InitTables() {
}
return s.newValue2(ssa.OpMul64uover, types.NewTuple(types.Types[types.TUINT], types.Types[types.TUINT]), args[0], args[1])
},
sys.AMD64, sys.I386, sys.Loong64, sys.MIPS64, sys.RISCV64)
sys.AMD64, sys.I386, sys.Loong64, sys.MIPS64, sys.RISCV64, sys.ARM64)
alias("runtime", "mulUintptr", "runtime/internal/math", "MulUintptr", all...)
add("runtime", "KeepAlive",
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
Expand Down

0 comments on commit d654117

Please sign in to comment.