cmd/compile: add rules handling unsigned div/mod by constant 1<<63
Normally 64-bit div/mod is turned into runtime calls on 32-bit arch, but the front end leaves power-of-two constant division and hopes the SSA backend turns into a shift or AND. The SSA rule is (Mod64u <t> n (Const64 [c])) && isPowerOfTwo(c) -> (And64 n (Const64 <t> [c-1])) But isPowerOfTwo returns true only for positive int64, which leaves out 1<<63 unhandled. Add a special case for 1<<63. Fixes #21517. Change-Id: I02d27dc7177d4af0ee8d7f5533714edecddf8c95 Reviewed-on: https://go-review.googlesource.com/56890Reviewed-by: Keith Randall <khr@golang.org>
Showing
This diff is collapsed.
Please register or sign in to comment