On Fri, Aug 5, 2022 at 2:59 PM Andre Vieira (lists) via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > This isn't really a 'PATCH' yet, it's something I was working on but had > to put on hold. Feel free to re-use any bits or trash all of it if you'd > like.
@@ -10264,6 +10264,44 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, case VEC_PERM_EXPR: { + if (TREE_CODE (treeop2) == VECTOR_CST + && targetm.vectorize.vla_constructor) + { + tree ctor0, ctor1; + if (TREE_CODE (treeop0) == SSA_NAME + && is_gimple_assign (SSA_NAME_DEF_STMT (treeop0))) + ctor0 = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (treeop0)); + else + ctor0 = treeop0; + if (TREE_CODE (treeop1) == SSA_NAME + && is_gimple_assign (SSA_NAME_DEF_STMT (treeop1))) + ctor1 = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (treeop1)); just to say - you can't lookup things like this, you have to go through the TER machinery, otherwise the expansions for the CTOR elements might be clobbered already. That means to be fully effective doing this during RTL expansion is likely limited.