From 3cfd003a8a89c6662b4b63d837a8cfae95e6762a Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Fri, 2 Aug 2019 02:20:38 +0000 Subject: cmd/compile: optimize ARM's math.bits.RotateLeft32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL optimizes math.bits.RotateLeft32 to inline "MOVW Rx@>Ry, Rd" on ARM. The benchmark results of math/bits show some improvements. name old time/op new time/op delta RotateLeft-4 9.42ns ± 0% 6.91ns ± 0% -26.66% (p=0.000 n=40+33) RotateLeft8-4 8.79ns ± 0% 8.79ns ± 0% -0.04% (p=0.000 n=40+31) RotateLeft16-4 8.79ns ± 0% 8.79ns ± 0% -0.04% (p=0.000 n=40+32) RotateLeft32-4 8.16ns ± 0% 7.54ns ± 0% -7.68% (p=0.000 n=40+40) RotateLeft64-4 15.7ns ± 0% 15.7ns ± 0% ~ (all equal) updates #31265 Change-Id: I77bc1c2c702d5323fc7cad5264a8e2d5666bf712 Reviewed-on: https://go-review.googlesource.com/c/go/+/188697 Run-TryBot: Ben Shi TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- test/codegen/mathbits.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/codegen/mathbits.go') diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 0d94bd1bc8..ea90e3a50e 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -208,6 +208,7 @@ func RotateLeft64(n uint64) uint64 { func RotateLeft32(n uint32) uint32 { // amd64:"ROLL" 386:"ROLL" + // arm:`MOVW\tR[0-9]+@>[$]23` // arm64:"RORW" // ppc64:"ROTLW" // ppc64le:"ROTLW" @@ -244,6 +245,7 @@ func RotateLeftVariable64(n uint64, m int) uint64 { } func RotateLeftVariable32(n uint32, m int) uint32 { + // arm:`MOVW\tR[0-9]+@>R[0-9]+` // amd64:"ROLL" // arm64:"RORW" // ppc64:"ROTLW" -- cgit v1.3