cmd/compile: use 32x32->64 multiplies on arm64

Gets rid of some sign extensions.

Change-Id: Ie67ef36b4ca1cd1a2cd9fa5d84578db553578a22
Reviewed-on: https://go-review.googlesource.com/c/go/+/721241
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
Keith Randall 2025-11-17 12:47:04 -08:00 committed by Keith Randall
parent 6caab99026
commit e1a12c781f
3 changed files with 61 additions and 0 deletions

View file

@ -333,6 +333,15 @@ func Fold2NegMul(a, b int) int {
return -a * -b
}
func Mul32(a, b int32) int64 {
// arm64:"SMULL" -"MOVW"
return int64(a) * int64(b)
}
func Mul32U(a, b uint32) uint64 {
// arm64:"UMULL" -"MOVWU"
return uint64(a) * uint64(b)
}
// -------------- //
// Division //
// -------------- //