]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: guard the &-to-<<>> opt against small constants
authorDavid Chase <drchase@google.com>
Tue, 8 Mar 2016 20:08:25 +0000 (15:08 -0500)
committerDavid Chase <drchase@google.com>
Tue, 8 Mar 2016 23:06:11 +0000 (23:06 +0000)
commit0321cabdfacc5472d2bc650de3e36ca10131b60a
tree86be5c101480ebf4a72c278f262b498db3b6ea58
parent4720f49e189fcfd52d8bc61cbf0fc913f3336542
cmd/compile: guard the &-to-<<>> opt against small constants

Converting an and-K into a pair of shifts for K that will
fit in a one-byte argument is probably not an optimization,
and it also interferes with other patterns that we want to
see fire, like (<< (AND K)) [for small K] and bounds check
elimination for masked indices.

Turns out that on Intel, even 32-bit signed immediates beat
the shift pair; the size reduction of tool binaries is 0.09%
vs 0.07% for only the 8-bit immediates.

RLH found this one working on the new/next GC.

Change-Id: I2414a8de1dd58d680d18587577fbadb7ff4f67d9
Reviewed-on: https://go-review.googlesource.com/20410
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go