]> Cypherpunks repositories - gostls13.git/commit
runtime: always mask shift amount regardless of architecture
authorMichael Munday <mike.munday@ibm.com>
Sun, 31 Mar 2019 14:23:07 +0000 (15:23 +0100)
committerMichael Munday <mike.munday@ibm.com>
Sun, 31 Mar 2019 15:45:58 +0000 (15:45 +0000)
commit7b62e984d941c753e7fb20f8b59a49acf62c88a7
tree7be575d99ad0be38a0a4e253a72d89e44a8596ca
parente6ad619ad673d7484535afd4185209b0e9aa95c8
runtime: always mask shift amount regardless of architecture

Currently the shift amount is only masked on x86. Change it so it
is masked on all architectures. In the worst case we generate a
couple of extra instructions to perform the masking and in the best
case we can elide overflow checks.

This particular shift could also be replaced with a rotate
instruction during optimization which would remove both the masking
instructions and overflow checks on all architectures.

Fixes #31165.

Change-Id: I16b7a8800b4ba8813dc83735dfc59564e661d3b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/170122
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/map.go