https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78821
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- All the store merging changes so far were for the same operations on all the loads/constant values. In order to handle something like this, we'd need to best hook in the bswap machinery, probably start with moving over the bswap pass from tree-ssa-math-opts.c to gimple-ssa-store-merging.c. Then for stores that are 8/16/32 bits wide, try/remember find_bswap_or_nop_1 (stmt as well as symbolic_number). Then, if the stores are really all adjacent and form a power of two bitsize and their symbolic numbers combined are cmpnop or cmpxchg consider that as identity or bswap operation and use bswap_replace to prepare the argument for the group store. Now, it would be somewhat different in the way it needs to be handled, the alignment needs to be taken into account already at coalesce_immediate_stores time and split_group would for such a group need to result in store of everything together.