aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorArchana R <aravind5@in.ibm.com>2022-10-31 11:47:17 -0500
committerLynn Boger <laboger@linux.vnet.ibm.com>2023-02-03 19:01:06 +0000
commitcd1fc871568e9947e84377f82c8d7a4882a07067 (patch)
treeef410ca867d20d4dd970ad6bbc01ac062e6da54a /test/codegen
parenta96487613e2703d1eb7e12c51647e36973df9fd0 (diff)
downloadgo-cd1fc871568e9947e84377f82c8d7a4882a07067.tar.xz
cmd/compile: intrinsify math/bits/ReverseBytes{16|32|64} for ppc64/power10
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 <laboger@linux.vnet.ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/mathbits.go3
1 files changed, 3 insertions, 0 deletions
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)
}