There are quite a few sequences that will produce a swap followed by a merge (low/high). This is mainly due to the SCALAR_TO_VECTOR on little endian requiring a swap (since all PPC instructions have a big endian bias). Due to its prevalence, these sequences often appear in fairly hot code, so we want to get rid of unnecessary swaps.
This patch does two things:
- Convert a merge (high/low) to the opposite merge if both inputs are swapped
- Convert a merge (high/low) to the opposite merge if one input is swapped and the other is symmetrical about the midpoint
What about XXSLDWIs here? It's the same as XXSLDWI but we know the two inputs are the same.