aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
diff options
context:
space:
mode:
authorWayne Zuo <wdvxdr@golangcn.org>2022-08-24 22:17:51 +0800
committerGopher Robot <gobot@golang.org>2022-08-24 18:08:33 +0000
commitb60432df143475b575a9da1f2a179ac35c399ed0 (patch)
treeb17da6ffe91707d6486b2694ff2329c614ed2b95 /test/codegen/mathbits.go
parentcfae70ccb141ffc3c087bc0b5f927acbdb934c6f (diff)
downloadgo-b60432df143475b575a9da1f2a179ac35c399ed0.tar.xz
cmd/compile: deadcode for LoweredMuluhilo on riscv64
This is a follow up of CL 425101 on RISCV64. According to RISCV Volume 1, Unprivileged Spec v. 20191213 Chapter 7.1: If both the high and low bits of the same product are required, then the recommended code sequence is: MULH[[S]U] rdh, rs1, rs2; MUL rdl, rs1, rs2 (source register specifiers must be in same order and rdh cannot be the same as rs1 or rs2). Microarchitectures can then fuse these into a single multiply operation instead of performing two separate multiplies. So we should not split Muluhilo to separate instructions. Updates #54607 Change-Id: If47461f3aaaf00e27cd583a9990e144fb8bcdb17 Reviewed-on: https://go-review.googlesource.com/c/go/+/425203 Auto-Submit: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test/codegen/mathbits.go')
-rw-r--r--test/codegen/mathbits.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index 20c945fbc3..a507d32843 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -800,12 +800,14 @@ func Mul64(x, y uint64) (hi, lo uint64) {
func Mul64HiOnly(x, y uint64) uint64 {
// arm64:"UMULH",-"MUL"
+ // riscv64:"MULHU",-"MUL\t"
hi, _ := bits.Mul64(x, y)
return hi
}
func Mul64LoOnly(x, y uint64) uint64 {
// arm64:"MUL",-"UMULH"
+ // riscv64:"MUL\t",-"MULHU"
_, lo := bits.Mul64(x, y)
return lo
}