http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54346
Bug #: 54346 Summary: combine permutations Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: gli...@gcc.gnu.org Hello, when we have two VEC_PERM_EXPR with constant mask, where one is the only user of the result of the other one, it would be good to compose/merge them into a single VEC_PERM_EXPR. However, it is too hard for backends to always generate optimal code for shuffles, so we want to do the optimization only if we know it actually helps. Currently this means when the composed permutation is the identity. In the future, it could mean asking the backend. See the conversation that started at: http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00676.html and around this message for cost hooks (which could also help the vectorizer): http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00973.html Related bug is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43147 but that one is about RTL (unless x86 eventually follows ARM and decides to implement _mm_* functions in terms of __builtin_shuffle).