From patchwork Fri Dec 1 09:22:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1870506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nextmovesoftware.com header.i=@nextmovesoftware.com header.a=rsa-sha256 header.s=default header.b=K9Yys22F; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4ShSKQ0ZH8z23n0 for ; Fri, 1 Dec 2023 20:23:22 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBDF3385C413 for ; Fri, 1 Dec 2023 09:23:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 85D49385AC22 for ; Fri, 1 Dec 2023 09:22:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85D49385AC22 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 85D49385AC22 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=162.254.253.69 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701422573; cv=none; b=cpEjF/YDeHoGT6stDAKSbLUKIYGT+VbRUEmhpw66xkQ/xjV5oAduh4numOf8dS3ddwRr/a5qOSc+KX6nWD+83ANqEvK4ctS7YncKho5mpGmQkC5r69TQ8FccBYOA7vFxgdqg3lotplH6PEuuo3J7eMPOMVjAAnFYK3eAQegaBP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701422573; c=relaxed/simple; bh=dIeca0/gfrU2crliD7FiIBwdX9CoPrcfPC4EBj3KyFQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IYatt1auJdXuqiazY9C0I/hpv1xIR/a32vAWkOSqpIkAZeRu8BR6M3V7ePPRBtJccyj0Ait82V4RoOHxFP1nUIsWs+PPw09jN1Lg+buAGULIz7aHDgsKBErIB4qY2DeuG5Gb1TQqxEkbDdJLDAf+NbC/28rlfBnbm/ixsiX1scs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ipIyP7K4Rs04Xb7XO/9uShgoDeg/pUNttEM0HjEenRI=; b=K9Yys22F+HP55Fm4DJvYQJ2Yyi BtBP2lpgoRj0dGg3koyrMwMj+ynMRzLhNhYRv5JoBdVq98l5W92j3SgR5T80tOQuAIKznFpXq/lMW OZL67LGi1VzKUOBGi3s7sXHhlaarX+Va3hnc4CkSgknkwPW9JzJ5XeZvCtfMQy1KrC8p4D7ja1ykA 8vZ3b3BgTV4DdowsL9EVLQgxwABS0SfLWi/OCwWoFcxcFHIlsT/kv3H3SqRy+fYhCPx3TwozUU830 DbsOHXAPl6TFt+wZlEMnPoJLyZ8HpCefjLnH1AaWBHk+izDmuw02oF0iKgNZIvLPRNOK8EGgunRk3 Wz7FeXmQ==; Received: from host109-153-232-220.range109-153.btcentralplus.com ([109.153.232.220]:60726 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r8zjS-0008Mp-1m; Fri, 01 Dec 2023 04:22:46 -0500 From: "Roger Sayle" To: Cc: "'Robin Dapp'" Subject: [RISC-V PATCH] Improve style to work around PR 60994 in host compiler. Date: Fri, 1 Dec 2023 09:22:44 -0000 Message-ID: <004901da2437$f1f6b750$d5e425f0$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdokN/CRtUE/SKieQyyM+vgNXvWfdg== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 This simple patch allows me to build a cross-compiler to riscv using older versions of RedHat's system compiler. The issue is PR c++/60994 where g++ doesn't like the same name (demand_flags) to be used by both a variable and a (enumeration) type, which is also undesirable from a (GNU) coding style perspective. One solution is to rename the type to demand_flags_t, but a less invasive change is to simply use another identifier for the problematic local variable, renaming demand_flags to dflags. This patch has been tested by building cc1 of a cross-compiler to riscv64-unknown-linux-gnu using g++ 4.8.5 as the host compiler. Ok for mainline? 2023-12-01 Roger Sayle gcc/ChangeLog * config/riscv/riscv-vsetvl.cc (csetvl_info::parse_insn): Rename local variable from demand_flags to dflags, to avoid conflicting with (enumeration) type of the same name. Thanks in advance, Roger diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index b3e07d4..9d11416 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -987,11 +987,11 @@ public: /* Determine the demand info of the RVV insn. */ m_max_sew = get_max_int_sew (); - unsigned demand_flags = 0; + unsigned dflags = 0; if (vector_config_insn_p (insn->rtl ())) { - demand_flags |= demand_flags::DEMAND_AVL_P; - demand_flags |= demand_flags::DEMAND_RATIO_P; + dflags |= demand_flags::DEMAND_AVL_P; + dflags |= demand_flags::DEMAND_RATIO_P; } else { @@ -1006,39 +1006,39 @@ public: available. */ if (has_non_zero_avl ()) - demand_flags |= demand_flags::DEMAND_NON_ZERO_AVL_P; + dflags |= demand_flags::DEMAND_NON_ZERO_AVL_P; else - demand_flags |= demand_flags::DEMAND_AVL_P; + dflags |= demand_flags::DEMAND_AVL_P; } else - demand_flags |= demand_flags::DEMAND_AVL_P; + dflags |= demand_flags::DEMAND_AVL_P; } if (get_attr_ratio (insn->rtl ()) != INVALID_ATTRIBUTE) - demand_flags |= demand_flags::DEMAND_RATIO_P; + dflags |= demand_flags::DEMAND_RATIO_P; else { if (scalar_move_insn_p (insn->rtl ()) && m_ta) { - demand_flags |= demand_flags::DEMAND_GE_SEW_P; + dflags |= demand_flags::DEMAND_GE_SEW_P; m_max_sew = get_attr_type (insn->rtl ()) == TYPE_VFMOVFV ? get_max_float_sew () : get_max_int_sew (); } else - demand_flags |= demand_flags::DEMAND_SEW_P; + dflags |= demand_flags::DEMAND_SEW_P; if (!ignore_vlmul_insn_p (insn->rtl ())) - demand_flags |= demand_flags::DEMAND_LMUL_P; + dflags |= demand_flags::DEMAND_LMUL_P; } if (!m_ta) - demand_flags |= demand_flags::DEMAND_TAIL_POLICY_P; + dflags |= demand_flags::DEMAND_TAIL_POLICY_P; if (!m_ma) - demand_flags |= demand_flags::DEMAND_MASK_POLICY_P; + dflags |= demand_flags::DEMAND_MASK_POLICY_P; } - normalize_demand (demand_flags); + normalize_demand (dflags); /* Optimize AVL from the vsetvl instruction. */ insn_info *def_insn = extract_single_source (get_avl_def ());