summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/spmath/sfsub.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-03-29 03:58:20 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-03-29 03:58:20 +0000
commitb7d2cadef3354bbbd97a98d382291d18fce6200c (patch)
treea5232eeba7a692164b2bedee650cab64a874adda /sys/arch/hppa/spmath/sfsub.c
parent8da71daa70fb2878a11a7d02439e45d2f4f59baa (diff)
big bang
Diffstat (limited to 'sys/arch/hppa/spmath/sfsub.c')
-rw-r--r--sys/arch/hppa/spmath/sfsub.c198
1 files changed, 99 insertions, 99 deletions
diff --git a/sys/arch/hppa/spmath/sfsub.c b/sys/arch/hppa/spmath/sfsub.c
index 9695a63c55f..67743c754b0 100644
--- a/sys/arch/hppa/spmath/sfsub.c
+++ b/sys/arch/hppa/spmath/sfsub.c
@@ -1,25 +1,25 @@
-/* $OpenBSD: sfsub.c,v 1.3 1998/07/02 19:06:02 mickey Exp $ */
+/* $OpenBSD: sfsub.c,v 1.4 2001/03/29 03:58:19 mickey Exp $ */
/*
- * Copyright 1996 1995 by Open Software Foundation, Inc.
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies and
- * that both the copyright notice and this permission notice appear in
- * supporting documentation.
- *
- * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
- * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
+ * Copyright 1996 1995 by Open Software Foundation, Inc.
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both the copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
+ * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
*/
/*
* pmk1.1
@@ -27,15 +27,15 @@
/*
* (c) Copyright 1986 HEWLETT-PACKARD COMPANY
*
- * To anyone who acknowledges that this file is provided "AS IS"
+ * To anyone who acknowledges that this file is provided "AS IS"
* without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of Hewlett-Packard Company not be
- * used in advertising or publicity pertaining to distribution
- * of the software without specific, written prior permission.
- * Hewlett-Packard Company makes no representations about the
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of Hewlett-Packard Company not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose.
*/
@@ -52,17 +52,17 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
{
register unsigned int left, right, result, extent;
register unsigned int signless_upper_left, signless_upper_right, save;
-
+
register int result_exponent, right_exponent, diff_exponent;
register int sign_save, jumpsize;
- register boolean inexact = FALSE, underflowtrap;
-
+ register int inexact = FALSE, underflowtrap;
+
/* Create local copies of the numbers */
left = *leftptr;
right = *rightptr;
- /* A zero "save" helps discover equal operands (for later), *
- * and is used in swapping operands (if needed). */
+ /* A zero "save" helps discover equal operands (for later), *
+ * and is used in swapping operands (if needed). */
Sgl_xortointp1(left,right,/*to*/save);
/*
@@ -70,48 +70,48 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
*/
if ((result_exponent = Sgl_exponent(left)) == SGL_INFINITY_EXPONENT)
{
- if (Sgl_iszero_mantissa(left))
+ if (Sgl_iszero_mantissa(left))
{
- if (Sgl_isnotnan(right))
+ if (Sgl_isnotnan(right))
{
- if (Sgl_isinfinity(right) && save==0)
+ if (Sgl_isinfinity(right) && save==0)
{
- /*
+ /*
* invalid since operands are same signed infinity's
*/
if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION);
- Set_invalidflag();
- Sgl_makequietnan(result);
+ Set_invalidflag();
+ Sgl_makequietnan(result);
*dstptr = result;
return(NOEXCEPTION);
}
/*
- * return infinity
- */
+ * return infinity
+ */
*dstptr = left;
return(NOEXCEPTION);
}
}
- else
+ else
{
- /*
- * is NaN; signaling or quiet?
- */
- if (Sgl_isone_signaling(left))
+ /*
+ * is NaN; signaling or quiet?
+ */
+ if (Sgl_isone_signaling(left))
{
- /* trap if INVALIDTRAP enabled */
+ /* trap if INVALIDTRAP enabled */
if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION);
- /* make NaN quiet */
- Set_invalidflag();
- Sgl_set_quiet(left);
- }
- /*
- * is second operand a signaling NaN?
+ /* make NaN quiet */
+ Set_invalidflag();
+ Sgl_set_quiet(left);
+ }
+ /*
+ * is second operand a signaling NaN?
*/
- else if (Sgl_is_signalingnan(right))
+ else if (Sgl_is_signalingnan(right))
{
- /* trap if INVALIDTRAP enabled */
- if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION);
+ /* trap if INVALIDTRAP enabled */
+ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION);
/* make NaN quiet */
Set_invalidflag();
Sgl_set_quiet(right);
@@ -119,30 +119,30 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
return(NOEXCEPTION);
}
/*
- * return quiet NaN
- */
- *dstptr = left;
- return(NOEXCEPTION);
+ * return quiet NaN
+ */
+ *dstptr = left;
+ return(NOEXCEPTION);
}
} /* End left NaN or Infinity processing */
/*
* check second operand for NaN's or infinity
*/
- if (Sgl_isinfinity_exponent(right))
+ if (Sgl_isinfinity_exponent(right))
{
- if (Sgl_iszero_mantissa(right))
+ if (Sgl_iszero_mantissa(right))
{
/* return infinity */
Sgl_invert_sign(right);
*dstptr = right;
return(NOEXCEPTION);
}
- /*
- * is NaN; signaling or quiet?
- */
- if (Sgl_isone_signaling(right))
+ /*
+ * is NaN; signaling or quiet?
+ */
+ if (Sgl_isone_signaling(right))
{
- /* trap if INVALIDTRAP enabled */
+ /* trap if INVALIDTRAP enabled */
if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION);
/* make NaN quiet */
Set_invalidflag();
@@ -150,10 +150,10 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
}
/*
* return quiet NaN
- */
+ */
*dstptr = right;
return(NOEXCEPTION);
- } /* End right NaN or Infinity processing */
+ } /* End right NaN or Infinity processing */
/* Invariant: Must be dealing with finite numbers */
@@ -165,18 +165,18 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
if(Sgl_ismagnitudeless(signless_upper_left,signless_upper_right))
{
/* Set the left operand to the larger one by XOR swap *
- * First finish the first word using "save" */
+ * First finish the first word using "save" */
Sgl_xorfromintp1(save,right,/*to*/right);
Sgl_xorfromintp1(save,left,/*to*/left);
result_exponent = Sgl_exponent(left);
Sgl_invert_sign(left);
}
- /* Invariant: left is not smaller than right. */
+ /* Invariant: left is not smaller than right. */
if((right_exponent = Sgl_exponent(right)) == 0)
- {
+ {
/* Denormalized operands. First look for zeroes */
- if(Sgl_iszero_mantissa(right))
+ if(Sgl_iszero_mantissa(right))
{
/* right is zero */
if(Sgl_iszero_exponentmantissa(left))
@@ -192,7 +192,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
Sgl_and_signs(left,/*with*/right);
}
}
- else
+ else
{
/* Left is not a zero and must be the result. Trapped
* underflows are signaled if left is denormalized. Result
@@ -200,11 +200,11 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
if( (result_exponent == 0) && Is_underflowtrap_enabled() )
{
/* need to normalize results mantissa */
- sign_save = Sgl_signextendedsign(left);
+ sign_save = Sgl_signextendedsign(left);
Sgl_leftshiftby1(left);
Sgl_normalize(left,result_exponent);
Sgl_set_sign(left,/*using*/sign_save);
- Sgl_setwrapped_exponent(left,result_exponent,unfl);
+ Sgl_setwrapped_exponent(left,result_exponent,unfl);
*dstptr = left;
/* inexact = FALSE */
return(UNDERFLOWEXCEPTION);
@@ -250,11 +250,11 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
if(Is_underflowtrap_enabled())
{
/* need to normalize result */
- sign_save = Sgl_signextendedsign(result);
+ sign_save = Sgl_signextendedsign(result);
Sgl_leftshiftby1(result);
Sgl_normalize(result,result_exponent);
Sgl_set_sign(result,/*using*/sign_save);
- Sgl_setwrapped_exponent(result,result_exponent,unfl);
+ Sgl_setwrapped_exponent(result,result_exponent,unfl);
*dstptr = result;
/* inexact = FALSE */
return(UNDERFLOWEXCEPTION);
@@ -272,8 +272,8 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
Sgl_clear_exponent_set_hidden(left);
diff_exponent = result_exponent - right_exponent;
- /*
- * Special case alignment of operands that would force alignment
+ /*
+ * Special case alignment of operands that would force alignment
* beyond the extent of the extension. A further optimization
* could special case this but only reduces the path length for this
* infrequent case.
@@ -282,7 +282,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
{
diff_exponent = SGL_THRESHOLD;
}
-
+
/* Align right operand by shifting to right */
Sgl_right_align(/*operand*/right,/*shifted by*/diff_exponent,
/*and lower to*/extent);
@@ -305,17 +305,17 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
* Only the two most significant bits (round and guard) are
* needed. If only a single shift is needed then the guard
* bit becomes a significant low order bit and the extension
- * must participate in the rounding. If more than a single
- * shift is needed, then all bits to the right of the guard
+ * must participate in the rounding. If more than a single
+ * shift is needed, then all bits to the right of the guard
* bit are zeros, and the guard bit may or may not be zero. */
sign_save = Sgl_signextendedsign(result);
- Sgl_leftshiftby1_withextent(result,extent,result);
+ Sgl_leftshiftby1_withextent(result,extent,result);
- /* Need to check for a zero result. The sign and exponent
+ /* Need to check for a zero result. The sign and exponent
* fields have already been zeroed. The more efficient test
* of the full object can be used.
*/
- if(Sgl_iszero(result))
+ if(Sgl_iszero(result))
/* Must have been "x-x" or "x+(-x)". */
{
if(Is_rounding_mode(ROUNDMINUS)) Sgl_setone_sign(result);
@@ -329,14 +329,14 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
if(result_exponent==0)
{
/* Denormalized, exponent should be zero. Left operand *
- * was normalized, so extent (guard, round) was zero */
+ * was normalized, so extent (guard, round) was zero */
goto underflow;
}
else
{
/* No further normalization is needed. */
Sgl_set_sign(result,/*using*/sign_save);
- Ext_leftshiftby1(extent);
+ Ext_leftshiftby1(extent);
goto round;
}
}
@@ -381,7 +381,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
return(NOEXCEPTION);
}
Sgl_sethigh4bits(result,/*using*/sign_save);
- switch(jumpsize)
+ switch(jumpsize)
{
case 1:
{
@@ -406,7 +406,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
break;
}
}
- if(result_exponent > 0)
+ if(result_exponent > 0)
{
Sgl_set_exponent(result,/*using*/result_exponent);
*dstptr = result; /* Sign bit is already set */
@@ -417,7 +417,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
if(Is_underflowtrap_enabled())
{
Sgl_set_sign(result,sign_save);
- Sgl_setwrapped_exponent(result,result_exponent,unfl);
+ Sgl_setwrapped_exponent(result,result_exponent,unfl);
*dstptr = result;
/* inexact = FALSE */
return(UNDERFLOWEXCEPTION);
@@ -434,7 +434,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
} /* end if(hidden...)... */
/* Fall through and round */
} /* end if(save >= 0)... */
- else
+ else
{
/* Add magnitudes */
Sgl_addition(left,right,/*to*/result);
@@ -446,7 +446,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
result_exponent++;
} /* end if hiddenoverflow... */
} /* end else ...sub magnitudes... */
-
+
/* Round the result. If the extension is all zeros,then the result is
* exact. Otherwise round in the correct direction. No underflow is
* possible. If a postnormalization is necessary, then the mantissa is
@@ -477,23 +477,23 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
Sgl_increment(result);
}
break;
-
+
case ROUNDMINUS:
if(Sgl_isone_sign(result))
{
/* Round down negative results */
Sgl_increment(result);
}
-
+
case ROUNDZERO:;
/* truncate is simple */
} /* end switch... */
if(Sgl_isone_hiddenoverflow(result)) result_exponent++;
}
if(result_exponent == SGL_INFINITY_EXPONENT)
- {
- /* Overflow */
- if(Is_overflowtrap_enabled())
+ {
+ /* Overflow */
+ if(Is_overflowtrap_enabled())
{
Sgl_setwrapped_exponent(result,result_exponent,ovfl);
*dstptr = result;
@@ -504,7 +504,7 @@ sgl_fsub(leftptr, rightptr, dstptr, status)
}
return(OVERFLOWEXCEPTION);
}
- else
+ else
{
Set_overflowflag();
inexact = TRUE;