aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMeng Zhuo <mzh@golangcn.org>2021-06-22 11:20:03 +0000
committerMeng Zhuo <mzh@golangcn.org>2021-08-16 13:50:11 +0000
commitefd206eb40a59e955c12653b1720026244e6c667 (patch)
treeaaed5d70ae2fb0ac1f16a0cfe2f24678a48592f5 /test
parent7b7d7d7818dfc1db22930be9333e8cc9f8c7f68c (diff)
downloadgo-efd206eb40a59e955c12653b1720026244e6c667.tar.gz
go-efd206eb40a59e955c12653b1720026244e6c667.zip
cmd/compile: intrinsify Mul64 on riscv64
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 <joel@sing.id.au> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Go Bot <gobot@golang.org> Trust: Meng Zhuo <mzh@golangcn.org>
Diffstat (limited to 'test')
-rw-r--r--test/codegen/mathbits.go1
-rw-r--r--test/run.go1
2 files changed, 2 insertions, 0 deletions
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": {},
}
)