aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-08-22 17:00:17 -0400
committerCherry Mui <cherryyz@google.com>2022-08-22 21:29:31 +0000
commit8bf9e014736064de436c411a95467b583f430dea (patch)
tree27bc8c1f18d0b9f11999afb8354c068ea7559af9 /test/codegen/mathbits.go
parent48da729e8468b630ee003ac51cbaac595d53bec8 (diff)
downloadgo-8bf9e014736064de436c411a95467b583f430dea.tar.xz
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>
Diffstat (limited to 'test/codegen/mathbits.go')
-rw-r--r--test/codegen/mathbits.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index fe9c4eceb5..20c945fbc3 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -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* //
// --------------- //