From patchwork Fri Jul 5 09:56:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Gao X-Patchwork-Id: 1957262 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WFppX00M1z1xqb for ; Fri, 5 Jul 2024 19:57:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39BA2388458E for ; Fri, 5 Jul 2024 09:57:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from zg8tmja2lje4os43os4xodqa.icoremail.net (zg8tmja2lje4os43os4xodqa.icoremail.net [206.189.79.184]) by sourceware.org (Postfix) with ESMTP id B99D73844033 for ; Fri, 5 Jul 2024 09:56:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B99D73844033 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B99D73844033 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=206.189.79.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720173417; cv=none; b=aFM995WDfJ0n6MPzs9iKEG8PZ8vt1OuV5GaVAjVj6+PlZqzhH1gxIAlH61X8drONlAmIpQ2e1nqFfKdoC7l85rOc3+0fL21iSEKg6YERjlwTfpZp8Z40onv+e8nOzW73/A/6Qnt8P+ZVuJMwvy78oWbphAplr01JekPPOqEqkdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720173417; c=relaxed/simple; bh=zvi+M+4Q+tvsq+x03ho9VPdnCGvJiM6301OpRKEsHh8=; h=From:To:Subject:Date:Message-Id; b=QwD6uLavJ9itn8/jUXFTlPcj/ZHLRq9CnlkZetPogDOgOMnkALeH4a8AaxjwuAApmMz33vkLrhV8YqT7CgWZIhQh04T5pDjpkCzSw8CR9TJ6Uk1eBL2p8Vh+o+5dY+iNu+/1NtSQ5xX9Td0gd/yAicAm8XNS9Va6XaMWAEHLqE8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (unknown [10.12.130.31]) by app1 (Coremail) with SMTP id TAJkCgDniOVhw4dmKjAUAA--.12811S4; Fri, 05 Jul 2024 17:56:50 +0800 (CST) From: Fei Gao To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com, gaofei@eswincomputing.com Subject: [PATCH 0/2] [RISC-V] c implies zca, and conditionally zcf & zcd Date: Fri, 5 Jul 2024 09:56:29 +0000 Message-Id: <20240705095631.949-1-gaofei@eswincomputing.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: TAJkCgDniOVhw4dmKjAUAA--.12811S4 X-Coremail-Antispam: 1UD129KBjvJXoW7Zr17Zw1kXFyfZrWfGFyDZFb_yoW8trykpa yfC3yYyr98JrZxK3ZxKF18Xw4UursagrW5Zw48Aw1jya15JFWDXFyq9w1fWr45XFy8Wr13 uFWfuw15u3WYyrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUk214x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK6svPMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8Jw CI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2 z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUoOJ5UUUUU X-CM-SenderInfo: xjdrwv3l6h245lqf0zpsxwx03jof0z/ X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org According to Zc-1.0.4-3.pdf from https://github.com/riscvarchive/riscv-code-size-reduction/releases/tag/v1.0.4-3 The rule is that: 1. C always implies Zca 2. C+F implies Zcf (RV32 only) 3. C+D implies Zcd Patch 2 handles this implication. Without Patch 1, Patch 2 triggers an ICE when compiling gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-1.c with -march=rv32imafcv. The ICE is due to failure of gcc_assert (check_implied_ext ()) in riscv_subset_list::finalize (). check_implied_ext checks if ALL implied extensions have been added after handle_implied_ext. In rv32imafcv case, handle_implied_ext first handles 'c'. As there's no 'd' in subset list, zcd hasn't been added. Then handle_implied_ext handles 'v'. 'v' implies 'zve64d', and 'zve64d' implies 'd', so 'd' has been added into subset list. However, after handle_implied_ext, check_implied_ext finds 'c' and 'd' both available in subset list, but 'zcd' is not here, causing assert failure. Patch 1 sovles the assert failure by calling handle_implied_ext repeatly until there's no new subset added into the subset list. This patch series also helps to expose the conflict between c+d and zcmp/zcmt. Regession tested rv64gc with no new failures. Fei Gao (2): [RISC-V] add impied extension repeatly until stable [RISC-V] c impies zca, and conditionally zcf & zcd gcc/common/config/riscv/riscv-common.cc | 26 ++++++++++++++++--- gcc/config/riscv/riscv-subset.h | 3 +++ gcc/testsuite/gcc.target/riscv/arch-39.c | 7 +++++ gcc/testsuite/gcc.target/riscv/arch-40.c | 7 +++++ gcc/testsuite/gcc.target/riscv/attribute-15.c | 2 +- gcc/testsuite/gcc.target/riscv/attribute-18.c | 2 +- gcc/testsuite/gcc.target/riscv/pr110696.c | 2 +- .../riscv/rvv/base/abi-callee-saved-1-zcmp.c | 2 +- .../riscv/rvv/base/abi-callee-saved-2-zcmp.c | 2 +- .../gcc.target/riscv/rvv/base/pr114352-1.c | 4 +-- .../gcc.target/riscv/rvv/base/pr114352-3.c | 8 +++--- 11 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/arch-39.c create mode 100644 gcc/testsuite/gcc.target/riscv/arch-40.c