https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97459
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I don't think the two are equivalent, consider e.g. (((__uint128_t)0xffffffffffffffdfULL)<<64)+0xffffffffffffffdfULL on this, the first function returns 1, the second 2. I believe Hacker's delign says that n % 3 == (((n >> 64) + (n & 0xffffffffffffffff)) % 3), but the addition there isn't a 64-bit number, but a 65-bit number, so either we'd need to take into account also the carry from the addition, or we'd need to do the addition still in 128-bits and do it once again afterwards e.g. (n >> 32) + (n & 0xffffffff), which then could be done in 64-bits already.