]> Cypherpunks repositories - gostls13.git/commit
[dev.ssa] cmd/compile/internal/ssa/gen: generate better code when right-shifting...
authorAlexandru Moșoi <mosoi@google.com>
Thu, 6 Aug 2015 16:33:49 +0000 (18:33 +0200)
committerKeith Randall <khr@golang.org>
Thu, 6 Aug 2015 19:22:27 +0000 (19:22 +0000)
commitd2150c83284c06ef3d7e106ca52160a8d1caeca2
treea83896f2168defeffa6ec1119bfde4c0f3c37f08
parentca088cf4e59a1e9ef97dbbf16f035a152a8ddda8
[dev.ssa] cmd/compile/internal/ssa/gen: generate better code when right-shifting with a constant.

The lowering rules were missing the non-64 bit case.

SBBLcarrymask can be folded to a int32 integer whose
type has a smaller bit size. Without the new AND rules
the following would be generated:

    v19 = MOVLconst <uint8> [-1] : SI
    v20 = ANDB <uint8> v18 v19 : DI

which is obviously a NOP.

Fixes #12022

Change-Id: I5f4209f78edc0f118e5b9b2908739f09cefebca4
Reviewed-on: https://go-review.googlesource.com/13301
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go