summaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-04 23:21:28 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-04 23:21:28 +0000
commit92c43e3c28dbea747e0234ef4815971cb703be9b (patch)
tree6a9e27455fe10ee403d06e599a3b61ab33cb8756 /gcc/real.c
parent38b13a9b08d5ed6aaf64fe826f1e395570ab4ff8 (diff)
downloadgcc-92c43e3c28dbea747e0234ef4815971cb703be9b.tar.gz
* builtin-types.def (BT_FN_FLOAT): New.
(BT_FN_DOUBLE, BT_FN_LONG_DOUBLE): New. * builtins.def (BUILT_IN_INF, BUILT_IN_INFF, BUILT_IN_INFL, BUILT_IN_HUGE_VAL, BUILT_IN_HUGE_VALF, BUILT_IN_HUGE_VALL): New. * builtins.c (fold_builtin_inf): New. (fold_builtin): Call it. * real.c (ereal_inf): New. * real.h: Declare it. * doc/extend.texi: Document new builtins. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56820 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/gcc/real.c b/gcc/real.c
index 019821df408..077e313f349 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1818,8 +1818,8 @@ eisnan (x)
return (0);
}
-/* Fill e-type number X with infinity pattern (IEEE)
- or largest possible number (non-IEEE). */
+/* Fill e-type number X with infinity pattern (IEEE)
+ or largest possible number (non-IEEE). */
static void
einfin (x)
@@ -1860,6 +1860,49 @@ einfin (x)
#endif
}
+/* Similar, except return it as a REAL_VALUE_TYPE. */
+
+REAL_VALUE_TYPE
+ereal_inf (mode)
+ enum machine_mode mode;
+{
+ REAL_VALUE_TYPE r;
+ UEMUSHORT e[NE];
+ int prec, rndsav;
+
+ switch (mode)
+ {
+ case QFmode:
+ case SFmode:
+ prec = 24;
+ break;
+ case HFmode:
+ case DFmode:
+ prec = 53;
+ break;
+ case TFmode:
+ if (!INTEL_EXTENDED_IEEE_FORMAT)
+ {
+ prec = 113;
+ break;
+ }
+ /* FALLTHRU */
+ case XFmode:
+ prec = 64;
+ break;
+ default:
+ abort ();
+ }
+
+ rndsav = rndprc;
+ rndprc = prec;
+ einfin (e);
+ rndprc = rndsav;
+
+ PUT_REAL (e, &r);
+ return r;
+}
+
/* Output an e-type NaN.
This generates Intel's quiet NaN pattern for extended real.
The exponent is 7fff, the leading mantissa word is c000. */