]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: optimize RotateLeft8/16 on arm64
authorruinan <ruinan.sun@arm.com>
Wed, 13 Jul 2022 09:00:57 +0000 (09:00 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 2 Sep 2022 17:46:31 +0000 (17:46 +0000)
commit121344ac338ef21d87eee4f64a60d0ae8a7f6fe3
treea01377bbbb4aa9f6c8401eee8277412d8062d249
parentf45c2d7e47e6dcfb69876092037257562813cc37
cmd/compile: optimize RotateLeft8/16 on arm64

This CL optimizes RotateLeft8/16 on arm64.

For 16 bits, we form a 32 bits register by duplicating two 16 bits
registers, then use RORW instruction to do the rotate shift.

For 8 bits, we just use LSR and LSL instead of RORW because the code is
simpler.

Benchmark          Old          ThisCL       delta
RotateLeft8-46     2.16 ns/op   1.73 ns/op   -19.70%
RotateLeft16-46    2.16 ns/op   1.54 ns/op   -28.53%

Change-Id: I09cde4383d12e31876a57f8cdfd3bb4f324fadb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/420976
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/gen/ARM64.rules
src/cmd/compile/internal/ssa/rewrite.go
src/cmd/compile/internal/ssa/rewriteARM64.go
test/codegen/mathbits.go