On 6/1/2022 7:55 AM, Jakub Jelinek via Gcc-patches wrote:
Hi! A comparison with a constant is most likely always faster than .MUL_OVERFLOW from which we only check whether it overflowed and not the multiplication result, and even if not, it is simpler operation on GIMPLE and even if a target exists where such multiplications with overflow checking are cheaper than comparisons, because comparisons are so much more common than overflow checking multiplications, it would be nice if it simply arranged for comparisons to be emitted like those multiplications on its own... Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-06-01 Jakub Jelinek <ja...@redhat.com> PR middle-end/30314 * match.pd (__builtin_mul_overflow_p (x, cst, (utype) 0) -> x > ~(utype)0 / cst): New simplification. * gcc.dg/tree-ssa/pr30314.c: New test.
OK jeff