[Bug tree-optimization/55177] missed optimizations with __builtin_bswap

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 15 09:19:52 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=94718

--- Comment #23 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #20)
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 363006e28fd..d0258a19534 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -1393,7 +1393,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>            /* Or if the precision of TO is not the same as the precision
>               of its mode.  */
>            || !type_has_mode_precision_p (type)))
> -   (convert (bitop @0 (convert @1))))))
> +   (convert (bitop @0 (convert @1)))))
> + (simplify
> +  (convert (bitop:c (nop_convert @0) @1))
> +  (if (tree_nop_conversion_p (type, TREE_TYPE (@1))
> +       && types_match (type, TREE_TYPE (@0)))
> +   (bitop @0 (convert @1)))))
> 
>  (for bitop (bit_and bit_ior)
>       rbitop (bit_ior bit_and)

Note this part of the patch went in as part of PR 94718.


More information about the Gcc-bugs mailing list