aboutsummaryrefslogtreecommitdiff
path: root/soft-fp
diff options
context:
space:
mode:
Diffstat (limited to 'soft-fp')
-rw-r--r--soft-fp/op-common.h13
-rw-r--r--soft-fp/soft-fp.h7
2 files changed, 17 insertions, 3 deletions
diff --git a/soft-fp/op-common.h b/soft-fp/op-common.h
index b70026f..db75af5 100644
--- a/soft-fp/op-common.h
+++ b/soft-fp/op-common.h
@@ -1,5 +1,5 @@
/* Software floating-point emulation. Common operations.
- Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,1999,2006,2007,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
@@ -146,7 +146,11 @@ do { \
if (!_FP_EXP_NORMAL(fs, wc, X) && !_FP_FRAC_ZEROP_##wc(X)) \
{ \
if (X##_e == 0) \
- FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ { \
+ if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
+ || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
+ FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ } \
else \
{ \
if (!_FP_KEEPNANFRACP) \
@@ -226,13 +230,16 @@ do { \
{ \
X##_e = 1; \
_FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
+ FP_SET_EXCEPTION(FP_EX_INEXACT); \
} \
else \
{ \
X##_e = 0; \
_FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
- FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
} \
+ if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
+ || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
+ FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
} \
else \
{ \
diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h
index 46cb1cf..750c7fe 100644
--- a/soft-fp/soft-fp.h
+++ b/soft-fp/soft-fp.h
@@ -128,6 +128,13 @@
#define FP_CLEAR_EXCEPTIONS \
_fex = 0
+#define FP_CUR_EXCEPTIONS \
+ (_fex)
+
+#ifndef FP_TRAPPING_EXCEPTIONS
+#define FP_TRAPPING_EXCEPTIONS 0
+#endif
+
#define _FP_ROUND_NEAREST(wc, X) \
do { \
if ((_FP_FRAC_LOW_##wc(X) & 15) != _FP_WORK_ROUND) \