From patchwork Tue Jul 9 12:47:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christoph_M=C3=BCllner?= X-Patchwork-Id: 1958406 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256 header.s=google header.b=riMmqH1W; dkim-atps=neutral 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 4WJLQX5mFxz1yV0 for ; Tue, 9 Jul 2024 22:48:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A14F383431E for ; Tue, 9 Jul 2024 12:48:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 0AB5B386C5A7 for ; Tue, 9 Jul 2024 12:48:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AB5B386C5A7 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0AB5B386C5A7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::132 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720529297; cv=none; b=cdbuqIrnIScgdoL4CkNpIzgveWW9ucClLsu7i/mq5dX7siS87PNqfVzOeTJTe+5qaGXWF6p9m5kIq9IKxuhd6YHy/BP685VoRzjTsHPaKhBFN8vu7DvKQ1eorrJRoVQ5lus0q0izE7beNsm7TlutzYDNKCPvS39WAy13lqdwxtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720529297; c=relaxed/simple; bh=mpLgOiVfo33Ljt3HU2LxKkvn4wa6WZQOy3cQZgE61bo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XMcHS12VW5i4p6mDEdSymJEOtp8oOg2XfqnLmNQSV5QHNPjRzV70QugJW8IOKN3fYkbp9AaEuo/HBlNRl6hUN1AVwui0h56W6gDrvQlRJwo0Vt2sFUBANAnWI3NeuRoniKL1RsVea1Sk/Zrx/L8u6qKh2RhVJYr3XVEA3WBlVSQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-52ea5dc3c66so6972780e87.3 for ; Tue, 09 Jul 2024 05:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1720529285; x=1721134085; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=r1MTP3FpQi98cMloGhlI3E2WA45cT5jgU2mglm5iRR0=; b=riMmqH1WxpMhTuTwyGVyY1/6Iq2zhxlXgapXojYdJgMuW1GkYma9rnGKBc1fPFxSbc iYyz0yE5tVTvYPUmXRwh/mOhzgeZ8QoGLkuhP0qSmKhyg+zRwG0lSo60BVItGd+po/Po aEeAZBB+3RFSmIiTUCM6FvDYeaTh3nS3yiCX6TCrOx9tiwAlR8TdRYLp1u9GVVHMmxMN IYJYf1/OFbo5ddyjqANFm8LdnHwcTOIZ2NKHWGWVGyTjezRBbsfW1ICjfBNMAkCRmos5 PKQ67ffR4WsKm7aJcj4w8oRuK10qdCbHCigFQbC5BycBjSS1dCP9Flt+Q2C1K/l6x/A3 Pg/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720529285; x=1721134085; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r1MTP3FpQi98cMloGhlI3E2WA45cT5jgU2mglm5iRR0=; b=Olf4jONQPYzgiiPwqDAUf9h+dVuovT/DVqMCUikU2IS+jAVH+Ef8NT/76YAPfZJ58h R3bZ14xC7sHCLXmpeDg7lfHJOZ8V4IDC+/x0sS/Zyqk/j5+pPJA2QIKaTyugR96MCmBA gT5aSr6UWpTKhmqW8LxF5RIhW1Fftkj5h0JI5hieDKcTw1GUn/x2qYLde9a/40cDOh6j DxnaWzfG7jpQR74NNoDcOddirnxddP92H3fvLubcd7iSpPpF87Yry3MtZ86+5cOsFBiU 4mHutL/RMlCzbcZzg5Y4UbwjZPMwbqbmsZpN11upYTQuUM+FbBWNxC4Bbd71xGoOCTsb 4l5w== X-Gm-Message-State: AOJu0YyUdBKDdF+PPgv+rLG9GIM8mqT1vcLRTwLPqQgjCedgZMcmkrI/ T4WH/oH3B+7o4egTEeaAY4BMgcY8RTUo4el36/5ZY8WCWvnLI09RfMjiMKD3QN2bu9BpXPoZ+kJ m9/o= X-Google-Smtp-Source: AGHT+IHX303K0NJPQXofHp0b8mvSd/yddMJ9Z1/vsJkNsVLF21faB6g3x19YsRuZ0FPqI2YqZ+4/Eg== X-Received: by 2002:a05:6512:3b90:b0:52c:76ac:329b with SMTP id 2adb3069b0e04-52eb99a35dfmr2061457e87.35.1720529284518; Tue, 09 Jul 2024 05:48:04 -0700 (PDT) Received: from antares.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6dc721sm74268466b.53.2024.07.09.05.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 05:48:03 -0700 (PDT) From: =?utf-8?q?Christoph_M=C3=BCllner?= To: gcc-patches@gcc.gnu.org, Kito Cheng , Jim Wilson , Palmer Dabbelt , Andrew Waterman , Philipp Tomsich , Jeff Law , Vineet Gupta , Pan Li , Patrick O'Neill Cc: =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH 0/6] RISC-V: Rewrite target arch attribute handling Date: Tue, 9 Jul 2024 14:47:51 +0200 Message-ID: <20240709124757.1405749-1-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_MANYTO, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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 As reported in PR 115554 and PR 115562, the current RISC-V target attribute handling code suffers from ICEs for legal inputs. An analysis of the code revealed deficits in the way target arch attributes are stored in the backend. This series attempts to address these issues. The first four commit are independent code cleanups that don't introduce new functionality. Patch five is the rewrite of the code that stores arch attributes. And patch six ensures enabled extensions may be added via arch attributes, giving them an accumulation semantics. Each patch of the series has been regression tested (rv32+rv64). Further, the series has been build with --enable-werror-always to ensure no new build warnings. Note, that patch 5 introduces six regression, which are addressed by patch 6 (the commit message lists them). This rewrite was motivited by issues that were discovered while analysing a build issue with a patchset to introduce optimized string processing routines for RISC-V in glibc. See also: https://sourceware.org/pipermail/libc-alpha/2024-June/157627.html Christoph Müllner (6): RISC-V: testsuite: Properly gate LTO tests RISC-V: Deduplicate arch subset list processing RISC-V: Attribute parser: Use alloca() instead of new + std::unique_ptr RISC-V: Fix comment/naming in attribute parsing code RISC-V: Rewrite target attribute handling RISC-V: Allow adding enabled extension via target arch attributes gcc/common/config/riscv/riscv-common.cc | 160 +++--------------- gcc/config/riscv/riscv-c.cc | 2 +- gcc/config/riscv/riscv-subset.h | 9 +- gcc/config/riscv/riscv-target-attr.cc | 122 +++++++------ gcc/config/riscv/riscv.cc | 22 ++- gcc/config/riscv/riscv.opt | 2 +- .../gcc.target/riscv/interrupt-misaligned.c | 2 +- gcc/testsuite/gcc.target/riscv/pr115554.c | 11 ++ gcc/testsuite/gcc.target/riscv/pr115562.c | 25 +++ gcc/testsuite/gcc.target/riscv/pr93202.c | 2 +- .../gcc.target/riscv/target-attr-01.c | 16 +- .../gcc.target/riscv/target-attr-02.c | 16 +- .../gcc.target/riscv/target-attr-03.c | 11 +- .../gcc.target/riscv/target-attr-04.c | 11 +- .../gcc.target/riscv/target-attr-05.c | 10 +- .../gcc.target/riscv/target-attr-06.c | 11 +- .../gcc.target/riscv/target-attr-07.c | 10 +- .../gcc.target/riscv/target-attr-08.c | 20 +++ .../gcc.target/riscv/target-attr-09.c | 19 +++ .../gcc.target/riscv/target-attr-10.c | 19 +++ .../gcc.target/riscv/target-attr-11.c | 22 +++ .../gcc.target/riscv/target-attr-12.c | 21 +++ .../gcc.target/riscv/target-attr-13.c | 21 +++ .../gcc.target/riscv/target-attr-14.c | 42 +++++ .../gcc.target/riscv/target-attr-15.c | 42 +++++ .../gcc.target/riscv/target-attr-16.c | 26 +++ 26 files changed, 428 insertions(+), 246 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/pr115554.c create mode 100644 gcc/testsuite/gcc.target/riscv/pr115562.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-08.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-09.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-12.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-13.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-14.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-15.c create mode 100644 gcc/testsuite/gcc.target/riscv/target-attr-16.c