Hi,liwei:
It is best to add a test case. If the test case is really difficult to
extract, then enrich the description information.
Thanks!
在 2023/9/18 下午5:23, Li Wei 写道:
gcc/ChangeLog:
* config/loongarch/loongarch.cc (loongarch_builtin_vectorization_cost):
---
gcc/config/loongarch/loongarch.cc | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.cc
b/gcc/config/loongarch/loongarch.cc
index 845fad5a8e8..d24fc30570d 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -3860,17 +3860,18 @@ loongarch_builtin_vectorization_cost (enum
vect_cost_for_stmt type_of_cost,
switch (type_of_cost)
{
case scalar_stmt:
- case scalar_load:
case vector_stmt:
- case vector_load:
case vec_to_scalar:
case scalar_to_vec:
- case cond_branch_not_taken:
case vec_promote_demote:
case scalar_store:
- case vector_store:
+ case scalar_load:
return 1;
+ case vector_store:
+ case vector_load:
+ return 2;
+
case vec_perm:
return LASX_SUPPORTED_MODE_P (mode)
&& !LSX_SUPPORTED_MODE_P (mode) ? 2 : 1;
@@ -3881,14 +3882,20 @@ loongarch_builtin_vectorization_cost (enum
vect_cost_for_stmt type_of_cost,
case unaligned_store:
case vector_scatter_store:
- return 10;
+ return 5;
case cond_branch_taken:
- return 3;
+ return 4;
+
+ case cond_branch_not_taken:
+ return 2;
case vec_construct:
elements = TYPE_VECTOR_SUBPARTS (vectype);
- return elements / 2 + 1;
+ if (ISA_HAS_LASX)
+ return elements + 1;
+ else
+ return elements;
default:
gcc_unreachable ();