diff options
| author | Xiaolin Zhao <zhaoxiaolin@loongson.cn> | 2024-11-02 14:30:31 +0800 |
|---|---|---|
| committer | abner chenc <chenguoqi@loongson.cn> | 2024-11-06 03:12:50 +0000 |
| commit | d6fb0ab2c7a13658fc808d431bbaf9c5f6b8da62 (patch) | |
| tree | 15b1820e7700eb2277777ec32933fd7d69a4b90c /test/codegen | |
| parent | d98c51809d89c09d157f952fe62dd2124f89ddbc (diff) | |
| download | go-d6fb0ab2c7a13658fc808d431bbaf9c5f6b8da62.tar.xz | |
cmd/compile: wire up Bswap/ReverseBytes intrinsics for loong64
Micro-benchmark results on Loongson 3A5000 and 3A6000:
goos: linux
goarch: loong64
pkg: math/bits
cpu: Loongson-3A6000 @ 2500.00MHz
| bench.old | bench.new |
| sec/op | sec/op vs base |
ReverseBytes 2.0020n ± 0% 0.4040n ± 0% -79.82% (p=0.000 n=20)
ReverseBytes16 0.8866n ± 1% 0.8007n ± 0% -9.69% (p=0.000 n=20)
ReverseBytes32 1.2195n ± 0% 0.8007n ± 0% -34.34% (p=0.000 n=20)
ReverseBytes64 2.0705n ± 0% 0.8008n ± 0% -61.32% (p=0.000 n=20)
geomean 1.455n 0.6749n -53.62%
goos: linux
goarch: loong64
pkg: math/bits
cpu: Loongson-3A5000 @ 2500.00MHz
| bench.old | bench.new |
| sec/op | sec/op vs base |
ReverseBytes 2.8040n ± 0% 0.5205n ± 0% -81.44% (p=0.000 n=20)
ReverseBytes16 0.7066n ± 0% 0.8011n ± 0% +13.37% (p=0.000 n=20)
ReverseBytes32 1.5500n ± 0% 0.8010n ± 0% -48.32% (p=0.000 n=20)
ReverseBytes64 2.7665n ± 0% 0.8010n ± 0% -71.05% (p=0.000 n=20)
geomean 1.707n 0.7192n -57.87%
Updates #59120
This patch is a copy of CL 483357.
Co-authored-by: WANG Xuerui <git@xen0n.name>
Change-Id: If355354cd031533df91991fcc3392e5a6c314295
Reviewed-on: https://go-review.googlesource.com/c/go/+/624576
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/mathbits.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 4519d8bd6c..715f67a3c8 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -208,6 +208,7 @@ func ReverseBytes(n uint) uint { // 386:"BSWAPL" // s390x:"MOVDBR" // arm64:"REV" + // loong64:"REVBV" return bits.ReverseBytes(n) } @@ -217,6 +218,7 @@ func ReverseBytes64(n uint64) uint64 { // s390x:"MOVDBR" // arm64:"REV" // ppc64x/power10: "BRD" + // loong64:"REVBV" return bits.ReverseBytes64(n) } @@ -225,6 +227,7 @@ func ReverseBytes32(n uint32) uint32 { // 386:"BSWAPL" // s390x:"MOVWBR" // arm64:"REVW" + // loong64:"REVB2W" // ppc64x/power10: "BRW" return bits.ReverseBytes32(n) } @@ -235,6 +238,7 @@ func ReverseBytes16(n uint16) uint16 { // arm/5:"SLL","SRL","ORR" // arm/6:"REV16" // arm/7:"REV16" + // loong64:"REVB2H" // ppc64x/power10: "BRH" return bits.ReverseBytes16(n) } |
