[Bug middle-end/82853] Optimize x % 3 == 0 without modulo
andi-gcc at firstfloor dot org
Sun Nov 5 21:05:00 GMT 2017
--- Comment #8 from Andi Kleen <andi-gcc at firstfloor dot org> ---
I'm not sure if it works with other numbers too.
(need to dig through Hacker's delight & Matters Computational to see if they
have anything on it)
But it could be extended for other word lengths at least
BTW there are some other cases, will file a bug shortly on those too.
More information about the Gcc-bugs