]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fold CMPconst and SHR
authorAlexandru Moșoi <brtzsnr@gmail.com>
Tue, 5 Apr 2016 21:32:49 +0000 (23:32 +0200)
committerAlexandru Moșoi <alexandru@mosoi.ro>
Thu, 7 Apr 2016 13:28:13 +0000 (13:28 +0000)
commit8448d3aace7f26bd6eca14e8b89c5a981c2ab9d3
tree1a01cc1444c82e3e66cd194cefca29b7e02a2471
parent121c434f7add815c3147b01a097a8998018bcc6b
cmd/compile: fold CMPconst and SHR

Fold the comparison when the SHR result is small.

Useful for:
- murmur mix like hashing where higher bits are desirable, i.e. hash = uint32(i * C) >> 18
- integer log2 via DeBruijn sequence: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn

Change-Id: If70ae18cb86f4cc83ab6213f88ced03cc4986156
Reviewed-on: https://go-review.googlesource.com/21514
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go
test/checkbce.go