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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #4)
> I thought we might already simplify (u >> 32) != 0 to u >= cst (other
> possible forms are u != (uint64_t)(uint32_t)u, u & cst != 0, etc, I am
> trying to think which one looks most canonical).

We don't simplify that and am not sure it would actually be simplification in
many cases.  But perhaps we should have some canonical form if we don't
already.

> I expect in interesting cases the code will use z = (uint64_t)x * y twice,
> once to check for overflow, and once as (uint32_t)z to get the actual result
> (or there is a separate x*y and we want to CSE it with the overflow version).

I'm afraid that is something that can't be matched in match.pd though, we'd
need to do it elsewhere (e.g. tree-ssa-forwprop.c or tree-ssa-math-opts.c (next
to
match_uaddsub_overflow there?)).

Reply via email to