https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108757
--- Comment #9 from Chip Kerchner <chip.kerchner at ibm dot com> --- Doesn't this work for powers of two (N) and signed values (for A, N and M)? (59 - (33 * -2)) / -2 + 31 = -62 + 31 = -29 and 59 / -2 = -29