diff options
| author | erifan01 <eric.fang@arm.com> | 2018-06-30 06:48:51 +0000 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2018-09-07 14:52:02 +0000 |
| commit | 204cc14bddf6bdd553fd6139e395b1e203ce1d48 (patch) | |
| tree | ae06b9f1a251a979c4ca70c7f119e567aa77974b /test/codegen/mathbits.go | |
| parent | d8c8a1421837e86d5b5a20f2925b783c594ef9d6 (diff) | |
| download | go-204cc14bddf6bdd553fd6139e395b1e203ce1d48.tar.xz | |
cmd/compile: implement non-constant rotates using ROR on arm64
Add some rules to match the Go code like:
y &= 63
x << y | x >> (64-y)
or
y &= 63
x >> y | x << (64-y)
as a ROR instruction. Make math/bits.RotateLeft faster on arm64.
Extends CL 132435 to arm64.
Benchmarks of math/bits.RotateLeftxxN:
name old time/op new time/op delta
RotateLeft-8 3.548750ns +- 1% 2.003750ns +- 0% -43.54% (p=0.000 n=8+8)
RotateLeft8-8 3.925000ns +- 0% 3.925000ns +- 0% ~ (p=1.000 n=8+8)
RotateLeft16-8 3.925000ns +- 0% 3.927500ns +- 0% ~ (p=0.608 n=8+8)
RotateLeft32-8 3.925000ns +- 0% 2.002500ns +- 0% -48.98% (p=0.000 n=8+8)
RotateLeft64-8 3.536250ns +- 0% 2.003750ns +- 0% -43.34% (p=0.000 n=8+8)
Change-Id: I77622cd7f39b917427e060647321f5513973232c
Reviewed-on: https://go-review.googlesource.com/122542
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/codegen/mathbits.go')
| -rw-r--r-- | test/codegen/mathbits.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index b8844c518f..28354ed651 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -195,6 +195,7 @@ func RotateLeft8(n uint8) uint8 { func RotateLeftVariable(n uint, m int) uint { // amd64:"ROLQ" + // arm64:"ROR" // ppc64:"ROTL" // s390x:"RLLG" return bits.RotateLeft(n, m) @@ -202,6 +203,7 @@ func RotateLeftVariable(n uint, m int) uint { func RotateLeftVariable64(n uint64, m int) uint64 { // amd64:"ROLQ" + // arm64:"ROR" // ppc64:"ROTL" // s390x:"RLLG" return bits.RotateLeft64(n, m) @@ -209,6 +211,7 @@ func RotateLeftVariable64(n uint64, m int) uint64 { func RotateLeftVariable32(n uint32, m int) uint32 { // amd64:"ROLL" + // arm64:"RORW" // ppc64:"ROTLW" // s390x:"RLL" return bits.RotateLeft32(n, m) |
