From patchwork Wed Feb 22 09:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jin Ma X-Patchwork-Id: 65446 X-Patchwork-Delegate: kito.cheng@gmail.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50E5E3858C5E for ; Wed, 22 Feb 2023 09:44:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50E5E3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677059093; bh=N9562vaDia6mQfnG82en7XwLvjaSCwUAvTyqnvI5Mis=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=jtnoHD/g716pgws13sYTlTMt9ian2LCgH5jKndo+0NPHAIxKYQMAyYGYpiZFjSc+Y pcFzT9MUoOMsOMRW/3wuC1KLLhDmURP9ENrF9DK/YW+JTPSfKfUbRu/EnmRWkl9wY2 Q5gnCcjck8uOZfobAe2Q8eWaj4BneDmx4N/Dk+A0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by sourceware.org (Postfix) with ESMTPS id 7CA4D3858D33 for ; Wed, 22 Feb 2023 09:44:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CA4D3858D33 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R811e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045170; MF=jinma@linux.alibaba.com; NM=1; PH=DS; RN=5; SR=0; TI=SMTPD_---0VcGUNE9_1677059056; Received: from localhost.localdomain(mailfrom:jinma@linux.alibaba.com fp:SMTPD_---0VcGUNE9_1677059056) by smtp.aliyun-inc.com; Wed, 22 Feb 2023 17:44:18 +0800 To: gcc-patches@gcc.gnu.org Cc: kito.cheng@sifive.com, kito.cheng@gmail.com, palmer@dabbelt.com, Jin Ma Subject: [PATCH] RISC-V: When the TARGET_COMPUTE_MULTILIB hook is implemented, check the version of each extension. Date: Wed, 22 Feb 2023 17:43:51 +0800 Message-Id: <20230222094351.1075-1-jinma@linux.alibaba.com> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 X-Spam-Status: No, score=-21.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jin Ma via Gcc-patches From: Jin Ma Reply-To: Jin Ma Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "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;