LoongArch: Increase cost of vector aligned store/load.

Message ID 20231116061709.9897-1-xujiahao@loongson.cn
State Unresolved
Headers
Series LoongArch: Increase cost of vector aligned store/load. |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Jiahao Xu Nov. 16, 2023, 6:17 a.m. UTC
  Based on SPEC2017 performance evaluation results, making them equal to the
cost of unaligned store/load to avoid odd alignment peeling is better.

gcc/ChangeLog:

	* config/loongarch/loongarch.cc
	(loongarch_builtin_vectorization_cost): Adjust.
  

Comments

WANG Xuerui Nov. 16, 2023, 7:30 a.m. UTC | #1
On 11/16/23 14:17, Jiahao Xu wrote:
> Based on SPEC2017 performance evaluation results, making them equal to the
> cost of unaligned store/load to avoid odd alignment peeling is better.

Paraphrasing a bit to shorten the subject of the sentence:

"it's better to make them equal to ... so as to avoid odd-alignment peeling"

>
> gcc/ChangeLog:
>
> 	* config/loongarch/loongarch.cc
> 	(loongarch_builtin_vectorization_cost): Adjust.
>
> diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
> index 738911661d7..d05743bec87 100644
> --- a/gcc/config/loongarch/loongarch.cc
> +++ b/gcc/config/loongarch/loongarch.cc
> @@ -3893,11 +3893,9 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
>         case scalar_stmt:
>         case scalar_load:
>         case vector_stmt:
> -      case vector_load:
>         case vec_to_scalar:
>         case scalar_to_vec:
>         case scalar_store:
> -      case vector_store:
>   	return 1;
>   
>         case vec_promote_demote:
> @@ -3905,6 +3903,8 @@ loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
>   	return LASX_SUPPORTED_MODE_P (mode)
>   	  && !LSX_SUPPORTED_MODE_P (mode) ? 2 : 1;
>   
> +      case vector_load:
> +      case vector_store:
>         case unaligned_load:
>         case unaligned_store:
>   	return 2;
  

Patch

diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index 738911661d7..d05743bec87 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -3893,11 +3893,9 @@  loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
       case scalar_stmt:
       case scalar_load:
       case vector_stmt:
-      case vector_load:
       case vec_to_scalar:
       case scalar_to_vec:
       case scalar_store:
-      case vector_store:
 	return 1;
 
       case vec_promote_demote:
@@ -3905,6 +3903,8 @@  loongarch_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
 	return LASX_SUPPORTED_MODE_P (mode)
 	  && !LSX_SUPPORTED_MODE_P (mode) ? 2 : 1;
 
+      case vector_load:
+      case vector_store:
       case unaligned_load:
       case unaligned_store:
 	return 2;