[Bug tree-optimization/61559] FAIL: gcc.dg/builtin-bswap-8.c on i686 with -mmovbe
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Thu Sep 4 11:52:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61559
--- Comment #14 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 4 Sep 2014, ubizjak at gmail dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61559
>
> --- Comment #12 from Uroš Bizjak <ubizjak at gmail dot com> ---
> (In reply to Uroš Bizjak from comment #11)
>
> > This one should be:
> >
> > (simplify
> > (bswap (bitop (bswap @0) (bswap @1)))
> > (bitop @0 @1))
>
> Oh, we already have this. Please disregard this message.
Not sure - we don't exactly have it. OTOH I think
that
(simplify
(bitop (bswap @0) (bswap @1))
(bswap (bitop @0 @1)))
is profitable in most cases (not only when wrapped inside another
bswap). Jakubs concern applies though.
OTOH
(simplify
(bswap (bitop (bswap @0) INTEGER_CST@1))
(bitop @0 (bswap @1)))))
may generally apply (not only to INTEGER_CST 2nd operand to bitop).
The argument would be that one bswap goes away. But again if
@0 was a memory and @1 is not then this isn't always profitable(?)
(well, the outer bswap goes away).
So merge the restricted first one and this to
(simplify
(bswap (bitop:c (bswap @0) @1))
(bitop @0 (bswap @1)))
? Thus only one operand of the bitop needs to be a bswap if
there is an outer bswap. For constant @1 the inner bswap
will be folded away as well as if @1 is a bswap itself.
/* PR61559. Transforms for gcc.dg/builtin-bswap-8.c */
(for bswap in BUILT_IN_BSWAP16 BUILT_IN_BSWAP32 BUILT_IN_BSWAP64
(simplify
(bswap (bswap @0))
@0)
(simplify
(bswap (bit_not (bswap @0)))
(bit_not @0))
(for bitop in bit_xor bit_ior bit_and
/* This might not be profitable if the inner bswaps are
free because @0 and @1 are memory operands and the
target has an instruction for load+bswap. */
(simplify
(bitop (bswap @0) (bswap @1))
(bswap (bitop @0 @1)))
(simplify
(bswap (bitop:c (bswap @0) @1))
(bitop @0 (bswap @1)))))
More information about the Gcc-bugs
mailing list