summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2019-03-12 22:14:51 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2019-03-12 22:14:51 +0000
commit44274519e68b442ed87170b6df72fafc9fbfe25f (patch)
tree381f56ba140098e49d0082a3d1683dcdedd74953 /sys
parenta5c8ddd6848824eb90f47987e9585e6fa7a94853 (diff)
Setting and getting the rounding mode on our arm64 FPU has not worked
in libm since the rounding mode is in fpcr, not fpsr. Since both FPU registers are 32-bit we can store them in the 64-bit fenv_t to make handling the bits easier. While there add FE_DENORMAL, which also exists on x86. Also make sure that whenever we are being passed an exception mask, we only allow the bits that are supported by hardware. Found by regression tests Debugged with Moritz Buhl ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm64/include/fenv.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/arch/arm64/include/fenv.h b/sys/arch/arm64/include/fenv.h
index 674f2f8ed5e..dfb0176fe82 100644
--- a/sys/arch/arm64/include/fenv.h
+++ b/sys/arch/arm64/include/fenv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fenv.h,v 1.2 2017/01/11 00:18:22 patrick Exp $ */
+/* $OpenBSD: fenv.h,v 1.3 2019/03/12 22:14:50 patrick Exp $ */
/*
* Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
@@ -31,13 +31,14 @@
#define FE_OVERFLOW 0x04
#define FE_UNDERFLOW 0x08
#define FE_INEXACT 0x10
+#define FE_DENORMAL 0x80
/*
* The following symbol is simply the bitwise-inclusive OR of all floating-point
* exception constants defined above.
*/
#define FE_ALL_EXCEPT (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | \
- FE_UNDERFLOW | FE_INEXACT)
+ FE_UNDERFLOW | FE_INEXACT | FE_DENORMAL)
/*
* Each symbol representing the rounding direction, expands to an integer