]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: rewrite pairs of shifts to extensions
authorMichael Munday <munday@ca.ibm.com>
Mon, 20 Feb 2017 20:54:43 +0000 (15:54 -0500)
committerMichael Munday <munday@ca.ibm.com>
Wed, 22 Feb 2017 21:31:03 +0000 (21:31 +0000)
commit72a071c1da98458e9f7ccf1812b401903acf5b1d
tree4a6e91144f897b49fb79e42e3f4ba2edd51edf78
parent8321be63396363cd18e9d23b4b05bcb3e5791fa7
cmd/compile: rewrite pairs of shifts to extensions

Replaces pairs of shifts with sign/zero extension where possible.

For example:
(uint64(x) << 32) >> 32 -> uint64(uint32(x))

Reduces the execution time of the following code by ~4.5% on s390x:

for i := 0; i < N; i++ {
        x += (uint64(i)<<32)>>32
}

Change-Id: Idb2d56f27e80a2e1366bc995922ad3fd958c51a7
Reviewed-on: https://go-review.googlesource.com/37292
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
src/cmd/compile/internal/ssa/shift_test.go