Re: [PATCH] RISC-V: When the TARGET_COMPUTE_MULTILIB hook is implemented, check the version of each extension.

2023-02-22 Thread Kito Cheng via Gcc-patches
Hi Jin:

Curious, did you introduce version info into the multi-lib path in
your donwstream GCC? I suspect we need a more complete solution to
deal with the multiversion issue, so it would be great if you can
provide more experience with this part?

Thanks :)


On Wed, Feb 22, 2023 at 5:44 PM Jin Ma  wrote:
>
> When there is an extension with different versions, the result of the 
> TARGET_COMPUTE_MULTILIB hook
> is generally wrong, so the version needs to be considered.
>
> gcc/ChangeLog:
>
> * common/config/riscv/riscv-common.cc 
> (riscv_subset_list::match_score): Match the version
> of each extension.
> ---
>  gcc/common/config/riscv/riscv-common.cc | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/common/config/riscv/riscv-common.cc 
> b/gcc/common/config/riscv/riscv-common.cc
> index ebc1ed7d7e4..0a15ff705d1 100644
> --- a/gcc/common/config/riscv/riscv-common.cc
> +++ b/gcc/common/config/riscv/riscv-common.cc
> @@ -331,10 +331,9 @@ riscv_subset_list::match_score (riscv_subset_list *list) 
> const
>/* list must be subset of current this list, otherwise it not safe to
>   link.
>   TODO: We might give different weight for each extension, but the rule 
> could
> -  be complicated.
> - TODO: We might consider the version of each extension.  */
> +  be complicated.  */
>for (s = list->m_head; s != NULL; s = s->next)
> -if (this->lookup (s->name.c_str ()) != NULL)
> +if (this->lookup (s->name.c_str (), s->major_version, s->minor_version) 
> != NULL)
>score++;
>  else
>return 0;
> --
> 2.17.1
>


[PATCH] RISC-V: When the TARGET_COMPUTE_MULTILIB hook is implemented, check the version of each extension.

2023-02-22 Thread Jin Ma via Gcc-patches
When there is an extension with different versions, the result of the 
TARGET_COMPUTE_MULTILIB hook
is generally wrong, so the version needs to be considered.

gcc/ChangeLog:

* common/config/riscv/riscv-common.cc (riscv_subset_list::match_score): 
Match the version
of each extension.
---
 gcc/common/config/riscv/riscv-common.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/common/config/riscv/riscv-common.cc 
b/gcc/common/config/riscv/riscv-common.cc
index ebc1ed7d7e4..0a15ff705d1 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -331,10 +331,9 @@ riscv_subset_list::match_score (riscv_subset_list *list) 
const
   /* list must be subset of current this list, otherwise it not safe to
  link.
  TODO: We might give different weight for each extension, but the rule 
could
-  be complicated.
- TODO: We might consider the version of each extension.  */
+  be complicated.  */
   for (s = list->m_head; s != NULL; s = s->next)
-if (this->lookup (s->name.c_str ()) != NULL)
+if (this->lookup (s->name.c_str (), s->major_version, s->minor_version) != 
NULL)
   score++;
 else
   return 0;
-- 
2.17.1