https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112375
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This simple patch fixes the issue but I have not tested it yet, basically it moves the ins case before the zip: ``` diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 5fd7063663c..8a9b89807e3 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -24890,6 +24890,8 @@ aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d) return true; else if (aarch64_evpc_dup (d)) return true; + else if (aarch64_evpc_ins (d)) + return true; else if (aarch64_evpc_zip (d)) return true; else if (aarch64_evpc_uzp (d)) @@ -24898,8 +24900,6 @@ aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d) return true; else if (aarch64_evpc_sel (d)) return true; - else if (aarch64_evpc_ins (d)) - return true; else if (aarch64_evpc_reencode (d)) return true; ``` But maybe this needs some better cost mechanism because right now even though we might be able to do ins because of reencoding zip might be detected first.