cmd/compile: split Muluhilo op on ARM64

On ARM64 we use two separate instructions to compute the hi and lo
results of a 64x64->128 multiplication. Lower to two separate ops
so if only one result is needed we can deadcode the other.

Fixes #54607.

Change-Id: Ib023e77eb2b2b0bcf467b45471cb8a294bce6f90
Reviewed-on: https://go-review.googlesource.com/c/go/+/425101
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
Cherry Mui 2022-08-22 17:00:17 -04:00
parent 48da729e84
commit 8bf9e01473
6 changed files with 39 additions and 39 deletions

View file

@ -798,6 +798,18 @@ func Mul64(x, y uint64) (hi, lo uint64) {
return bits.Mul64(x, y)
}
func Mul64HiOnly(x, y uint64) uint64 {
// arm64:"UMULH",-"MUL"
hi, _ := bits.Mul64(x, y)
return hi
}
func Mul64LoOnly(x, y uint64) uint64 {
// arm64:"MUL",-"UMULH"
_, lo := bits.Mul64(x, y)
return lo
}
// --------------- //
// bits.Div* //
// --------------- //