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

--- Comment #18 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #17)
> (In reply to Jakub Jelinek from comment #16)
> > For unsigned x % y == z if y is odd constant we can handle it for any
> > constant z, by computing m = mul_inv (y, 2^prec) and d = (2^prec / y) and
> > using x * m - (z * m) < d .
> 
> Is that preferable to testing (x - z) % y == 0?  Why?

That would require checking that it when x - z underflows if returns the
correct answer (or adding a && x >= z).

Reply via email to