From patchwork Sat Aug 26 16:36:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1826430 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; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Zks2FSJF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.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 4RY2Zs4DyMz1yZ9 for ; Sun, 27 Aug 2023 02:39:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 938983858425 for ; Sat, 26 Aug 2023 16:38:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 938983858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693067939; bh=9/yBwcTKo0Vz6pbob+djc4kMz/4KUT6zUgj4UwGsWBA=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Zks2FSJF1rOHhO88Ry8M4YoeqFngq519jFnE0Vxk6tc3DOHmBpmsf7b2Sw0RjxY+o 3AuNJtduObUFXtyTHKBjvWYXfHmX++uahwtt+HQkHYIHKaTRRCxCExDMYpuBoPrvLw aevbdRJnHSyvPgZl97KB5rDHmrf84O/HfVMl8SW4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 07EBB3858024 for ; Sat, 26 Aug 2023 16:38:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 07EBB3858024 Received: from stargazer.. (unknown [IPv6:240e:358:1189:1100:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 02428659CA; Sat, 26 Aug 2023 12:38:14 -0400 (EDT) To: libc-alpha@sourceware.org Cc: Adhemerval Zanella Netto , caiyinyu , WANG Xuerui , Xi Ruoyao Subject: [PATCH 3/3] LoongArch: Micro-optimize LD_PCREL Date: Sun, 27 Aug 2023 00:36:51 +0800 Message-ID: <20230826163651.35828-4-xry111@xry111.site> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230826163651.35828-1-xry111@xry111.site> References: <20230826163651.35828-1-xry111@xry111.site> MIME-Version: 1.0 X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_FROM, SPF_HELO_PASS, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xi Ruoyao via Libc-alpha From: Xi Ruoyao Reply-To: Xi Ruoyao Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" We are requiring Binutils >= 2.41, so explicit relocation syntax is always supported by the assembler. Use it to reduce one instruction. Signed-off-by: Xi Ruoyao --- sysdeps/unix/sysv/linux/loongarch/pointer_guard.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sysdeps/unix/sysv/linux/loongarch/pointer_guard.h b/sysdeps/unix/sysv/linux/loongarch/pointer_guard.h index b25e353b37..d6c78687d4 100644 --- a/sysdeps/unix/sysv/linux/loongarch/pointer_guard.h +++ b/sysdeps/unix/sysv/linux/loongarch/pointer_guard.h @@ -19,17 +19,15 @@ #ifndef POINTER_GUARD_H #define POINTER_GUARD_H -/* Load a got-relative EXPR into G, using T. - Note G and T are register names. */ +/* Load a got-relative EXPR into register G. */ #define LD_GLOBAL(G, EXPR) \ la.global G, EXPR; \ REG_L G, G, 0; -/* Load a pc-relative EXPR into G, using T. - Note G and T are register names. */ +/* Load a pc-relative EXPR into register G. */ #define LD_PCREL(G, EXPR) \ - la.pcrel G, EXPR; \ - REG_L G, G, 0; + pcalau12i G, %pc_hi20(EXPR); \ + REG_L G, G, %pc_lo12(EXPR); #if (IS_IN (rtld) \ || (!defined SHARED && (IS_IN (libc) \