[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patches] DFP branch: Make convert.h machine-independent - take 2
- To: patches@xxxxxxxxxx
- Subject: [patches] DFP branch: Make convert.h machine-independent - take 2
- From: "Andreas Krebbel" <krebbel@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 21 Aug 2008 10:11:51 +0200
Hello,
this changes to convert.h to use standard functions if compiled on a
non-power target. The previous version always used the standard
functions. But this unfortunately imposes a libm dependency in case
the functions aren't duplicated in libdfp. For power there are
already inline functions defined in a header file which can be used.
Other targets not having these functions probably want to simply
duplicate the libm functions in libdfp.
Please apply if you think it's ok.
Bye,
-Andreas-
2008-08-21 Andreas Krebbel <krebbel1@xxxxxxxxxx>
* dfp/sysdeps/soft-dfp/convert.h (DFP_TEST_EXCEPTIONS,
DFP_CLEAR_EXCEPTIONS): Use the standard functions for
non-power targets.
Index: dfp/sysdeps/soft-dfp/convert.h
===================================================================
--- dfp/sysdeps/soft-dfp/convert.h.orig 2008-08-20 18:48:31.000000000 +0200
+++ dfp/sysdeps/soft-dfp/convert.h 2008-08-20 18:49:12.000000000 +0200
@@ -279,6 +279,10 @@ extern const _Decimal128 decpowof2[];
(((status) & DEC_IEEE_854_Underflow) ? FE_UNDERFLOW : 0))
#include <fenv_libc.h>
+#define DFP_HANDLE_EXCEPTIONS(status) feraiseexcept(status)
+
+#ifdef __powerpc__
+
#define DFP_TEST_EXCEPTIONS(status) ({ \
fenv_union_t u; \
u.fenv = fegetenv_register(); \
@@ -290,5 +294,11 @@ extern const _Decimal128 decpowof2[];
u.l[1] &= ~status; \
fesetenv_register(u.fenv); \
}
-#define DFP_HANDLE_EXCEPTIONS(status) feraiseexcept(status)
+#else /* Non-power targets might want to use the standard functions.
+ Note that it is necessary to include these symbols in libdfp
+ to avoid libm dependencies. */
+
+#define DFP_TEST_EXCEPTIONS(status) fetestexcept (status)
+#define DFP_CLEAR_EXCEPTIONS(status) feclearexcept (status)
+#endif