[Bug middle-end/82853] Optimize x % 3 == 0 without modulo

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 3 11:41:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82853

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
http://duriansoftware.com/joe/Optimizing-is-multiple-checks-with-modular-arithmetic.html

Do we want to do this at GIMPLE time ignoring costs, or during expansion time?
Doing it later has the benefit that we can compare costs and could avoid
breaking say divmod recognition, or finding out multiple uses of the modulo,
etc.
Doing it earlier has the benefit for vectorization I guess, otherwise we need a
pattern recognizer that will work like the expansion.


More information about the Gcc-bugs mailing list