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

Message ID 20230222094351.1075-1-jinma@linux.alibaba.com
State Deferred
Delegated to: Kito Cheng
Headers
Series RISC-V: When the TARGET_COMPUTE_MULTILIB hook is implemented, check the version of each extension. |

Commit Message

Jin Ma Feb. 22, 2023, 9:43 a.m. UTC
  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(-)
  

Comments

Kito Cheng Feb. 22, 2023, 12:42 p.m. UTC | #1
Unaddressed
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 <jinma@linux.alibaba.com> 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

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;