On Mon, Jun 10, 2019 at 1:20 PM Marc Glisse <marc.gli...@inria.fr> wrote:
>
> Hello,
>
> if we compare for instance size() and capacity() for a std::vector, we get
> this kind of pattern. I started with just nop conversions and got a bit
> carried away handling all those cases.
>
> Bootstrap+regtest on x86_64-pc-linux-gnu.

+  (cmp (convert?@3 (exact_div @0 INTEGER_CST@2)) (convert? (exact_div @1 @2)))
+  (if (element_precision (TREE_TYPE (@3)) >= element_precision (TREE_TYPE (@0))

You can elide TREE_TYPE for element_precision calls.

+       && types_match (TREE_TYPE (@0), TREE_TYPE (@1)))

OK with this change.

Thanks,
Richard.

> 2019-06-11  Marc Glisse  <marc.gli...@inria.fr>
>
> gcc/
>         * match.pd (X/[ex]4<Y/[ex]4): Handle conversions.
>
> gcc/testsuite/
>         * gcc.dg/tree-ssa/cmpexactdiv-5.c: New file.
>
> --
> Marc Glisse

Reply via email to