Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
LoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW
Browse files Browse the repository at this point in the history
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: loongson-community/discussions#53 (comment)
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4142b2368353
Signed-off-by: Xi Ruoyao <[email protected]>
  • Loading branch information
xry111 authored and Chiichen committed Oct 18, 2024
1 parent 4dae345 commit 1b0bfb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sysdeps/loongarch/fpu_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1b0bfb6

Please sign in to comment.