]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
LoongArch: feclearexcept: skip clearing CAUSE
authorXi Ruoyao <xry111@xry111.site>
Thu, 19 Mar 2026 08:33:22 +0000 (16:33 +0800)
committercaiyinyu <caiyinyu@loongson.cn>
Sat, 21 Mar 2026 16:01:03 +0000 (00:01 +0800)
The comment explaining the reason to clear CAUSE does not make any
sense: it says the next "CTC" instruction would raise the FP exception
of which both the CAUSE and ENABLE bits are set, but LoongArch does not
have the CTC instruction.  LoongArch has the movgr2fcsr instruction but
movgr2fcsr never raises any FP exception, different from the MIPS CTC
instruction.

So we don't really need to care CAUSE at all.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
sysdeps/loongarch/fpu/fclrexcpt.c

index 7ce166659b4d013ef7c57395c22ab83011d1b50f..0c95069a1d84c9868b63922b9b21ab76142709d3 100644 (file)
@@ -31,11 +31,8 @@ __feclearexcept (int excepts)
   /* Read the complete control word.  */
   _FPU_GETCW (cw);
 
-  /* Clear exception flag bits and cause bits.  If the cause bit is not
-     cleared, the next CTC instruction (just below) will re-generate the
-     exception.  */
-
-  cw &= ~(excepts | (excepts << CAUSE_SHIFT));
+  /* Clear exception flag bits.  */
+  cw &= ~excepts;
 
   /* Put the new data in effect.  */
   _FPU_SETCW (cw);