The following fixes PR61559 by implementing the bswap cancellation patters required for gcc.dg/builtin-bswap-8.c in match.pd.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2014-12-13 Richard Biener <rguent...@suse.de> PR middle-end/61559 * match.pd: Implement bswap patterns for transforms checked by gcc.dg/builtin-bswap-8.c. Index: trunk/gcc/match.pd =================================================================== *** trunk.orig/gcc/match.pd 2014-11-12 13:43:22.923443604 +0100 --- trunk/gcc/match.pd 2014-11-12 13:44:44.768440023 +0100 *************** along with GCC; see the file COPYING3. *** 624,629 **** --- 624,643 ---- @1) + /* BSWAP simplifications, transforms checked by gcc.dg/builtin-bswap-8.c. */ + (for bswap (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 (bit_xor bit_ior bit_and) + (simplify + (bswap (bitop:c (bswap @0) @1)) + (bitop @0 (bswap @1))))) + + /* Simplifications of comparisons. */ /* We can simplify a logical negation of a comparison to the