From patchwork Mon Sep 16 08:20:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 1986000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=BO3cxNEV; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=DJiu7K21; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=0QxlKE/S; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=AtvSZ4qC; 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 4X6dCg15dCz1y1g for ; Mon, 16 Sep 2024 18:21:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 26C493858D3C for ; Mon, 16 Sep 2024 08:21:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id BFF653858C33 for ; Mon, 16 Sep 2024 08:20:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFF653858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BFF653858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726474821; cv=none; b=U3LjripX53qTcUWWnSXNWft6ADsIm56hKp2wxiwwjPHTgNnZs8o1l9JzRECUk1Q2Xpd+OLlmPwL7nAgyCv4rXMk6mRmgq1jeSAT+jq6vCKHAxoqSWmOe8ZR/vqcHytub35v15TxO1hvlwsldP7BDTp2SRC9w9jTf8YhLrNiS0VI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726474821; c=relaxed/simple; bh=THL0Ds+rCLfmvc/WkDvQlJ6Q3MSo5D1VvXtMSpSTCbQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=mHyCh7XPheFloPcmiaYsqnbmYkXldwHvf0cE2ovq8sTi2ZHTUpMURmq2RacUlXEa3EasxEJ9wkWygSJKmQDTWx5d4DQD1LywAkjT8zYs6INkk4RcPSi7sY5e7MdL2J4VZw/gji7xTqPR6ytea22E083d62uXcXmRnJ/xj6jitcI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from hawking.nue2.suse.org (unknown [IPv6:2a07:de40:a101:3:92b1:1cff:fe69:ddc]) by smtp-out2.suse.de (Postfix) with ESMTP id 7B5D91F88B for ; Mon, 16 Sep 2024 08:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1726474818; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JdWVX6q4creolmS3Uzb8BVzWj1NGpq6zmPI/VRbHba8=; b=BO3cxNEVvrcfICUBiPzdfXQABFCdxO9AsnQNSOFn3r7zT9mAjWlCGPsIJwZoDNxTuTIrcc 5RBveFL7yOM/KFvRc4br8fyE+kUnHzDpVv94CZpFUzve9SJZtvrHnKuivKKiI2BcSOS/Da t9Lp7jzv/ogQMDWaqo6G+VlLF0ys7A8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1726474818; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JdWVX6q4creolmS3Uzb8BVzWj1NGpq6zmPI/VRbHba8=; b=DJiu7K21raMSYoVqXRu4U/Vv2gDrMhhk3IjnuYtB3TXNIEEHPD/y4WrOphGQ2NmxLNItDn SPz5Xe0sgPDMWEDw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="0QxlKE/S"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=AtvSZ4qC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1726474817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JdWVX6q4creolmS3Uzb8BVzWj1NGpq6zmPI/VRbHba8=; b=0QxlKE/StozUu3bjqumV61KW2BGccb8OdYHVeHlr8v80GBs0wREz2n/lJgUVRS3ihTFBgH 9MO4EfhQ2ybu5prppjVpJ5JpKyiuv237aKegtcHp5suJQFBc5QOEGVmxzlZ6nJWKooZaeb ODmBLZcxhTTNYv7l6GiBv78M/OkuHfM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1726474817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JdWVX6q4creolmS3Uzb8BVzWj1NGpq6zmPI/VRbHba8=; b=AtvSZ4qC9yjDyQfc0i7UZ0eSQ51z0Yf5dkFgmYHLSSVtzuA9JctWvFO4cDdF0yL0innjqn 7H24a/8SVCXmH3DQ== Received: by hawking.nue2.suse.org (Postfix, from userid 17005) id 1D5604A0146; Mon, 16 Sep 2024 10:20:16 +0200 (CEST) From: Andreas Schwab To: gcc-patches@gcc.gnu.org Subject: [PATCH] riscv: Fix duplicate assmbler label in @tlsdesc insn X-Yow: Are you guys lined up for the METHADONE PROGRAM or FOOD STAMPS?? Date: Mon, 16 Sep 2024 10:20:16 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Spamd-Result: default: False [15.29 / 50.00]; SPAM_FLAG(5.00)[]; NEURAL_SPAM_LONG(3.50)[1.000]; BAYES_HAM(-3.00)[99.99%]; NEURAL_SPAM_SHORT(3.00)[0.999]; HFILTER_HOSTNAME_UNKNOWN(2.50)[]; RDNS_NONE(2.00)[]; ONCE_RECEIVED(1.20)[]; HFILTER_HELO_IP_A(1.00)[hawking.nue2.suse.org]; HFILTER_HELO_NORES_A_OR_MX(0.30)[hawking.nue2.suse.org]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FROM_EQ_ENVFROM(0.00)[]; DIRECT_TO_MX(0.00)[Gnus/5.13 (Gnus v5.13)]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ONE(0.00)[1]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid] X-Spam-Score: 15.29 X-Spamd-Bar: +++++++++++++++ X-Rspamd-Queue-Id: 7B5D91F88B X-Rspamd-Action: add header X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spam: Yes X-Spam-Status: No, score=-8.3 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, URIBL_BLACK 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 Use %= instead of maintaining a sequence number manually, so that it doesn't result in a duplicate assembler label when the insn is duplicated. PR target/116693 * config/riscv/riscv.cc (riscv_legitimize_tls_address): Don't pass seqno to gen_tlsdesc and remove it. * config/riscv/riscv.md (@tlsdesc): Remove operand 1. Use %= instead of %1 in template. --- gcc/config/riscv/riscv.cc | 4 +--- gcc/config/riscv/riscv.md | 15 +++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 6efe14ff199..fbf2da71e10 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -2779,14 +2779,12 @@ riscv_legitimize_tls_address (rtx loc) case TLS_MODEL_GLOBAL_DYNAMIC: if (TARGET_TLSDESC) { - static unsigned seqno; tp = gen_rtx_REG (Pmode, THREAD_POINTER_REGNUM); a0 = gen_rtx_REG (Pmode, GP_ARG_FIRST); dest = gen_reg_rtx (Pmode); - emit_insn (gen_tlsdesc (Pmode, loc, GEN_INT (seqno))); + emit_insn (gen_tlsdesc (Pmode, loc)); emit_insn (gen_add3_insn (dest, a0, tp)); - seqno++; } else { diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 9f94b5aa023..fd1cbebc435 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -2327,17 +2327,16 @@ (define_insn "@tlsdesc" [(set (reg:P A0_REGNUM) - (unspec:P - [(match_operand:P 0 "symbolic_operand" "") - (match_operand:P 1 "const_int_operand")] - UNSPEC_TLSDESC)) + (unspec:P + [(match_operand:P 0 "symbolic_operand" "")] + UNSPEC_TLSDESC)) (clobber (reg:P T0_REGNUM))] "TARGET_TLSDESC" { - return ".LT%1: auipc\ta0,%%tlsdesc_hi(%0)\;" - "\tt0,%%tlsdesc_load_lo(.LT%1)(a0)\;" - "addi\ta0,a0,%%tlsdesc_add_lo(.LT%1)\;" - "jalr\tt0,t0,%%tlsdesc_call(.LT%1)"; + return ".LT%=: auipc\ta0,%%tlsdesc_hi(%0)\;" + "\tt0,%%tlsdesc_load_lo(.LT%=)(a0)\;" + "addi\ta0,a0,%%tlsdesc_add_lo(.LT%=)\;" + "jalr\tt0,t0,%%tlsdesc_call(.LT%=)"; } [(set_attr "type" "multi") (set_attr "length" "16")