From cd1fc871568e9947e84377f82c8d7a4882a07067 Mon Sep 17 00:00:00 2001 From: Archana R Date: Mon, 31 Oct 2022 11:47:17 -0500 Subject: cmd/compile: intrinsify math/bits/ReverseBytes{16|32|64} for ppc64/power10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change intrinsifies ReverseBytes{16|32|64} by generating the corresponding new instructions in Power10: brh, brd and brw and adds a verification test for the same. On Power 9 and 8, the .go code performs optimally as it is. Performance improvement seen on Power10: ReverseBytes32 1.38ns ± 0% 1.18ns ± 0% -14.2 ReverseBytes64 1.52ns ± 0% 1.11ns ± 0% -26.87 ReverseBytes16 1.41ns ± 1% 1.18ns ± 0% -16.47 Change-Id: I88f127f3ab9ba24a772becc21ad90acfba324b37 Reviewed-on: https://go-review.googlesource.com/c/go/+/446675 Reviewed-by: Lynn Boger TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Run-TryBot: Lynn Boger Reviewed-by: Michael Knyszek --- test/codegen/mathbits.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/codegen/mathbits.go') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 09aa5a136e..0eed27a619 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -198,6 +198,7 @@ func ReverseBytes64(n uint64) uint64 { // amd64:"BSWAPQ" // s390x:"MOVDBR" // arm64:"REV" + // ppc64x/power10: "BRD" return bits.ReverseBytes64(n) } @@ -205,6 +206,7 @@ func ReverseBytes32(n uint32) uint32 { // amd64:"BSWAPL" // s390x:"MOVWBR" // arm64:"REVW" + // ppc64x/power10: "BRW" return bits.ReverseBytes32(n) } @@ -214,6 +216,7 @@ func ReverseBytes16(n uint16) uint16 { // arm/5:"SLL","SRL","ORR" // arm/6:"REV16" // arm/7:"REV16" + // ppc64x/power10: "BRH" return bits.ReverseBytes16(n) } -- cgit v1.3