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

--- Comment #16 from Daniel Henrique Barboza <daniel.barboza at oss dot 
qualcomm.com> ---
I am testing 3 new match.pd patterns.  One will handle f2 directly:

A % (CST shift (CST2 * zero_one)) EQ|NE 0  -> 
(A & ((zero_one ? CST shift CST2 : CST) + -1)) EQ|NE 0

There's an obvious variation from f2 which is the same thing without the mult
in the divisor:

(A % (CST shift zero_one)) EQ|NE 0 ->
(A & ((zero_one ? CST shift 1 : CST) - 1))

And I decided to include a generic pattern that uses ranger to identify pow2
operands:

(A % POW2_SSA_NAME) EQ|NE 0 -> (A & (POW_SSA_NAME -1)) EQ|NE 0

This last pattern won't generate premier code but it will catch more pow2 cases
than what we could manually predict.

Reply via email to