public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Yinyu Cai <caiyinyu@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] LoongArch: Micro-optimize LD_PCREL
Date: Tue, 29 Aug 2023 04:33:10 +0000 (GMT)	[thread overview]
Message-ID: <20230829043310.756AF3857731@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3efa26749e4d28768558330353dc15c6f325ed4e

commit 3efa26749e4d28768558330353dc15c6f325ed4e
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Sun Aug 27 00:36:51 2023 +0800

    LoongArch: Micro-optimize LD_PCREL
    
    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 <xry111@xry111.site>

Diff:
---
 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) \

                 reply	other threads:[~2023-08-29  4:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230829043310.756AF3857731@sourceware.org \
    --to=caiyinyu@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).