]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
LoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW
authorXi Ruoyao <xry111@xry111.site>
Mon, 29 Apr 2024 07:26:24 +0000 (15:26 +0800)
committercaiyinyu <caiyinyu@loongson.cn>
Tue, 28 May 2024 01:17:05 +0000 (09:17 +0800)
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>
sysdeps/loongarch/fpu_control.h

index 54add4e01c2c1ccf524023353ba75e87b0cf359a..3cdf2417d9ea33a796c617517e18e6873f7a2960 100644 (file)
@@ -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;