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

--- Comment #13 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> (for bitop in bit_xor bit_ior bit_and
>   (for bswap in BUILT_IN_BSWAP16 BUILT_IN_BSWAP32 BUILT_IN_BSWAP64
>     (simplify
>       (bitop (bswap @0) (bswap @1))
>       (bswap (bitop @0 @1))))
>   (simplify
>     (bitop (vec_perm @1 @2 @0) (vec_perm @3 @4 @0))
>     (vec_perm (bitop @1 @3) (bitop @2 @4) @0)))
> 
> not sure if the vector permute one is profitable (but I guess a
> permute is always more expensive than a bit operation).

For the vector version, there is no reason to restrict to bit operations. It
works just as well for float addition, etc. And at least in the case where
@1==@3&&@2==@4 (I hope there is always a CSE to clean up the duplicated bitop)
and everything is single-use, it is profitable.

> The requested transform of course relies on somebody transforming
> bswap (bswap (x)) to x and for vec_perm detecting a cancelling
> operation (tree-ssa-forwprop.c can do that already I think).

Yes for vec_perm, in simplify_permutation.

Reply via email to