cmd/compile: simplify shifts when the counter fits 6 bits.
In f the extra & 63 is redundant because SHRQ already looks at the bottom 6 bits only. This is a trick on AMD64 to get rid of CMPQ/SBBQ/ANDQ if one knows that the shift counter is small. func f(x uint64, s uint) uint64 { return x >> (s & 63) } Change-Id: I4861c902168dabec9a6a14a85750246dde94fc08 Reviewed-on: https://go-review.googlesource.com/21073Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro> TryBot-Result: Gobot Gobot <gobot@golang.org>
Showing
Please
register
or
sign in
to comment