public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] LoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW
@ 2024-05-28  1:19 Yinyu Cai
  0 siblings, 0 replies; only message in thread
From: Yinyu Cai @ 2024-05-28  1:19 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0c1d2c277a59f08fd3232b33d18644ea890190ea

commit 0c1d2c277a59f08fd3232b33d18644ea890190ea
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Mon Apr 29 15:26:24 2024 +0800

    LoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW
    
    Clang inline-asm parser does not allow using "$r0" in
    movfcsr2gr/movgr2fcsr, so everything using _FPU_{GET,SET}CW is now
    failing to build with Clang on LoongArch.  As we now requires Binutils
    >= 2.41 which supports using "$fcsr0" here, use it instead of "$r0" to
    fix the issue.
    
    Link: https://github.com/loongson-community/discussions/issues/53#issuecomment-2081507390
    Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4142b2368353
    Signed-off-by: Xi Ruoyao <xry111@xry111.site>

Diff:
---
 sysdeps/loongarch/fpu_control.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/loongarch/fpu_control.h b/sysdeps/loongarch/fpu_control.h
index 54add4e01c..3cdf2417d9 100644
--- a/sysdeps/loongarch/fpu_control.h
+++ b/sysdeps/loongarch/fpu_control.h
@@ -91,8 +91,8 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
 /* Macros for accessing the hardware control word.  */
 extern fpu_control_t __loongarch_fpu_getcw (void) __THROW;
 extern void __loongarch_fpu_setcw (fpu_control_t) __THROW;
-#define _FPU_GETCW(cw) __asm__ volatile ("movfcsr2gr %0,$r0" : "=r"(cw))
-#define _FPU_SETCW(cw) __asm__ volatile ("movgr2fcsr $r0,%0" : : "r"(cw))
+#define _FPU_GETCW(cw) __asm__ volatile ("movfcsr2gr %0,$fcsr0" : "=r"(cw))
+#define _FPU_SETCW(cw) __asm__ volatile ("movgr2fcsr $fcsr0,%0" : : "r"(cw))
 
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-28  1:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-28  1:19 [glibc] LoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW Yinyu Cai

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).