From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id BD5B9385828D for ; Fri, 28 Apr 2023 06:12:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD5B9385828D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-956ff2399b1so1712152266b.3 for ; Thu, 27 Apr 2023 23:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1682662341; x=1685254341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k1tgD8PDTTGDPcgtLgrufG3OW/9CO5A0P+acFEGVB9A=; b=H3fEWDqpSygOnc/rEdjX7B87Iw6fgdEE/L/pnr+Ok1vntiwONeUXPRCzdqR5zzqZEI nU39LLW1GscDhNGnLlQAMOMSjSMrbW+LHKeUUUba2Ox9D7d4qeIORDd1hizDbxVQkw8X GwoZFVOZH+BsjPFx2XRQ3xQFDmggNFg6eHtYhPLSZhX9Ah0qiOakrR6bRsIfpfi8zNph 5s7V7iSNlu0T68AZZ2isnFyRbR6oL8Lgw1yNECwNtOCYnI66H98E2uWHrtSlp8g4MXdx IEslLcPtzeV5oiSLABgiCdnAxYFB4r6fCUhwmJ2Zrm6P/8ykwElG9WjQLL/05N/WfFkL DK2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682662341; x=1685254341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k1tgD8PDTTGDPcgtLgrufG3OW/9CO5A0P+acFEGVB9A=; b=UbaMvyhtz/fE78dsDu6tjgR/TJC8OIVv2U0L60YT6+TlKWP/6EGKf81YNELSufuLd2 z6ftphvddzNnMvGKjNW9z5g0P+go3ktqGjNs3ZY8VrINAnE+WGaq2AYbMzWGMPIbGtY5 SykDgUFs73MChE0E+9lKWn6e0E6y6u7ePqvJvp6s6pIetwwdVG7okJdY7J+kBbjZHdmN gAEiS990j2MBzvcWVsw6+XoWCK/9+sFz+do3jCsU5GlEiW559ZkJTTL3c6uRKW7JUpvv //73uMwKe2lf7uph36To3ZI+UTr6DEqPoKXW+45CGzqkcfvZ4/FtLhmfpB169gboZuTF S7RQ== X-Gm-Message-State: AC+VfDwTkYLEe6HSqGf8ppRWNlyeoOuOvPIEf3QG8aQwaTm8sumI/HfK 3kbUCspbhAwzmU4RLC4LH0AlIh6SP+ZCQWAs8AM= X-Google-Smtp-Source: ACHHUZ7P7Qh67TSYSEfw1IuIJ/Gt3WQHu4peZftFfsGyq5Ep8dHyFtrsYv7D81oAkHjWZS5Y95prwg== X-Received: by 2002:a17:907:320b:b0:957:28ed:aeb6 with SMTP id xg11-20020a170907320b00b0095728edaeb6mr4126167ejb.11.1682662341011; Thu, 27 Apr 2023 23:12:21 -0700 (PDT) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d394000000b00504803f4071sm8669431edq.44.2023.04.27.23.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 23:12:20 -0700 (PDT) From: Christoph Muellner To: gcc-patches@gcc.gnu.org, Kito Cheng , Jim Wilson , Palmer Dabbelt , Andrew Waterman , Philipp Tomsich , Cooper Qu , Lifang Xia , Yunhai Shang , Zhiwei Liu Cc: =?UTF-8?q?Christoph=20M=C3=BCllner?= Subject: [PATCH 05/11] riscv: Simplify output of MEM addresses Date: Fri, 28 Apr 2023 08:12:06 +0200 Message-Id: <20230428061210.2988035-6-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230428061210.2988035-1-christoph.muellner@vrull.eu> References: <20230428061210.2988035-1-christoph.muellner@vrull.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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,JMQ_SPF_NEUTRAL,KAM_MANYTO,RCVD_IN_DNSWL_NONE,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 List-Id: From: Christoph Müllner We have the following situation for MEM RTX objects: * TARGET_PRINT_OPERAND expands to riscv_print_operand() * This falls into the default case (unknown or on letter) of the outer switch-case-block and the MEM case of the inner switch-case-block and calls output_address() in final.cc with XEXP (op, 0) (the address) * This calls targetm.asm_out.print_operand_address() which is riscv_print_operand_address() * riscv_print_operand_address() is targeting the address of a MEM RTX * riscv_print_operand_address() calls riscv_print_operand() for the offset and directly prints the register if the address is classified as ADDRESS_REG * This falls into the default case (unknown or on letter) of the outer switch-case-block and the default case of the inner switch-case-block and calls output_addr_const(). However, since we know that offset must be a CONST_INT (which will be followed by a '()' string), there is no need to call riscv_print_operand() for the offset. Instead we can take the shortcut and use output_addr_const(). This change also brings the code in riscv_print_operand_address() in line with the other cases, where output_addr_const() is used to print offsets. Tested with GCC regression test suite and SPEC intrate. Signed-off-by: Christoph Müllner --- gcc/config/riscv/riscv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 5d2550871c7..92043236b17 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -4581,7 +4581,7 @@ riscv_print_operand_address (FILE *file, machine_mode mode ATTRIBUTE_UNUSED, rtx switch (addr.type) { case ADDRESS_REG: - riscv_print_operand (file, addr.offset, 0); + output_addr_const (file, riscv_strip_unspec_address (addr.offset)); fprintf (file, "(%s)", reg_names[REGNO (addr.reg)]); return; -- 2.40.1