https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122152

--- Comment #8 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Making the permute cost 2 instead of 1 is already sufficient to get GCC 15's
codegen back:

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index ff46ffdb456..78e45242a45 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -407,7 +407,7 @@ static const common_vector_cost rvv_vls_vector_cost = {
   1, /* segment_permute (8) */
   1, /* vec_to_scalar_cost  */
   1, /* scalar_to_vec_cost  */
-  1, /* permute_cost  */
+  2, /* permute_cost  */
   1, /* align_load_cost  */
   1, /* align_store_cost  */
   2, /* unalign_load_cost  */
@@ -430,7 +430,7 @@ static const scalable_vector_cost rvv_vla_vector_cost = {
     1, /* segment_permute (8) */
     1, /* vec_to_scalar_cost  */
     1, /* scalar_to_vec_cost  */
-    1, /* permute_cost  */
+    2, /* permute_cost  */
     1, /* align_load_cost  */
     1, /* align_store_cost  */
     2, /* unalign_load_cost  */

Unfortunately, we still don't have any way of obtaining the permute constant
when costing a vec_perm.  That would simplify perm costing.

Reply via email to