]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: reduce bits.Div64(0, lo, y) to 64 bit division
authorJosh Bleecher Snyder <josharian@gmail.com>
Sat, 20 Apr 2019 18:09:34 +0000 (11:09 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sat, 20 Apr 2019 19:34:03 +0000 (19:34 +0000)
commit68d4b1265ec7915dccfccf6c0e32f9ab2d9c3a86
treeec4088bbe86f6c81e917f2db3a03e4784e14dd35
parentd23cba683e59f6092c1e3f676c8e83e7973f27dd
cmd/compile: reduce bits.Div64(0, lo, y) to 64 bit division

With this change, these two functions generate identical code:

func f(x uint64) (uint64, uint64) {
return bits.Div64(0, x, 5)
}

func g(x uint64) (uint64, uint64) {
return x / 5, x % 5
}

Updates #31582

Change-Id: Ia96c2e67f8af5dd985823afee5f155608c04a4b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/173197
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/codegen/mathbits.go