[Bug tree-optimization/71289] Fails to optimize unsigned mul overflow check 'A > -1 / B'
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 26 21:18:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71289
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
I think genmatch can handle calls to internal functions, the issue is with
guessing the return type. Maybe we could have a specific heuristic for these
functions in the case where the type is not explicitly specified.
(for cmp (lt ge)
out (ne eq)
(simplify
(cmp (trunc_div:s integer_all_onesp @1) @0)
(if (TYPE_UNSIGNED (TREE_TYPE (@0))
&& !VECTOR_TYPE_P (TREE_TYPE (@0)))
(with { tree cpx = build_complex_type (TREE_TYPE (@0)); }
(out
(imagpart (IFN_MUL_OVERFLOW:cpx @0 @1))
{ build_zero_cst (TREE_TYPE (@0)); })))))
(and the symmetric)
The approach seems fine to me.
More information about the Gcc-bugs
mailing list