From: Guoqi Chen Date: Fri, 4 Nov 2022 09:01:21 +0000 (+0800) Subject: runtime: using wyrand for fastrand on linux/loong64 X-Git-Tag: go1.20rc1~361 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3a41094107237535673bdbbdaabc10e54cb2b67c;p=gostls13.git runtime: using wyrand for fastrand on linux/loong64 Benchmarks on linux/loong64: name old time/op new time/op delta Fastrand 4.06ns ± 0% 3.60ns ± 0% -11.29% (p=0.000 n=32+27) Fastrand64 7.20ns ± 0% 7.16ns ± 0% -0.52% (p=0.000 n=23+31) FastrandHashiter 49.5ns ± 1% 48.9ns ± 2% -1.24% (p=0.000 n=32+32) Fastrandn/2 4.45ns ± 0% 3.81ns ± 0% -14.37% (p=0.000 n=32+32) Fastrandn/3 4.45ns ± 0% 3.81ns ± 0% -14.32% (p=0.000 n=32+32) Fastrandn/4 4.45ns ± 0% 3.81ns ± 0% -14.33% (p=0.000 n=31+32) Fastrandn/5 4.44ns ± 0% 3.81ns ± 0% -14.26% (p=0.000 n=31+30) Change-Id: I0aba7d2331221426c44cc0d0dddecca3b585fda4 Reviewed-on: https://go-review.googlesource.com/c/go/+/446896 Reviewed-by: Keith Randall Run-TryBot: Wayne Zuo TryBot-Result: Gopher Robot Reviewed-by: Michael Knyszek Reviewed-by: Keith Randall --- diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index 20487fdf88..8a8aace046 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -131,7 +131,7 @@ func fastrand() uint32 { // by the compiler should be in this list. if goarch.IsAmd64|goarch.IsArm64|goarch.IsPpc64| goarch.IsPpc64le|goarch.IsMips64|goarch.IsMips64le| - goarch.IsS390x|goarch.IsRiscv64 == 1 { + goarch.IsS390x|goarch.IsRiscv64|goarch.IsLoong64 == 1 { mp.fastrand += 0xa0761d6478bd642f hi, lo := math.Mul64(mp.fastrand, mp.fastrand^0xe7037ed1a0b428db) return uint32(hi ^ lo)