From patchwork Sat Aug 12 02:57:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 1820480 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=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=QYudSLMj; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RN51y073Sz1yYC for ; Sat, 12 Aug 2023 12:57:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 00B4F3858C00 for ; Sat, 12 Aug 2023 02:57:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 00B4F3858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691809076; bh=ugpifrU1a7TSfZOgRTfL8moTcp3FnhBu8i2072Mbg1o=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=QYudSLMj7fbUiJ6nXoSszEagaoVxxgPyOAycNcAR0A1LnrBCrOtogAXiVFamIae4D 5YpRzQ4ZsOh/rOyPaQS+kmM7tb1naEooKoZJIyYMsvVU/ddLGGJp9g+wSwIaxPGX62 qojIfJLKLu07C5a4BW7o3gazikvfIrpkhT4lsbu4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id C3EAE3858D1E for ; Sat, 12 Aug 2023 02:57:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3EAE3858D1E Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id C1676300089; Sat, 12 Aug 2023 02:57:32 +0000 (UTC) To: Tsukasa OI , Kito Cheng , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: [PATCH 0/3] RISC-V: Add stub support for existing extensions Date: Sat, 12 Aug 2023 02:57:17 +0000 Message-ID: Mime-Version: 1.0 X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KAM_MANYTO, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Tsukasa OI via Gcc-patches From: Tsukasa OI Reply-To: Tsukasa OI Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hello, After commit c283c4774d1c ("RISC-V: Throw compilation error for unknown extensions") changed how do we handle unknown extensions, we have no guarantee that we can share the same architectural string with Binutils (specifically, the assembler). To avoid compilation errors on shared Assembler-C/C++ projects, GCC should support almost all extensions that Binutils support, even if the GCC does not touch a thing. In this patch set, it adds stub extension support along with its implications (for GCC preprocessor support). The author excluded those extensions: 1. 'Zicntr' and 'Zihpm' (because additional compatibility measures are required) 2. 'Q' and "Zqinx" (because GCC does not support 'Q' and 'Zqinx' is not ratified) and included following extensions not yet supported by Binutils: * 'Zcmp', 'Zcmt' and 'Zce' extensions They are ratified and if we only need a stub support, it's relatively easy to implement. This patch set consists of three patches: 1. Privileged Extensions Unlikely to cause merge conflicts and easy to implement. 2. Vendor Extension ('XVentanaCondOps') Unlikely to cause merge conflicts unless someone tries to merge optimization using 'Zicond' with 'XVentanaCondOps' (because 'Zicond' and 'XVentanaCondOps' are pretty much the same except encodings). 3. Standard Unprivileged Extensions Likely to cause merge conflicts depending on the order to apply patches. In that case, prefer others (because this patchset adds *stub* support for those extensions). On this patch set, I focused on adding stub support for new extensions in GCC (in the GCC perspective) and not all Binutils' contents are ported. I'll submit separate patch set to port additional implications (e.g. 'M' -> 'Zmmul', 'Zve32x' -> 'Zicsr'). And despite that I implemented stub 'Zce' support, its implications are not complete (e.g. 'Zce' + 'F' -> 'Zcf' is not implemented and planned for the next patch set). Thanks, Tsukasa Tsukasa OI (3): RISC-V: Add stub support for existing extensions (privileged) RISC-V: Add stub support for existing extensions (vendor) RISC-V: Add stub support for existing extensions (unprivileged) gcc/common/config/riscv/riscv-common.cc | 45 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/predef-29.c | 35 +++++++++++++++++ gcc/testsuite/gcc.target/riscv/predef-30.c | 27 +++++++++++++ gcc/testsuite/gcc.target/riscv/predef-31.c | 31 +++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/predef-29.c create mode 100644 gcc/testsuite/gcc.target/riscv/predef-30.c create mode 100644 gcc/testsuite/gcc.target/riscv/predef-31.c base-commit: 8be20733b38c200f375cacf698d6b85e76055bcd