From 44274519e68b442ed87170b6df72fafc9fbfe25f Mon Sep 17 00:00:00 2001 From: Patrick Wildt Date: Tue, 12 Mar 2019 22:14:51 +0000 Subject: 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@ --- sys/arch/arm64/include/fenv.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys') 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 @@ -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 -- cgit v1.2.3