summaryrefslogtreecommitdiffstats
path: root/arch/nds32/include/asm/fpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/nds32/include/asm/fpu.h')
-rw-r--r--arch/nds32/include/asm/fpu.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/nds32/include/asm/fpu.h b/arch/nds32/include/asm/fpu.h
index 9b1107b58e23..019f1bcfc5ee 100644
--- a/arch/nds32/include/asm/fpu.h
+++ b/arch/nds32/include/asm/fpu.h
@@ -28,7 +28,18 @@ extern int do_fpuemu(struct pt_regs *regs, struct fpu_struct *fpu);
#define sNAN64 0xFFFFFFFFFFFFFFFFULL
#define sNAN32 0xFFFFFFFFUL
+#if IS_ENABLED(CONFIG_SUPPORT_DENORMAL_ARITHMETIC)
+/*
+ * Denormalized number is unsupported by nds32 FPU. Hence the operation
+ * is treated as underflow cases when the final result is a denormalized
+ * number. To enhance precision, underflow exception trap should be
+ * enabled by default and kerenl will re-execute it by fpu emulator
+ * when getting underflow exception.
+ */
+#define FPCSR_INIT FPCSR_mskUDFE
+#else
#define FPCSR_INIT 0x0UL
+#endif
extern const struct fpu_struct init_fpuregs;