From efd206eb40a59e955c12653b1720026244e6c667 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Tue, 22 Jun 2021 11:20:03 +0000 Subject: cmd/compile: intrinsify Mul64 on riscv64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to RISCV instruction set manual v2.2 Sec 6.1 MULHU followed by MUL will be fused into one multiply by microarchitecture Benchstat on Hifive unmatched: name old time/op new time/op delta Hash8Bytes 245ns ± 3% 186ns ± 4% -23.99% (p=0.000 n=10+10) Hash320Bytes 1.94µs ± 1% 1.31µs ± 1% -32.38% (p=0.000 n=9+10) Hash1K 5.84µs ± 0% 3.84µs ± 0% -34.20% (p=0.000 n=10+9) Hash8K 45.3µs ± 0% 29.4µs ± 0% -35.04% (p=0.000 n=10+10) name old speed new speed delta Hash8Bytes 32.7MB/s ± 3% 43.0MB/s ± 4% +31.61% (p=0.000 n=10+10) Hash320Bytes 165MB/s ± 1% 244MB/s ± 1% +47.88% (p=0.000 n=9+10) Hash1K 175MB/s ± 0% 266MB/s ± 0% +51.98% (p=0.000 n=10+9) Hash8K 181MB/s ± 0% 279MB/s ± 0% +53.94% (p=0.000 n=10+10) Change-Id: I3561495d02a4a0ad8578e9b9819bf0a4eaca5d12 Reviewed-on: https://go-review.googlesource.com/c/go/+/329970 Reviewed-by: Joel Sing Run-TryBot: Joel Sing TryBot-Result: Go Bot Trust: Meng Zhuo --- test/codegen/mathbits.go | 1 + test/run.go | 1 + 2 files changed, 2 insertions(+) (limited to 'test') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 03012eff5d..aecd84a78b 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -710,6 +710,7 @@ func Mul64(x, y uint64) (hi, lo uint64) { // ppc64le:"MULHDU","MULLD" // s390x:"MLGR" // mips64: "MULVU" + // riscv64:"MULHU","MUL" return bits.Mul64(x, y) } diff --git a/test/run.go b/test/run.go index 6296234d56..5d5adc3623 100644 --- a/test/run.go +++ b/test/run.go @@ -1756,6 +1756,7 @@ var ( "ppc64le": {"GOPPC64", "power8", "power9"}, "s390x": {}, "wasm": {}, + "riscv64": {}, } ) -- cgit v1.2.3-54-g00ecf