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

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Nov 5 20:34:00 GMT 2017


Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-11-05
     Ever confirmed|0                           |1

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andi Kleen from comment #5)
> Also I'm not sure why you would want it in the middle end. It should all
> work at the tree level

Because we lose meaning and there is already code to handle the %N (where N is
a constant) to a multiplication in the middle-end so reusing that code would be
easy.  Plus 0 is simpler than 0x55555556.

More information about the Gcc-bugs mailing list