summaryrefslogtreecommitdiffstats
path: root/gcc/real.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-04-10 21:19:42 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-04-10 21:19:42 +0000
commit1c03465162defc68e52b098ecd7ea23b6e689e23 (patch)
tree9d7f6302371f3f9dceafdd8e88cfbdd5ef2e7c44 /gcc/real.c
parent96910ab09e6faa6196efa5eb2f129441fb98c30b (diff)
downloadppe42-gcc-1c03465162defc68e52b098ecd7ea23b6e689e23.tar.gz
ppe42-gcc-1c03465162defc68e52b098ecd7ea23b6e689e23.zip
(e64toe): Properly distinguish between NaN and infinity bit patterns
for real-words-big-endian targets. (endian): Add two explicit casts. (e64toe): Support ARM extended precision fp format. Check negative infinities properly for NaNs. (toe64): Support ARM extended precision fp format. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@11688 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/gcc/real.c b/gcc/real.c
index ec443706aa3..e8f78ad73cf 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -471,7 +471,7 @@ endian (e, x, mode)
th = (unsigned long) e[0] & 0xffff;
t = (unsigned long) e[1] & 0xffff;
t |= th << 16;
- x[0] = t;
+ x[0] = (long) t;
break;
default:
@@ -520,7 +520,7 @@ endian (e, x, mode)
th = (unsigned long) e[1] & 0xffff;
t = (unsigned long) e[0] & 0xffff;
t |= th << 16;
- x[0] = t;
+ x[0] = (long) t;
break;
default:
@@ -2978,8 +2978,14 @@ e64toe (pe, y)
else
{
p = &yy[0] + (NE - 1);
+#ifdef ARM_EXTENDED_IEEE_FORMAT
+ /* For ARMs, the exponent is in the lowest 15 bits of the word. */
+ *p-- = (e[0] & 0x8000) | (e[1] & 0x7ffff);
+ e += 2;
+#else
*p-- = *e++;
++e;
+#endif
for (i = 0; i < 4; i++)
*p-- = *e++;
}
@@ -2987,7 +2993,7 @@ e64toe (pe, y)
#ifdef INFINITY
/* Point to the exponent field and check max exponent cases. */
p = &yy[NE - 1];
- if (*p == 0x7fff)
+ if ((*p & 0x7fff) == 0x7fff)
{
#ifdef NANS
if (! REAL_WORDS_BIG_ENDIAN)
@@ -3005,7 +3011,8 @@ e64toe (pe, y)
}
else
{
- for (i = 1; i <= 4; i++)
+#ifdef ARM_EXTENDED_IEEE_FORMAT
+ for (i = 2; i <= 5; i++)
{
if (pe[i] != 0)
{
@@ -3013,6 +3020,23 @@ e64toe (pe, y)
return;
}
}
+#else /* not ARM */
+ /* In Motorola extended precision format, the most significant
+ bit of an infinity mantissa could be either 1 or 0. It is
+ the lower order bits that tell whether the value is a NaN. */
+ if ((pe[2] & 0x7fff) != 0)
+ goto bigend_nan;
+
+ for (i = 3; i <= 5; i++)
+ {
+ if (pe[i] != 0)
+ {
+bigend_nan:
+ enan (y, (*p & 0x8000) != 0);
+ return;
+ }
+ }
+#endif /* not ARM */
}
#endif /* NANS */
eclear (y);
@@ -3390,11 +3414,17 @@ toe64 (a, b)
#ifdef IEEE
if (REAL_WORDS_BIG_ENDIAN)
{
+#ifdef ARM_EXTENDED_IEEE_FORMAT
+ /* The exponent is in the lowest 15 bits of the first word. */
+ *q++ = i ? 0x8000 : 0;
+ *q++ = *p++;
+#else
if (i)
*q++ = *p++ | 0x8000;
else
*q++ = *p++;
*q++ = 0;
+#endif
}
else
{
OpenPOWER on IntegriCloud