summaryrefslogtreecommitdiff
path: root/soft-fp
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-10-12 12:20:12 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-10-12 12:20:12 +0000
commit8edc4a11cfbfd65a86696264f20e2d6d22edff54 (patch)
treed3bad864b92235578e55cca6e01a04b38cfe90dc /soft-fp
parent8399acaf7c5cb2252117ad1d65e468f688b84fc0 (diff)
soft-fp: add macro FP_NO_EXCEPTIONS.
Diffstat (limited to 'soft-fp')
-rw-r--r--soft-fp/floatditf.c3
-rw-r--r--soft-fp/floatsidf.c3
-rw-r--r--soft-fp/floatsitf.c3
-rw-r--r--soft-fp/floatunditf.c3
-rw-r--r--soft-fp/floatunsidf.c3
-rw-r--r--soft-fp/floatunsitf.c3
-rw-r--r--soft-fp/soft-fp.h24
7 files changed, 30 insertions, 12 deletions
diff --git a/soft-fp/floatditf.c b/soft-fp/floatditf.c
index 68da6c60b0..7f5e3b0456 100644
--- a/soft-fp/floatditf.c
+++ b/soft-fp/floatditf.c
@@ -28,18 +28,17 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
TFtype __floatditf(DItype i)
{
- FP_DECL_EX;
FP_DECL_Q(A);
TFtype a;
FP_FROM_INT_Q(A, i, DI_BITS, UDItype);
FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
return a;
}
diff --git a/soft-fp/floatsidf.c b/soft-fp/floatsidf.c
index ec578fba79..967a83fbfe 100644
--- a/soft-fp/floatsidf.c
+++ b/soft-fp/floatsidf.c
@@ -28,18 +28,17 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "double.h"
DFtype __floatsidf(SItype i)
{
- FP_DECL_EX;
FP_DECL_D(A);
DFtype a;
FP_FROM_INT_D(A, i, SI_BITS, USItype);
FP_PACK_RAW_D(a, A);
- FP_HANDLE_EXCEPTIONS;
return a;
}
diff --git a/soft-fp/floatsitf.c b/soft-fp/floatsitf.c
index 6e24b9ea63..a2c3451cf4 100644
--- a/soft-fp/floatsitf.c
+++ b/soft-fp/floatsitf.c
@@ -28,18 +28,17 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
TFtype __floatsitf(SItype i)
{
- FP_DECL_EX;
FP_DECL_Q(A);
TFtype a;
FP_FROM_INT_Q(A, i, SI_BITS, USItype);
FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
return a;
}
diff --git a/soft-fp/floatunditf.c b/soft-fp/floatunditf.c
index fff73fdb67..e178dea304 100644
--- a/soft-fp/floatunditf.c
+++ b/soft-fp/floatunditf.c
@@ -28,19 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
TFtype
__floatunditf(UDItype i)
{
- FP_DECL_EX;
FP_DECL_Q(A);
TFtype a;
FP_FROM_INT_Q(A, i, DI_BITS, UDItype);
FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
return a;
}
diff --git a/soft-fp/floatunsidf.c b/soft-fp/floatunsidf.c
index 548dc7c0c4..3d9656f5fc 100644
--- a/soft-fp/floatunsidf.c
+++ b/soft-fp/floatunsidf.c
@@ -28,18 +28,17 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "double.h"
DFtype __floatunsidf(USItype i)
{
- FP_DECL_EX;
FP_DECL_D(A);
DFtype a;
FP_FROM_INT_D(A, i, SI_BITS, USItype);
FP_PACK_RAW_D(a, A);
- FP_HANDLE_EXCEPTIONS;
return a;
}
diff --git a/soft-fp/floatunsitf.c b/soft-fp/floatunsitf.c
index 1099c2ee84..e94ae926b7 100644
--- a/soft-fp/floatunsitf.c
+++ b/soft-fp/floatunsitf.c
@@ -28,19 +28,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define FP_NO_EXCEPTIONS
#include "soft-fp.h"
#include "quad.h"
TFtype
__floatunsitf(USItype i)
{
- FP_DECL_EX;
FP_DECL_Q(A);
TFtype a;
FP_FROM_INT_Q(A, i, SI_BITS, USItype);
FP_PACK_RAW_Q(a, A);
- FP_HANDLE_EXCEPTIONS;
return a;
}
diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h
index 8a22a11e20..d6c4b683b8 100644
--- a/soft-fp/soft-fp.h
+++ b/soft-fp/soft-fp.h
@@ -142,6 +142,30 @@
#define FP_TRAPPING_EXCEPTIONS 0
#endif
+/* A file using soft-fp may define FP_NO_EXCEPTIONS before including
+ soft-fp.h to indicate that, although a macro used there could raise
+ exceptions, or do rounding and potentially thereby raise
+ exceptions, for some arguments, for the particular arguments used
+ in that file no exceptions or rounding can occur. Such a file
+ should not itself use macros relating to handling exceptions and
+ rounding modes; this is only for indirect uses (in particular, in
+ _FP_FROM_INT and the macros it calls). */
+#ifdef FP_NO_EXCEPTIONS
+
+#undef FP_SET_EXCEPTION
+#define FP_SET_EXCEPTION(ex) do {} while (0)
+
+#undef FP_CUR_EXCEPTIONS
+#define FP_CUR_EXCEPTIONS 0
+
+#undef FP_TRAPPING_EXCEPTIONS
+#define FP_TRAPPING_EXCEPTIONS 0
+
+#undef FP_ROUNDMODE
+#define FP_ROUNDMODE FP_RND_ZERO
+
+#endif
+
#define _FP_ROUND_NEAREST(wc, X) \
do { \
if ((_FP_FRAC_LOW_##wc(X) & 15) != _FP_WORK_ROUND) \