diff options
| author | Brian Kessler <brian.m.kessler@gmail.com> | 2019-05-17 15:16:38 -0600 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2019-08-31 17:03:04 +0000 |
| commit | b003afe4fea9427ea8d8014dd4be1b02124af520 (patch) | |
| tree | bea977ddbd776b179bd35f3b8c42837e74f683d9 /test/codegen/mathbits.go | |
| parent | 12dbd20a50f223aa3b7adc579e4db0fd9abfb8dd (diff) | |
| download | go-b003afe4fea9427ea8d8014dd4be1b02124af520.tar.xz | |
cmd/compile: intrinsify RotateLeft32 on wasm
wasm has 32-bit versions of all integer operations. This change
lowers RotateLeft32 to i32.rotl on wasm and intrinsifies the math/bits
call. Benchmarking on amd64 under node.js this is ~25% faster.
node v10.15.3/amd64
name old time/op new time/op delta
RotateLeft 8.37ns ± 1% 8.28ns ± 0% -1.05% (p=0.029 n=4+4)
RotateLeft8 11.9ns ± 1% 11.8ns ± 0% ~ (p=0.167 n=5+5)
RotateLeft16 11.8ns ± 0% 11.8ns ± 0% ~ (all equal)
RotateLeft32 11.9ns ± 1% 8.7ns ± 0% -26.32% (p=0.008 n=5+5)
RotateLeft64 8.31ns ± 1% 8.43ns ± 2% ~ (p=0.063 n=5+5)
Updates #31265
Change-Id: I5b8e155978faeea536c4f6427ac9564d2f096a46
Reviewed-on: https://go-review.googlesource.com/c/go/+/182359
Run-TryBot: Brian Kessler <brian.m.kessler@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Diffstat (limited to 'test/codegen/mathbits.go')
| -rw-r--r-- | test/codegen/mathbits.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 61e5db56e1..9cdfe0b06a 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -213,6 +213,7 @@ func RotateLeft32(n uint32) uint32 { // ppc64:"ROTLW" // ppc64le:"ROTLW" // s390x:"RLL" + // wasm:"I32Rotl" return bits.RotateLeft32(n, 9) } @@ -232,6 +233,7 @@ func RotateLeftVariable(n uint, m int) uint { // ppc64:"ROTL" // ppc64le:"ROTL" // s390x:"RLLG" + // wasm:"I64Rotl" return bits.RotateLeft(n, m) } @@ -241,6 +243,7 @@ func RotateLeftVariable64(n uint64, m int) uint64 { // ppc64:"ROTL" // ppc64le:"ROTL" // s390x:"RLLG" + // wasm:"I64Rotl" return bits.RotateLeft64(n, m) } @@ -251,6 +254,7 @@ func RotateLeftVariable32(n uint32, m int) uint32 { // ppc64:"ROTLW" // ppc64le:"ROTLW" // s390x:"RLL" + // wasm:"I32Rotl" return bits.RotateLeft32(n, m) } |
