diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-03-29 03:58:20 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-03-29 03:58:20 +0000 |
commit | b7d2cadef3354bbbd97a98d382291d18fce6200c (patch) | |
tree | a5232eeba7a692164b2bedee650cab64a874adda /sys/arch/hppa | |
parent | 8da71daa70fb2878a11a7d02439e45d2f4f59baa (diff) |
big bang
Diffstat (limited to 'sys/arch/hppa')
44 files changed, 2897 insertions, 2957 deletions
diff --git a/sys/arch/hppa/spmath/Makefile.inc b/sys/arch/hppa/spmath/Makefile.inc index 9b0b9c90487..b5e19fde387 100644 --- a/sys/arch/hppa/spmath/Makefile.inc +++ b/sys/arch/hppa/spmath/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.3 2000/01/11 21:26:24 mickey Exp $ +# $OpenBSD: Makefile.inc,v 1.4 2001/03/29 03:58:17 mickey Exp $ # # NOTE: $S must correspond to the top of the 'sys' tree # $HPPA must correspond to the top of hppa tree @@ -32,7 +32,7 @@ clean:: .NOTMAIN __always_make_spmath @echo cleaning the kern library objects @${SPMATHMAKE} clean -depend:: .NOTMAIN __always_make_spmath +depend:: .NOTMAIN __always_make_spmath @echo depending the kern library objects @${SPMATHMAKE} depend diff --git a/sys/arch/hppa/spmath/cnv_float.h b/sys/arch/hppa/spmath/cnv_float.h index 8ae80123474..0a8dc1ad84d 100644 --- a/sys/arch/hppa/spmath/cnv_float.h +++ b/sys/arch/hppa/spmath/cnv_float.h @@ -1,24 +1,24 @@ -/* $OpenBSD: cnv_float.h,v 1.4 2000/01/11 08:18:42 mickey Exp $ */ +/* $OpenBSD: cnv_float.h,v 1.5 2001/03/29 03:58:17 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 @@ -26,15 +26,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. */ @@ -77,24 +77,24 @@ #define Sgl_roundnearest_from_int(int_value,sgl_value) \ if (int_value & 1<<(SGL_EXP_LENGTH - 2)) /* round bit */ \ - if ((int_value << (34 - SGL_EXP_LENGTH)) || Slow(sgl_value)) \ + if ((int_value << (34 - SGL_EXP_LENGTH)) || Slow(sgl_value)) \ Sall(sgl_value)++ #define Dint_isinexact_to_sgl(dint_valueA,dint_valueB) \ ((Dintp1(dint_valueA) << (33 - SGL_EXP_LENGTH)) || Dintp2(dint_valueB)) #define Sgl_roundnearest_from_dint(dint_valueA,dint_valueB,sgl_value) \ - if (Dintp1(dint_valueA) & 1<<(SGL_EXP_LENGTH - 2)) \ - if ((Dintp1(dint_valueA) << (34 - SGL_EXP_LENGTH)) || \ - Dintp2(dint_valueB) || Slow(sgl_value)) Sall(sgl_value)++ + if (Dintp1(dint_valueA) & 1<<(SGL_EXP_LENGTH - 2)) \ + if ((Dintp1(dint_valueA) << (34 - SGL_EXP_LENGTH)) || \ + Dintp2(dint_valueB) || Slow(sgl_value)) Sall(sgl_value)++ -#define Dint_isinexact_to_dbl(dint_value) \ +#define Dint_isinexact_to_dbl(dint_value) \ (Dintp2(dint_value) << (33 - DBL_EXP_LENGTH)) -#define Dbl_roundnearest_from_dint(dint_opndB,dbl_opndA,dbl_opndB) \ +#define Dbl_roundnearest_from_dint(dint_opndB,dbl_opndA,dbl_opndB) \ if (Dintp2(dint_opndB) & 1<<(DBL_EXP_LENGTH - 2)) \ if ((Dintp2(dint_opndB) << (34 -DBL_EXP_LENGTH)) || Dlowp2(dbl_opndB)) \ - if ((++Dallp2(dbl_opndB))==0) Dallp1(dbl_opndA)++ + if ((++Dallp2(dbl_opndB))==0) Dallp1(dbl_opndA)++ #define Sgl_isone_roundbit(sgl_value,exponent) \ ((Sall(sgl_value) << (SGL_EXP_LENGTH + 1 + exponent)) >> 31) @@ -104,7 +104,7 @@ Sall(sgl_value) << (SGL_EXP_LENGTH + 2 + exponent) : FALSE) -/* +/* * Double format macros */ @@ -112,7 +112,7 @@ dest = src_exponent + (SGL_BIAS - DBL_BIAS) #define Dbl_to_sgl_mantissa(srcA,srcB,dest,inexact,guard,sticky,odd) \ - Shiftdouble(Dmantissap1(srcA),Dmantissap2(srcB),29,dest); \ + Shiftdouble(Dmantissap1(srcA),Dmantissap2(srcB),29,dest); \ guard = Dbit3p2(srcB); \ sticky = Dallp2(srcB)<<4; \ inexact = guard | sticky; \ @@ -161,63 +161,63 @@ sticky = inexact; \ inexact |= guard; \ dest >>= 1; \ - Deposit_dsign(srcA,0); \ - Shiftdouble(Dallp1(srcA),Dallp2(srcB),30,dest); \ - odd = dest << 31; \ + Deposit_dsign(srcA,0); \ + Shiftdouble(Dallp1(srcA),Dallp2(srcB),30,dest); \ + odd = dest << 31; \ } \ else { \ - inexact = Dallp2(srcB) << (2 + exp); \ - guard = inexact >> 31; \ - sticky = inexact << 1; \ - Deposit_dsign(srcA,0); \ - if (exp == -2) dest = Dallp1(srcA); \ - else Variable_shift_double(Dallp1(srcA),Dallp2(srcB),30-exp,dest); \ - odd = dest << 31; \ + inexact = Dallp2(srcB) << (2 + exp); \ + guard = inexact >> 31; \ + sticky = inexact << 1; \ + Deposit_dsign(srcA,0); \ + if (exp == -2) dest = Dallp1(srcA); \ + else Variable_shift_double(Dallp1(srcA),Dallp2(srcB),30-exp,dest); \ + odd = dest << 31; \ } \ } \ else { \ - Deposit_dsign(srcA,0); \ - if (exp > (1 - SGL_P)) { \ - dest = Dallp1(srcA) >> (- 2 - exp); \ - inexact = Dallp1(srcA) << (34 + exp); \ - guard = inexact >> 31; \ - sticky = (inexact << 1) | Dallp2(srcB); \ - inexact |= Dallp2(srcB); \ - odd = dest << 31; \ - } \ - else { \ - dest = 0; \ - inexact = Dallp1(srcA) | Dallp2(srcB); \ - if (exp == (1 - SGL_P)) { \ - guard = Dhidden(srcA); \ - sticky = Dmantissap1(srcA) | Dallp2(srcB); \ - } \ - else { \ - guard = 0; \ - sticky = inexact; \ - } \ - odd = 0; \ - } \ + Deposit_dsign(srcA,0); \ + if (exp > (1 - SGL_P)) { \ + dest = Dallp1(srcA) >> (- 2 - exp); \ + inexact = Dallp1(srcA) << (34 + exp); \ + guard = inexact >> 31; \ + sticky = (inexact << 1) | Dallp2(srcB); \ + inexact |= Dallp2(srcB); \ + odd = dest << 31; \ + } \ + else { \ + dest = 0; \ + inexact = Dallp1(srcA) | Dallp2(srcB); \ + if (exp == (1 - SGL_P)) { \ + guard = Dhidden(srcA); \ + sticky = Dmantissap1(srcA) | Dallp2(srcB); \ + } \ + else { \ + guard = 0; \ + sticky = inexact; \ + } \ + odd = 0; \ + } \ } \ exp = 0 #define Dbl_isinexact_to_fix(dbl_valueA,dbl_valueB,exponent) \ - (exponent < (DBL_P-33) ? \ + (exponent < (DBL_P-33) ? \ Dallp2(dbl_valueB) || Dallp1(dbl_valueA) << (DBL_EXP_LENGTH+1+exponent) : \ (exponent < (DBL_P-1) ? Dallp2(dbl_valueB) << (exponent + (33-DBL_P)) : \ FALSE)) #define Dbl_isoverflow_to_int(exponent,dbl_valueA,dbl_valueB) \ ((exponent > SGL_FX_MAX_EXP + 1) || Dsign(dbl_valueA)==0 || \ - Dmantissap1(dbl_valueA)!=0 || (Dallp2(dbl_valueB)>>21)!=0 ) + Dmantissap1(dbl_valueA)!=0 || (Dallp2(dbl_valueB)>>21)!=0 ) -#define Dbl_isone_roundbit(dbl_valueA,dbl_valueB,exponent) \ +#define Dbl_isone_roundbit(dbl_valueA,dbl_valueB,exponent) \ ((exponent < (DBL_P - 33) ? \ Dallp1(dbl_valueA) >> ((30 - DBL_EXP_LENGTH) - exponent) : \ Dallp2(dbl_valueB) >> ((DBL_P - 2) - exponent)) & 1) #define Dbl_isone_stickybit(dbl_valueA,dbl_valueB,exponent) \ - (exponent < (DBL_P-34) ? \ + (exponent < (DBL_P-34) ? \ (Dallp2(dbl_valueB) || Dallp1(dbl_valueA)<<(DBL_EXP_LENGTH+2+exponent)) : \ (exponent<(DBL_P-2) ? (Dallp2(dbl_valueB) << (exponent + (34-DBL_P))) : \ FALSE)) @@ -226,8 +226,8 @@ /* Int macros */ #define Int_from_sgl_mantissa(sgl_value,exponent) \ - Sall(sgl_value) = \ - (unsigned)(Sall(sgl_value) << SGL_EXP_LENGTH)>>(31 - exponent) + Sall(sgl_value) = \ + (unsigned)(Sall(sgl_value) << SGL_EXP_LENGTH)>>(31 - exponent) #define Int_from_dbl_mantissa(dbl_valueA,dbl_valueB,exponent) \ Shiftdouble(Dallp1(dbl_valueA),Dallp2(dbl_valueB),22,Dallp1(dbl_valueA)); \ @@ -242,39 +242,39 @@ #define Dint_from_sgl_mantissa(sgl_value,exponent,dresultA,dresultB) \ {Sall(sgl_value) <<= SGL_EXP_LENGTH; /* left-justify */ \ if (exponent <= 31) { \ - Dintp1(dresultA) = 0; \ - Dintp2(dresultB) = (unsigned)Sall(sgl_value) >> (31 - exponent); \ + Dintp1(dresultA) = 0; \ + Dintp2(dresultB) = (unsigned)Sall(sgl_value) >> (31 - exponent); \ } \ else { \ - Dintp1(dresultA) = Sall(sgl_value) >> (63 - exponent); \ - Dintp2(dresultB) = Sall(sgl_value) << (exponent - 31); \ + Dintp1(dresultA) = Sall(sgl_value) >> (63 - exponent); \ + Dintp2(dresultB) = Sall(sgl_value) << (exponent - 31); \ }} #define Dint_from_dbl_mantissa(dbl_valueA,dbl_valueB,exponent,destA,destB) \ {if (exponent < 32) { \ - Dintp1(destA) = 0; \ - if (exponent <= 20) \ - Dintp2(destB) = Dallp1(dbl_valueA) >> (20-(exponent)); \ - else Variable_shift_double(Dallp1(dbl_valueA),Dallp2(dbl_valueB), \ + Dintp1(destA) = 0; \ + if (exponent <= 20) \ + Dintp2(destB) = Dallp1(dbl_valueA) >> (20-(exponent)); \ + else Variable_shift_double(Dallp1(dbl_valueA),Dallp2(dbl_valueB), \ (52-(exponent)),Dintp2(destB)); \ } \ else { \ - if (exponent <= 52) { \ - Dintp1(destA) = Dallp1(dbl_valueA) >> (52-(exponent)); \ + if (exponent <= 52) { \ + Dintp1(destA) = Dallp1(dbl_valueA) >> (52-(exponent)); \ if (exponent == 52) Dintp2(destB) = Dallp2(dbl_valueB); \ else Variable_shift_double(Dallp1(dbl_valueA),Dallp2(dbl_valueB), \ 52-exponent,Dintp2(destB)); \ - } \ - else { \ - Variable_shift_double(Dallp1(dbl_valueA),Dallp2(dbl_valueB), \ + } \ + else { \ + Variable_shift_double(Dallp1(dbl_valueA),Dallp2(dbl_valueB), \ 84-exponent,Dintp1(destA)); \ - Dintp2(destB) = Dallp2(dbl_valueB) << ((exponent)-52); \ - } \ + Dintp2(destB) = Dallp2(dbl_valueB) << ((exponent)-52); \ + } \ }} -#define Dint_setzero(dresultA,dresultB) \ - Dintp1(dresultA) = 0; \ +#define Dint_setzero(dresultA,dresultB) \ + Dintp1(dresultA) = 0; \ Dintp2(dresultB) = 0 #define Dint_setone_sign(dresultA,dresultB) \ @@ -287,10 +287,10 @@ #define Dint_isone_lowp2(dresultB) (Dintp2(dresultB) & 01) -#define Dint_increment(dresultA,dresultB) \ +#define Dint_increment(dresultA,dresultB) \ if ((++Dintp2(dresultB))==0) Dintp1(dresultA)++ -#define Dint_decrement(dresultA,dresultB) \ +#define Dint_decrement(dresultA,dresultB) \ if ((Dintp2(dresultB)--)==0) Dintp1(dresultA)-- #define Dint_negate(dresultA,dresultB) \ diff --git a/sys/arch/hppa/spmath/dbl_float.h b/sys/arch/hppa/spmath/dbl_float.h index 05a4ae6eb10..c378a65eecd 100644 --- a/sys/arch/hppa/spmath/dbl_float.h +++ b/sys/arch/hppa/spmath/dbl_float.h @@ -1,24 +1,24 @@ -/* $OpenBSD: dbl_float.h,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: dbl_float.h,v 1.5 2001/03/29 03:58:17 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 @@ -26,15 +26,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. */ @@ -79,24 +79,24 @@ * variable shifts. The insignificant bits can be ignored. * MTSAR f(varamount) * VSHD srcdst.high,srcdst.low => srcdst.low - * VSHD 0,srcdst.high => srcdst.high + * VSHD 0,srcdst.high => srcdst.high * This is very difficult to model with C expressions since the shift amount * could exceed 32. */ /* varamount must be less than 64 */ #define Dbl_rightshift(srcdstA, srcdstB, varamount) \ {if((varamount) >= 32) { \ - Dallp2(srcdstB) = Dallp1(srcdstA) >> (varamount-32); \ - Dallp1(srcdstA)=0; \ + Dallp2(srcdstB) = Dallp1(srcdstA) >> (varamount-32); \ + Dallp1(srcdstA)=0; \ } \ else if(varamount > 0) { \ - Variable_shift_double(Dallp1(srcdstA), Dallp2(srcdstB), \ + Variable_shift_double(Dallp1(srcdstA), Dallp2(srcdstB), \ (varamount), Dallp2(srcdstB)); \ Dallp1(srcdstA) >>= varamount; \ } } /* varamount must be less than 64 */ #define Dbl_rightshift_exponentmantissa(srcdstA, srcdstB, varamount) \ {if((varamount) >= 32) { \ - Dallp2(srcdstB) = Dexponentmantissap1(srcdstA) >> ((varamount)-32); \ + Dallp2(srcdstB) = Dexponentmantissap1(srcdstA) >> ((varamount)-32); \ Dallp1(srcdstA) &= (1<<31); /* clear exponentmantissa field */ \ } \ else if(varamount > 0) { \ @@ -120,8 +120,8 @@ } } #define Dbl_leftshiftby1_withextent(lefta,leftb,right,resulta,resultb) \ Shiftdouble(Dallp1(lefta), Dallp2(leftb), 31, Dallp1(resulta)); \ - Shiftdouble(Dallp2(leftb), Extall(right), 31, Dallp2(resultb)) - + Shiftdouble(Dallp2(leftb), Extall(right), 31, Dallp2(resultb)) + #define Dbl_rightshiftby1_withextent(leftb,right,dst) \ Extall(dst) = (Dallp2(leftb) << 31) | ((unsigned)Extall(right) >> 1) | \ Extlow(right) @@ -129,7 +129,7 @@ #define Dbl_arithrightshiftby1(srcdstA,srcdstB) \ Shiftdouble(Dallp1(srcdstA),Dallp2(srcdstB),1,Dallp2(srcdstB));\ Dallp1(srcdstA) = (int)Dallp1(srcdstA) >> 1 - + /* Sign extend the sign bit with an integer destination */ #define Dbl_signextendedsign(value) Dsignedsign(value) @@ -244,21 +244,21 @@ #define Dbl_rightshiftby1(dbl_valueA,dbl_valueB) \ Shiftdouble(Dallp1(dbl_valueA),Dallp2(dbl_valueB),1,Dallp2(dbl_valueB)); \ Dallp1(dbl_valueA) >>= 1 - + /* This magnitude comparison uses the signless first words and * the regular part2 words. The comparison is graphically: * * 1st greater? ------------- - * | + * | * 1st less?-----------------+--------- - * | | - * 2nd greater or equal----->| | - * False True + * | | + * 2nd greater or equal----->| | + * False True */ #define Dbl_ismagnitudeless(leftB,rightB,signlessleft,signlessright) \ ((signlessleft <= signlessright) && \ ( (signlessleft < signlessright) || (Dallp2(leftB)<Dallp2(rightB)) )) - + #define Dbl_copytoint_exponentmantissap1(src,dest) \ dest = Dexponentmantissap1(src) @@ -283,7 +283,7 @@ #define Dbl_copyfromptr(src,desta,destb) \ Dallp1(desta) = src->wd0; \ - Dallp2(destb) = src->wd1 + Dallp2(destb) = src->wd1 #define Dbl_copytoptr(srca,srcb,dest) \ dest->wd0 = Dallp1(srca); \ dest->wd1 = Dallp2(srcb) @@ -292,19 +292,19 @@ #define Dbl_setinfinity_exponent(dbl_value) \ Deposit_dexponent(dbl_value,DBL_INFINITY_EXPONENT) #define Dbl_setinfinity_exponentmantissa(dbl_valueA,dbl_valueB) \ - Deposit_dexponentmantissap1(dbl_valueA, \ + Deposit_dexponentmantissap1(dbl_valueA, \ (DBL_INFINITY_EXPONENT << (32-(1+DBL_EXP_LENGTH)))); \ Dmantissap2(dbl_valueB) = 0 #define Dbl_setinfinitypositive(dbl_valueA,dbl_valueB) \ - Dallp1(dbl_valueA) \ - = (DBL_INFINITY_EXPONENT << (32-(1+DBL_EXP_LENGTH))); \ + Dallp1(dbl_valueA) \ + = (DBL_INFINITY_EXPONENT << (32-(1+DBL_EXP_LENGTH))); \ Dmantissap2(dbl_valueB) = 0 #define Dbl_setinfinitynegative(dbl_valueA,dbl_valueB) \ Dallp1(dbl_valueA) = (1<<31) | \ - (DBL_INFINITY_EXPONENT << (32-(1+DBL_EXP_LENGTH))); \ + (DBL_INFINITY_EXPONENT << (32-(1+DBL_EXP_LENGTH))); \ Dmantissap2(dbl_valueB) = 0 #define Dbl_setinfinity(dbl_valueA,dbl_valueB,sign) \ - Dallp1(dbl_valueA) = (sign << 31) | \ + Dallp1(dbl_valueA) = (sign << 31) | \ (DBL_INFINITY_EXPONENT << (32-(1+DBL_EXP_LENGTH))); \ Dmantissap2(dbl_valueB) = 0 @@ -314,10 +314,10 @@ #define Dbl_setone_sign(dbl_value) Deposit_dsign(dbl_value,1) #define Dbl_setone_lowmantissap2(dbl_value) Deposit_dlowp2(dbl_value,1) #define Dbl_setzero_sign(dbl_value) Dallp1(dbl_value) &= 0x7fffffff -#define Dbl_setzero_exponent(dbl_value) \ +#define Dbl_setzero_exponent(dbl_value) \ Dallp1(dbl_value) &= 0x800fffff #define Dbl_setzero_mantissa(dbl_valueA,dbl_valueB) \ - Dallp1(dbl_valueA) &= 0xfff00000; \ + Dallp1(dbl_valueA) &= 0xfff00000; \ Dallp2(dbl_valueB) = 0 #define Dbl_setzero_mantissap1(dbl_value) Dallp1(dbl_value) &= 0xfff00000 #define Dbl_setzero_mantissap2(dbl_value) Dallp2(dbl_value) = 0 @@ -340,45 +340,45 @@ #define Dbl_setwrapped_exponent(dbl_value,exponent,op) \ Deposit_dexponent(dbl_value,(exponent op DBL_WRAP)) -#define Dbl_setlargestpositive(dbl_valueA,dbl_valueB) \ - Dallp1(dbl_valueA) = ((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \ +#define Dbl_setlargestpositive(dbl_valueA,dbl_valueB) \ + Dallp1(dbl_valueA) = ((DBL_MAX_EXP+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \ | ((1<<(32-(1+DBL_EXP_LENGTH))) - 1 ); \ Dallp2(dbl_valueB) = 0xFFFFFFFF -#define Dbl_setlargestnegative(dbl_valueA,dbl_valueB) \ - Dallp1(dbl_valueA) = ((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \ +#define Dbl_setlargestnegative(dbl_valueA,dbl_valueB) \ + Dallp1(dbl_valueA) = ((DBL_MAX_EXP+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \ | ((1<<(32-(1+DBL_EXP_LENGTH))) - 1 ) | (1<<31); \ Dallp2(dbl_valueB) = 0xFFFFFFFF #define Dbl_setlargest_exponentmantissa(dbl_valueA,dbl_valueB) \ Deposit_dexponentmantissap1(dbl_valueA, \ - (((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \ + (((DBL_MAX_EXP+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) \ | ((1<<(32-(1+DBL_EXP_LENGTH))) - 1 ))); \ Dallp2(dbl_valueB) = 0xFFFFFFFF -#define Dbl_setnegativeinfinity(dbl_valueA,dbl_valueB) \ - Dallp1(dbl_valueA) = ((1<<DBL_EXP_LENGTH) | DBL_INFINITY_EXPONENT) \ - << (32-(1+DBL_EXP_LENGTH)) ; \ +#define Dbl_setnegativeinfinity(dbl_valueA,dbl_valueB) \ + Dallp1(dbl_valueA) = ((1<<DBL_EXP_LENGTH) | DBL_INFINITY_EXPONENT) \ + << (32-(1+DBL_EXP_LENGTH)) ; \ Dallp2(dbl_valueB) = 0 #define Dbl_setlargest(dbl_valueA,dbl_valueB,sign) \ Dallp1(dbl_valueA) = (sign << 31) | \ - ((DBL_EMAX+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) | \ + ((DBL_MAX_EXP+DBL_BIAS) << (32-(1+DBL_EXP_LENGTH))) | \ ((1 << (32-(1+DBL_EXP_LENGTH))) - 1 ); \ Dallp2(dbl_valueB) = 0xFFFFFFFF - + /* The high bit is always zero so arithmetic or logical shifts will work. */ #define Dbl_right_align(srcdstA,srcdstB,shift,extent) \ - if( shift >= 32 ) \ + if( shift >= 32 ) \ { \ - /* Big shift requires examining the portion shift off \ + /* Big shift requires examining the portion shift off \ the end to properly set inexact. */ \ if(shift < 64) \ { \ if(shift > 32) \ { \ - Variable_shift_double(Dallp1(srcdstA),Dallp2(srcdstB), \ + Variable_shift_double(Dallp1(srcdstA),Dallp2(srcdstB), \ shift-32, Extall(extent)); \ - if(Dallp2(srcdstB) << (64 - (shift))) Ext_setone_low(extent); \ - } \ + if(Dallp2(srcdstB) << (64 - (shift))) Ext_setone_low(extent); \ + } \ else Extall(extent) = Dallp2(srcdstB); \ Dallp2(srcdstB) = Dallp1(srcdstA) >> (shift - 32); \ } \ @@ -403,7 +403,7 @@ else Extall(extent) = 0; \ } -/* +/* * Here we need to shift the result right to correct for an overshift * (due to the exponent becoming negative) during normalization. */ @@ -428,9 +428,9 @@ #define Dbl_subtract_withextension(lefta,leftb,righta,rightb,extent,resulta,resultb) \ Dbl_subtract(lefta,leftb,righta,rightb,resulta,resultb); \ if( (Extall(extent) = 0-Extall(extent)) ) \ - { \ - if((Dallp2(resultb)--) == 0) Dallp1(resulta)--; \ - } + { \ + if((Dallp2(resultb)--) == 0) Dallp1(resulta)--; \ + } #define Dbl_addition(lefta,leftb,righta,rightb,resulta,resultb) \ /* If the sum of the low words is less than either source, then \ @@ -452,12 +452,12 @@ /* Need to Initialize */ #define Dbl_makequietnan(desta,destb) \ - Dallp1(desta) = ((DBL_EMAX+DBL_BIAS)+1)<< (32-(1+DBL_EXP_LENGTH)) \ - | (1<<(32-(1+DBL_EXP_LENGTH+2))); \ + Dallp1(desta) = ((DBL_MAX_EXP+DBL_BIAS)+1)<< (32-(1+DBL_EXP_LENGTH)) \ + | (1<<(32-(1+DBL_EXP_LENGTH+2))); \ Dallp2(destb) = 0 #define Dbl_makesignalingnan(desta,destb) \ - Dallp1(desta) = ((DBL_EMAX+DBL_BIAS)+1)<< (32-(1+DBL_EXP_LENGTH)) \ - | (1<<(32-(1+DBL_EXP_LENGTH+1))); \ + Dallp1(desta) = ((DBL_MAX_EXP+DBL_BIAS)+1)<< (32-(1+DBL_EXP_LENGTH)) \ + | (1<<(32-(1+DBL_EXP_LENGTH+1))); \ Dallp2(destb) = 0 #define Dbl_normalize(dbl_opndA,dbl_opndB,exponent) \ @@ -475,7 +475,7 @@ } #define Twoword_add(src1dstA,src1dstB,src2A,src2B) \ - /* \ + /* \ * want this macro to generate: \ * ADD src1dstB,src2B,src1dstB; \ * ADDC src1dstA,src2A,src1dstA; \ @@ -485,7 +485,7 @@ Dallp2(src1dstB) += (src2B) #define Twoword_subtract(src1dstA,src1dstB,src2A,src2B) \ - /* \ + /* \ * want this macro to generate: \ * SUB src1dstB,src2B,src1dstB; \ * SUBB src1dstA,src2A,src1dstA; \ diff --git a/sys/arch/hppa/spmath/dfadd.c b/sys/arch/hppa/spmath/dfadd.c index 1ba54688175..8e465902163 100644 --- a/sys/arch/hppa/spmath/dfadd.c +++ b/sys/arch/hppa/spmath/dfadd.c @@ -1,24 +1,24 @@ -/* $OpenBSD: dfadd.c,v 1.3 1998/07/02 19:04:57 mickey Exp $ */ +/* $OpenBSD: dfadd.c,v 1.4 2001/03/29 03:58:17 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 @@ -26,15 +26,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,18 +52,18 @@ dbl_fadd(leftptr, rightptr, dstptr, status) register unsigned int signless_upper_left, signless_upper_right, save; register unsigned int leftp1, leftp2, rightp1, rightp2, extent; register unsigned int resultp1 = 0, resultp2 = 0; - + register int result_exponent, right_exponent, diff_exponent; register int sign_save, jumpsize; - register boolean inexact = FALSE; - register boolean underflowtrap; - + register int inexact = FALSE; + register int underflowtrap; + /* Create local copies of the numbers */ Dbl_copyfromptr(leftptr,leftp1,leftp2); Dbl_copyfromptr(rightptr,rightp1,rightp2); - /* 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). */ Dbl_xortointp1(leftp1,rightp1,/*to*/save); /* @@ -71,48 +71,48 @@ dbl_fadd(leftptr, rightptr, dstptr, status) */ if ((result_exponent = Dbl_exponent(leftp1)) == DBL_INFINITY_EXPONENT) { - if (Dbl_iszero_mantissa(leftp1,leftp2)) + if (Dbl_iszero_mantissa(leftp1,leftp2)) { - if (Dbl_isnotnan(rightp1,rightp2)) + if (Dbl_isnotnan(rightp1,rightp2)) { - if (Dbl_isinfinity(rightp1,rightp2) && save!=0) + if (Dbl_isinfinity(rightp1,rightp2) && save!=0) { - /* + /* * invalid since operands are opposite signed infinity's */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(resultp1,resultp2); + Set_invalidflag(); + Dbl_makequietnan(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } /* - * return infinity - */ + * return infinity + */ Dbl_copytoptr(leftp1,leftp2,dstptr); return(NOEXCEPTION); } } - else + else { - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(leftp1)) + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(leftp1)) { - /* trap if INVALIDTRAP enabled */ + /* trap if INVALIDTRAP enabled */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(leftp1); - } - /* - * is second operand a signaling NaN? + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(leftp1); + } + /* + * is second operand a signaling NaN? */ - else if (Dbl_is_signalingnan(rightp1)) + else if (Dbl_is_signalingnan(rightp1)) { - /* 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(); Dbl_set_quiet(rightp1); @@ -120,29 +120,29 @@ dbl_fadd(leftptr, rightptr, dstptr, status) return(NOEXCEPTION); } /* - * return quiet NaN - */ + * return quiet NaN + */ Dbl_copytoptr(leftp1,leftp2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } } /* End left NaN or Infinity processing */ /* * check second operand for NaN's or infinity */ - if (Dbl_isinfinity_exponent(rightp1)) + if (Dbl_isinfinity_exponent(rightp1)) { - if (Dbl_iszero_mantissa(rightp1,rightp2)) + if (Dbl_iszero_mantissa(rightp1,rightp2)) { /* return infinity */ Dbl_copytoptr(rightp1,rightp2,dstptr); return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(rightp1)) + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(rightp1)) { - /* trap if INVALIDTRAP enabled */ + /* trap if INVALIDTRAP enabled */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); /* make NaN quiet */ Set_invalidflag(); @@ -150,10 +150,10 @@ dbl_fadd(leftptr, rightptr, dstptr, status) } /* * return quiet NaN - */ + */ Dbl_copytoptr(rightp1,rightp2,dstptr); return(NOEXCEPTION); - } /* End right NaN or Infinity processing */ + } /* End right NaN or Infinity processing */ /* Invariant: Must be dealing with finite numbers */ @@ -164,19 +164,19 @@ dbl_fadd(leftptr, rightptr, dstptr, status) /* sign difference selects add or sub operation. */ if(Dbl_ismagnitudeless(leftp2,rightp2,signless_upper_left,signless_upper_right)) { - /* Set the left operand to the larger one by XOR swap * - * First finish the first word using "save" */ + /* Set the left operand to the larger one by XOR swap * + * First finish the first word using "save" */ Dbl_xorfromintp1(save,rightp1,/*to*/rightp1); Dbl_xorfromintp1(save,leftp1,/*to*/leftp1); - Dbl_swap_lower(leftp2,rightp2); + Dbl_swap_lower(leftp2,rightp2); result_exponent = Dbl_exponent(leftp1); } - /* Invariant: left is not smaller than right. */ + /* Invariant: left is not smaller than right. */ if((right_exponent = Dbl_exponent(rightp1)) == 0) - { + { /* Denormalized operands. First look for zeroes */ - if(Dbl_iszero_mantissa(rightp1,rightp2)) + if(Dbl_iszero_mantissa(rightp1,rightp2)) { /* right is zero */ if(Dbl_iszero_exponentmantissa(leftp1,leftp2)) @@ -191,7 +191,7 @@ dbl_fadd(leftptr, rightptr, dstptr, status) Dbl_and_signs(leftp1,/*with*/rightp1); } } - else + else { /* Left is not a zero and must be the result. Trapped * underflows are signaled if left is denormalized. Result @@ -199,11 +199,11 @@ dbl_fadd(leftptr, rightptr, dstptr, status) if( (result_exponent == 0) && Is_underflowtrap_enabled() ) { /* need to normalize results mantissa */ - sign_save = Dbl_signextendedsign(leftp1); + sign_save = Dbl_signextendedsign(leftp1); Dbl_leftshiftby1(leftp1,leftp2); Dbl_normalize(leftp1,leftp2,result_exponent); Dbl_set_sign(leftp1,/*using*/sign_save); - Dbl_setwrapped_exponent(leftp1,result_exponent,unfl); + Dbl_setwrapped_exponent(leftp1,result_exponent,unfl); Dbl_copytoptr(leftp1,leftp2,dstptr); /* inexact = FALSE */ return(UNDERFLOWEXCEPTION); @@ -251,14 +251,14 @@ dbl_fadd(leftptr, rightptr, dstptr, status) if(Is_underflowtrap_enabled()) { /* need to normalize result */ - sign_save = Dbl_signextendedsign(resultp1); + sign_save = Dbl_signextendedsign(resultp1); Dbl_leftshiftby1(resultp1,resultp2); Dbl_normalize(resultp1,resultp2,result_exponent); Dbl_set_sign(resultp1,/*using*/sign_save); - Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); - Dbl_copytoptr(resultp1,resultp2,dstptr); + Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); + Dbl_copytoptr(resultp1,resultp2,dstptr); /* inexact = FALSE */ - return(UNDERFLOWEXCEPTION); + return(UNDERFLOWEXCEPTION); } Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); @@ -273,8 +273,8 @@ dbl_fadd(leftptr, rightptr, dstptr, status) Dbl_clear_exponent_set_hidden(leftp1); 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. @@ -283,7 +283,7 @@ dbl_fadd(leftptr, rightptr, dstptr, status) { diff_exponent = DBL_THRESHOLD; } - + /* Align right operand by shifting to right */ Dbl_right_align(/*operand*/rightp1,rightp2,/*shifted by*/diff_exponent, /*and lower to*/extent); @@ -307,17 +307,17 @@ dbl_fadd(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 = Dbl_signextendedsign(resultp1); - Dbl_leftshiftby1_withextent(resultp1,resultp2,extent,resultp1,resultp2); + Dbl_leftshiftby1_withextent(resultp1,resultp2,extent,resultp1,resultp2); - /* 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(Dbl_iszero(resultp1,resultp2)) + if(Dbl_iszero(resultp1,resultp2)) /* Must have been "x-x" or "x+(-x)". */ { if(Is_rounding_mode(ROUNDMINUS)) Dbl_setone_sign(resultp1); @@ -338,7 +338,7 @@ dbl_fadd(leftptr, rightptr, dstptr, status) { /* No further normalization is needed. */ Dbl_set_sign(resultp1,/*using*/sign_save); - Ext_leftshiftby1(extent); + Ext_leftshiftby1(extent); goto round; } } @@ -383,7 +383,7 @@ dbl_fadd(leftptr, rightptr, dstptr, status) return(NOEXCEPTION); } Dbl_sethigh4bits(resultp1,/*using*/sign_save); - switch(jumpsize) + switch(jumpsize) { case 1: { @@ -408,23 +408,23 @@ dbl_fadd(leftptr, rightptr, dstptr, status) break; } } - if(result_exponent > 0) + if(result_exponent > 0) { Dbl_set_exponent(resultp1,/*using*/result_exponent); Dbl_copytoptr(resultp1,resultp2,dstptr); - return(NOEXCEPTION); /* Sign bit is already set */ + return(NOEXCEPTION); /* Sign bit is already set */ } /* Fixup potential underflows */ underflow: if(Is_underflowtrap_enabled()) { Dbl_set_sign(resultp1,sign_save); - Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); + Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); Dbl_copytoptr(resultp1,resultp2,dstptr); /* inexact = FALSE */ return(UNDERFLOWEXCEPTION); } - /* + /* * Since we cannot get an inexact denormalized result, * we can now return. */ @@ -436,7 +436,7 @@ dbl_fadd(leftptr, rightptr, dstptr, status) } /* end if(hidden...)... */ /* Fall through and round */ } /* end if(save < 0)... */ - else + else { /* Add magnitudes */ Dbl_addition(leftp1,leftp2,rightp1,rightp2,/*to*/resultp1,resultp2); @@ -448,7 +448,7 @@ dbl_fadd(leftptr, rightptr, dstptr, status) result_exponent++; } /* end if hiddenoverflow... */ } /* end else ...add 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 @@ -479,23 +479,23 @@ dbl_fadd(leftptr, rightptr, dstptr, status) Dbl_increment(resultp1,resultp2); } break; - + case ROUNDMINUS: if(Dbl_isone_sign(resultp1)) { /* Round down negative results */ Dbl_increment(resultp1,resultp2); } - + case ROUNDZERO:; /* truncate is simple */ } /* end switch... */ if(Dbl_isone_hiddenoverflow(resultp1)) result_exponent++; } if(result_exponent == DBL_INFINITY_EXPONENT) - { - /* Overflow */ - if(Is_overflowtrap_enabled()) + { + /* Overflow */ + if(Is_overflowtrap_enabled()) { Dbl_setwrapped_exponent(resultp1,result_exponent,ovfl); Dbl_copytoptr(resultp1,resultp2,dstptr); @@ -507,7 +507,7 @@ dbl_fadd(leftptr, rightptr, dstptr, status) } return(OVERFLOWEXCEPTION); } - else + else { inexact = TRUE; Set_overflowflag(); diff --git a/sys/arch/hppa/spmath/dfcmp.c b/sys/arch/hppa/spmath/dfcmp.c index 30e083d428f..594c3c15725 100644 --- a/sys/arch/hppa/spmath/dfcmp.c +++ b/sys/arch/hppa/spmath/dfcmp.c @@ -1,24 +1,24 @@ -/* $OpenBSD: dfcmp.c,v 1.3 1998/07/02 19:04:59 mickey Exp $ */ +/* $OpenBSD: dfcmp.c,v 1.4 2001/03/29 03:58:17 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 @@ -26,22 +26,22 @@ /* * (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. */ #include "../spmath/float.h" #include "../spmath/dbl_float.h" - + /* * dbl_cmp: compare two values */ @@ -53,7 +53,7 @@ dbl_fcmp(leftptr, rightptr, cond, status) { register unsigned int leftp1, leftp2, rightp1, rightp2; register int xorresult; - + /* Create local copies of the numbers */ Dbl_copyfromptr(leftptr,leftp1,leftp2); Dbl_copyfromptr(rightptr,rightp1,rightp2); @@ -61,21 +61,21 @@ dbl_fcmp(leftptr, rightptr, cond, status) * Test for NaN */ if( (Dbl_exponent(leftp1) == DBL_INFINITY_EXPONENT) - || (Dbl_exponent(rightp1) == DBL_INFINITY_EXPONENT) ) + || (Dbl_exponent(rightp1) == DBL_INFINITY_EXPONENT) ) { - /* Check if a NaN is involved. Signal an invalid exception when + /* Check if a NaN is involved. Signal an invalid exception when * comparing a signaling NaN or when comparing quiet NaNs and the * low bit of the condition is set */ - if( ((Dbl_exponent(leftp1) == DBL_INFINITY_EXPONENT) - && Dbl_isnotzero_mantissa(leftp1,leftp2) + if( ((Dbl_exponent(leftp1) == DBL_INFINITY_EXPONENT) + && Dbl_isnotzero_mantissa(leftp1,leftp2) && (Exception(cond) || Dbl_isone_signaling(leftp1))) || ((Dbl_exponent(rightp1) == DBL_INFINITY_EXPONENT) - && Dbl_isnotzero_mantissa(rightp1,rightp2) + && Dbl_isnotzero_mantissa(rightp1,rightp2) && (Exception(cond) || Dbl_isone_signaling(rightp1))) ) { if( Is_invalidtrap_enabled() ) { - Set_status_cbit(Unordered(cond)); + Set_status_cbit(Unordered(cond)); return(INVALIDEXCEPTION); } else Set_invalidflag(); @@ -84,7 +84,7 @@ dbl_fcmp(leftptr, rightptr, cond, status) } /* All the exceptional conditions are handled, now special case NaN compares */ - else if( ((Dbl_exponent(leftp1) == DBL_INFINITY_EXPONENT) + else if( ((Dbl_exponent(leftp1) == DBL_INFINITY_EXPONENT) && Dbl_isnotzero_mantissa(leftp1,leftp2)) || ((Dbl_exponent(rightp1) == DBL_INFINITY_EXPONENT) @@ -100,12 +100,12 @@ dbl_fcmp(leftptr, rightptr, cond, status) * special equal case */ Dbl_xortointp1(leftp1,rightp1,xorresult); if( xorresult < 0 ) - { - /* left negative => less, left positive => greater. - * equal is possible if both operands are zeros. */ - if( Dbl_iszero_exponentmantissa(leftp1,leftp2) + { + /* left negative => less, left positive => greater. + * equal is possible if both operands are zeros. */ + if( Dbl_iszero_exponentmantissa(leftp1,leftp2) && Dbl_iszero_exponentmantissa(rightp1,rightp2) ) - { + { Set_status_cbit(Equal(cond)); } else if( Dbl_isone_sign(leftp1) ) @@ -116,16 +116,16 @@ dbl_fcmp(leftptr, rightptr, cond, status) { Set_status_cbit(Greaterthan(cond)); } - } + } /* Signs are the same. Treat negative numbers separately * from the positives because of the reversed sense. */ else if(Dbl_isequal(leftp1,leftp2,rightp1,rightp2)) - { - Set_status_cbit(Equal(cond)); - } + { + Set_status_cbit(Equal(cond)); + } else if( Dbl_iszero_sign(leftp1) ) - { - /* Positive compare */ + { + /* Positive compare */ if( Dbl_allp1(leftp1) < Dbl_allp1(rightp1) ) { Set_status_cbit(Lessthan(cond)); @@ -142,17 +142,17 @@ dbl_fcmp(leftptr, rightptr, cond, status) { Set_status_cbit(Lessthan(cond)); } - else + else { Set_status_cbit(Greaterthan(cond)); } } } else - { - /* Negative compare. Signed or unsigned compares - * both work the same. That distinction is only - * important when the sign bits differ. */ + { + /* Negative compare. Signed or unsigned compares + * both work the same. That distinction is only + * important when the sign bits differ. */ if( Dbl_allp1(leftp1) > Dbl_allp1(rightp1) ) { Set_status_cbit(Lessthan(cond)); @@ -169,11 +169,11 @@ dbl_fcmp(leftptr, rightptr, cond, status) { Set_status_cbit(Lessthan(cond)); } - else + else { Set_status_cbit(Greaterthan(cond)); } } - } + } return(NOEXCEPTION); } diff --git a/sys/arch/hppa/spmath/dfdiv.c b/sys/arch/hppa/spmath/dfdiv.c index 57b183c6cef..1dbdae82042 100644 --- a/sys/arch/hppa/spmath/dfdiv.c +++ b/sys/arch/hppa/spmath/dfdiv.c @@ -1,25 +1,25 @@ -/* $OpenBSD: dfdiv.c,v 1.3 1998/07/02 19:05:00 mickey Exp $ */ +/* $OpenBSD: dfdiv.c,v 1.4 2001/03/29 03:58:17 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. */ @@ -55,16 +55,16 @@ unsigned int *status; register unsigned int opnd1p1, opnd1p2, opnd2p1, opnd2p2; register unsigned int opnd3p1, opnd3p2, resultp1, resultp2; register int dest_exponent, count; - register boolean inexact = FALSE, guardbit = FALSE, stickybit = FALSE; - boolean is_tiny; + register int inexact = FALSE, guardbit = FALSE, stickybit = FALSE; + int is_tiny; Dbl_copyfromptr(srcptr1,opnd1p1,opnd1p2); Dbl_copyfromptr(srcptr2,opnd2p1,opnd2p2); - /* - * set sign bit of result + /* + * set sign bit of result */ - if (Dbl_sign(opnd1p1) ^ Dbl_sign(opnd2p1)) - Dbl_setnegativezerop1(resultp1); + if (Dbl_sign(opnd1p1) ^ Dbl_sign(opnd2p1)) + Dbl_setnegativezerop1(resultp1); else Dbl_setzerop1(resultp1); /* * check first operand for NaN's or infinity @@ -73,55 +73,55 @@ unsigned int *status; if (Dbl_iszero_mantissa(opnd1p1,opnd1p2)) { if (Dbl_isnotnan(opnd2p1,opnd2p2)) { if (Dbl_isinfinity(opnd2p1,opnd2p2)) { - /* - * invalid since both operands - * are infinity + /* + * invalid since both operands + * are infinity */ if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(resultp1,resultp2); + return(INVALIDEXCEPTION); + Set_invalidflag(); + Dbl_makequietnan(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } /* - * return infinity - */ + * return infinity + */ Dbl_setinfinity_exponentmantissa(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } } else { - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(opnd1p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd1p1); - } - /* - * is second operand a signaling NaN? + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(opnd1p1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd1p1); + } + /* + * is second operand a signaling NaN? */ else if (Dbl_is_signalingnan(opnd2p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd2p1); + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd2p1); Dbl_copytoptr(opnd2p1,opnd2p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } - /* - * return quiet NaN - */ + /* + * return quiet NaN + */ Dbl_copytoptr(opnd1p1,opnd1p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } } /* @@ -136,43 +136,43 @@ unsigned int *status; Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(opnd2p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd2p1); - } - /* - * return quiet NaN - */ + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(opnd2p1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd2p1); + } + /* + * return quiet NaN + */ Dbl_copytoptr(opnd2p1,opnd2p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } - /* - * check for division by zero - */ - if (Dbl_iszero_exponentmantissa(opnd2p1,opnd2p2)) { - if (Dbl_iszero_exponentmantissa(opnd1p1,opnd1p2)) { - /* invalid since both operands are zero */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(resultp1,resultp2); - Dbl_copytoptr(resultp1,resultp2,dstptr); - return(NOEXCEPTION); - } - if (Is_divisionbyzerotrap_enabled()) - return(DIVISIONBYZEROEXCEPTION); - Set_divisionbyzeroflag(); - Dbl_setinfinity_exponentmantissa(resultp1,resultp2); - Dbl_copytoptr(resultp1,resultp2,dstptr); - return(NOEXCEPTION); - } /* - * Generate exponent + * check for division by zero + */ + if (Dbl_iszero_exponentmantissa(opnd2p1,opnd2p2)) { + if (Dbl_iszero_exponentmantissa(opnd1p1,opnd1p2)) { + /* invalid since both operands are zero */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + Set_invalidflag(); + Dbl_makequietnan(resultp1,resultp2); + Dbl_copytoptr(resultp1,resultp2,dstptr); + return(NOEXCEPTION); + } + if (Is_divisionbyzerotrap_enabled()) + return(DIVISIONBYZEROEXCEPTION); + Set_divisionbyzeroflag(); + Dbl_setinfinity_exponentmantissa(resultp1,resultp2); + Dbl_copytoptr(resultp1,resultp2,dstptr); + return(NOEXCEPTION); + } + /* + * Generate exponent */ dest_exponent = Dbl_exponent(opnd1p1) - Dbl_exponent(opnd2p1) + DBL_BIAS; @@ -190,9 +190,9 @@ unsigned int *status; Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } - /* is denormalized, want to normalize */ - Dbl_clear_signexponent(opnd1p1); - Dbl_leftshiftby1(opnd1p1,opnd1p2); + /* is denormalized, want to normalize */ + Dbl_clear_signexponent(opnd1p1); + Dbl_leftshiftby1(opnd1p1,opnd1p2); Dbl_normalize(opnd1p1,opnd1p2,dest_exponent); } /* opnd2 needs to have hidden bit set with msb in hidden bit */ @@ -200,26 +200,26 @@ unsigned int *status; Dbl_clear_signexponent_set_hidden(opnd2p1); } else { - /* is denormalized; want to normalize */ - Dbl_clear_signexponent(opnd2p1); - Dbl_leftshiftby1(opnd2p1,opnd2p2); - while (Dbl_iszero_hiddenhigh7mantissa(opnd2p1)) { - dest_exponent+=8; - Dbl_leftshiftby8(opnd2p1,opnd2p2); - } - if (Dbl_iszero_hiddenhigh3mantissa(opnd2p1)) { - dest_exponent+=4; - Dbl_leftshiftby4(opnd2p1,opnd2p2); - } - while (Dbl_iszero_hidden(opnd2p1)) { - dest_exponent++; - Dbl_leftshiftby1(opnd2p1,opnd2p2); - } + /* is denormalized; want to normalize */ + Dbl_clear_signexponent(opnd2p1); + Dbl_leftshiftby1(opnd2p1,opnd2p2); + while (Dbl_iszero_hiddenhigh7mantissa(opnd2p1)) { + dest_exponent+=8; + Dbl_leftshiftby8(opnd2p1,opnd2p2); + } + if (Dbl_iszero_hiddenhigh3mantissa(opnd2p1)) { + dest_exponent+=4; + Dbl_leftshiftby4(opnd2p1,opnd2p2); + } + while (Dbl_iszero_hidden(opnd2p1)) { + dest_exponent++; + Dbl_leftshiftby1(opnd2p1,opnd2p2); + } } /* Divide the source mantissas */ - /* + /* * A non-restoring divide algorithm is used. */ Twoword_subtract(opnd1p1,opnd1p2,opnd2p1,opnd2p2); @@ -263,114 +263,114 @@ unsigned int *status; } inexact = guardbit | stickybit; - /* - * round result + /* + * round result */ if (inexact && (dest_exponent > 0 || Is_underflowtrap_enabled())) { Dbl_clear_signexponent(opnd3p1); switch (Rounding_mode()) { - case ROUNDPLUS: - if (Dbl_iszero_sign(resultp1)) + case ROUNDPLUS: + if (Dbl_iszero_sign(resultp1)) Dbl_increment(opnd3p1,opnd3p2); break; - case ROUNDMINUS: - if (Dbl_isone_sign(resultp1)) + case ROUNDMINUS: + if (Dbl_isone_sign(resultp1)) Dbl_increment(opnd3p1,opnd3p2); break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Dbl_isone_lowmantissap2(opnd3p2))) { - Dbl_increment(opnd3p1,opnd3p2); + Dbl_increment(opnd3p1,opnd3p2); } } if (Dbl_isone_hidden(opnd3p1)) dest_exponent++; } Dbl_set_mantissa(resultp1,resultp2,opnd3p1,opnd3p2); - /* - * Test for overflow - */ + /* + * Test for overflow + */ if (dest_exponent >= DBL_INFINITY_EXPONENT) { - /* trap if OVERFLOWTRAP enabled */ - if (Is_overflowtrap_enabled()) { - /* - * Adjust bias of result - */ - Dbl_setwrapped_exponent(resultp1,dest_exponent,ovfl); - Dbl_copytoptr(resultp1,resultp2,dstptr); - if (inexact) { - if (Is_inexacttrap_enabled()) - return(OVERFLOWEXCEPTION | INEXACTEXCEPTION); - else - Set_inexactflag(); + /* trap if OVERFLOWTRAP enabled */ + if (Is_overflowtrap_enabled()) { + /* + * Adjust bias of result + */ + Dbl_setwrapped_exponent(resultp1,dest_exponent,ovfl); + Dbl_copytoptr(resultp1,resultp2,dstptr); + if (inexact) { + if (Is_inexacttrap_enabled()) + return(OVERFLOWEXCEPTION | INEXACTEXCEPTION); + else + Set_inexactflag(); } - return(OVERFLOWEXCEPTION); - } + return(OVERFLOWEXCEPTION); + } Set_overflowflag(); - /* set result to infinity or largest number */ + /* set result to infinity or largest number */ Dbl_setoverflow(resultp1,resultp2); inexact = TRUE; } - /* - * Test for underflow - */ + /* + * Test for underflow + */ else if (dest_exponent <= 0) { - /* trap if UNDERFLOWTRAP enabled */ - if (Is_underflowtrap_enabled()) { - /* - * Adjust bias of result - */ - Dbl_setwrapped_exponent(resultp1,dest_exponent,unfl); - Dbl_copytoptr(resultp1,resultp2,dstptr); - if (inexact) { - if (Is_inexacttrap_enabled()) - return(UNDERFLOWEXCEPTION | INEXACTEXCEPTION); - else - Set_inexactflag(); + /* trap if UNDERFLOWTRAP enabled */ + if (Is_underflowtrap_enabled()) { + /* + * Adjust bias of result + */ + Dbl_setwrapped_exponent(resultp1,dest_exponent,unfl); + Dbl_copytoptr(resultp1,resultp2,dstptr); + if (inexact) { + if (Is_inexacttrap_enabled()) + return(UNDERFLOWEXCEPTION | INEXACTEXCEPTION); + else + Set_inexactflag(); } - return(UNDERFLOWEXCEPTION); - } + return(UNDERFLOWEXCEPTION); + } /* Determine if should set underflow flag */ is_tiny = TRUE; if (dest_exponent == 0 && inexact) { switch (Rounding_mode()) { - case ROUNDPLUS: + case ROUNDPLUS: if (Dbl_iszero_sign(resultp1)) { Dbl_increment(opnd3p1,opnd3p2); if (Dbl_isone_hiddenoverflow(opnd3p1)) - is_tiny = FALSE; + is_tiny = FALSE; Dbl_decrement(opnd3p1,opnd3p2); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Dbl_isone_sign(resultp1)) { Dbl_increment(opnd3p1,opnd3p2); if (Dbl_isone_hiddenoverflow(opnd3p1)) - is_tiny = FALSE; + is_tiny = FALSE; Dbl_decrement(opnd3p1,opnd3p2); } break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Dbl_isone_lowmantissap2(opnd3p2))) { - Dbl_increment(opnd3p1,opnd3p2); + Dbl_increment(opnd3p1,opnd3p2); if (Dbl_isone_hiddenoverflow(opnd3p1)) - is_tiny = FALSE; + is_tiny = FALSE; Dbl_decrement(opnd3p1,opnd3p2); } break; } } - /* - * denormalize result or set to signed zero - */ + /* + * denormalize result or set to signed zero + */ stickybit = inexact; Dbl_denormalize(opnd3p1,opnd3p2,dest_exponent,guardbit, stickybit,inexact); - /* return rounded number */ + /* return rounded number */ if (inexact) { switch (Rounding_mode()) { case ROUNDPLUS: @@ -378,20 +378,21 @@ unsigned int *status; Dbl_increment(opnd3p1,opnd3p2); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Dbl_isone_sign(resultp1)) { Dbl_increment(opnd3p1,opnd3p2); } break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Dbl_isone_lowmantissap2(opnd3p2))) { - Dbl_increment(opnd3p1,opnd3p2); + Dbl_increment(opnd3p1,opnd3p2); } break; } - if (is_tiny) Set_underflowflag(); - } + if (is_tiny) + Set_underflowflag(); + } Dbl_set_exponentmantissa(resultp1,resultp2,opnd3p1,opnd3p2); } else Dbl_set_exponent(resultp1,dest_exponent); diff --git a/sys/arch/hppa/spmath/dfmpy.c b/sys/arch/hppa/spmath/dfmpy.c index ab14101d1e1..9504c17abc0 100644 --- a/sys/arch/hppa/spmath/dfmpy.c +++ b/sys/arch/hppa/spmath/dfmpy.c @@ -1,25 +1,25 @@ -/* $OpenBSD: dfmpy.c,v 1.3 1998/07/02 19:05:01 mickey Exp $ */ +/* $OpenBSD: dfmpy.c,v 1.4 2001/03/29 03:58:17 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. */ @@ -55,17 +55,17 @@ unsigned int *status; register unsigned int opnd1p1, opnd1p2, opnd2p1, opnd2p2; register unsigned int opnd3p1, opnd3p2, resultp1, resultp2; register int dest_exponent, count; - register boolean inexact = FALSE, guardbit = FALSE, stickybit = FALSE; - boolean is_tiny; + register int inexact = FALSE, guardbit = FALSE, stickybit = FALSE; + int is_tiny; Dbl_copyfromptr(srcptr1,opnd1p1,opnd1p2); Dbl_copyfromptr(srcptr2,opnd2p1,opnd2p2); - /* - * set sign bit of result + /* + * set sign bit of result */ - if (Dbl_sign(opnd1p1) ^ Dbl_sign(opnd2p1)) - Dbl_setnegativezerop1(resultp1); + if (Dbl_sign(opnd1p1) ^ Dbl_sign(opnd2p1)) + Dbl_setnegativezerop1(resultp1); else Dbl_setzerop1(resultp1); /* * check first operand for NaN's or infinity @@ -74,55 +74,55 @@ unsigned int *status; if (Dbl_iszero_mantissa(opnd1p1,opnd1p2)) { if (Dbl_isnotnan(opnd2p1,opnd2p2)) { if (Dbl_iszero_exponentmantissa(opnd2p1,opnd2p2)) { - /* - * invalid since operands are infinity - * and zero + /* + * invalid since operands are infinity + * and zero */ if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(resultp1,resultp2); + return(INVALIDEXCEPTION); + Set_invalidflag(); + Dbl_makequietnan(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } /* - * return infinity - */ + * return infinity + */ Dbl_setinfinity_exponentmantissa(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } } else { - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(opnd1p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd1p1); - } - /* - * is second operand a signaling NaN? + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(opnd1p1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd1p1); + } + /* + * is second operand a signaling NaN? */ else if (Dbl_is_signalingnan(opnd2p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd2p1); + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd2p1); Dbl_copytoptr(opnd2p1,opnd2p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } - /* - * return quiet NaN - */ + /* + * return quiet NaN + */ Dbl_copytoptr(opnd1p1,opnd1p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } } /* @@ -133,9 +133,9 @@ unsigned int *status; if (Dbl_iszero_exponentmantissa(opnd1p1,opnd1p2)) { /* invalid since operands are zero & infinity */ if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(opnd2p1,opnd2p2); + return(INVALIDEXCEPTION); + Set_invalidflag(); + Dbl_makequietnan(opnd2p1,opnd2p2); Dbl_copytoptr(opnd2p1,opnd2p2,dstptr); return(NOEXCEPTION); } @@ -146,24 +146,24 @@ unsigned int *status; Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(opnd2p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd2p1); - } - /* - * return quiet NaN - */ + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(opnd2p1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd2p1); + } + /* + * return quiet NaN + */ Dbl_copytoptr(opnd2p1,opnd2p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } /* - * Generate exponent + * Generate exponent */ dest_exponent = Dbl_exponent(opnd1p1) + Dbl_exponent(opnd2p1) -DBL_BIAS; @@ -181,9 +181,9 @@ unsigned int *status; Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } - /* is denormalized, adjust exponent */ - Dbl_clear_signexponent(opnd1p1); - Dbl_leftshiftby1(opnd1p1,opnd1p2); + /* is denormalized, adjust exponent */ + Dbl_clear_signexponent(opnd1p1); + Dbl_leftshiftby1(opnd1p1,opnd1p2); Dbl_normalize(opnd1p1,opnd1p2,dest_exponent); } /* opnd2 needs to have hidden bit set with msb in hidden bit */ @@ -197,9 +197,9 @@ unsigned int *status; Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } - /* is denormalized; want to normalize */ - Dbl_clear_signexponent(opnd2p1); - Dbl_leftshiftby1(opnd2p1,opnd2p2); + /* is denormalized; want to normalize */ + Dbl_clear_signexponent(opnd2p1); + Dbl_leftshiftby1(opnd2p1,opnd2p2); Dbl_normalize(opnd2p1,opnd2p2,dest_exponent); } @@ -208,28 +208,28 @@ unsigned int *status; /* make room for guard bits */ Dbl_leftshiftby7(opnd2p1,opnd2p2); Dbl_setzero(opnd3p1,opnd3p2); - /* - * Four bits at a time are inspected in each loop, and a - * simple shift and add multiply algorithm is used. - */ + /* + * Four bits at a time are inspected in each loop, and a + * simple shift and add multiply algorithm is used. + */ for (count=1;count<=DBL_P;count+=4) { stickybit |= Dlow4p2(opnd3p2); Dbl_rightshiftby4(opnd3p1,opnd3p2); if (Dbit28p2(opnd1p2)) { - /* Twoword_add should be an ADDC followed by an ADD. */ - Twoword_add(opnd3p1, opnd3p2, opnd2p1<<3 | opnd2p2>>29, + /* Twoword_add should be an ADDC followed by an ADD. */ + Twoword_add(opnd3p1, opnd3p2, opnd2p1<<3 | opnd2p2>>29, opnd2p2<<3); } if (Dbit29p2(opnd1p2)) { - Twoword_add(opnd3p1, opnd3p2, opnd2p1<<2 | opnd2p2>>30, + Twoword_add(opnd3p1, opnd3p2, opnd2p1<<2 | opnd2p2>>30, opnd2p2<<2); } if (Dbit30p2(opnd1p2)) { - Twoword_add(opnd3p1, opnd3p2, opnd2p1<<1 | opnd2p2>>31, + Twoword_add(opnd3p1, opnd3p2, opnd2p1<<1 | opnd2p2>>31, opnd2p2<<1); } if (Dbit31p2(opnd1p2)) { - Twoword_add(opnd3p1, opnd3p2, opnd2p1, opnd2p2); + Twoword_add(opnd3p1, opnd3p2, opnd2p1, opnd2p2); } Dbl_rightshiftby4(opnd1p1,opnd1p2); } @@ -246,7 +246,7 @@ unsigned int *status; dest_exponent--; } /* - * check for guard, sticky and inexact bits + * check for guard, sticky and inexact bits */ stickybit |= Dallp2(opnd3p2) << 25; guardbit = (Dallp2(opnd3p2) << 24) >> 31; @@ -255,39 +255,39 @@ unsigned int *status; /* align result mantissa */ Dbl_rightshiftby8(opnd3p1,opnd3p2); - /* - * round result + /* + * round result */ if (inexact && (dest_exponent>0 || Is_underflowtrap_enabled())) { Dbl_clear_signexponent(opnd3p1); switch (Rounding_mode()) { - case ROUNDPLUS: - if (Dbl_iszero_sign(resultp1)) + case ROUNDPLUS: + if (Dbl_iszero_sign(resultp1)) Dbl_increment(opnd3p1,opnd3p2); break; - case ROUNDMINUS: - if (Dbl_isone_sign(resultp1)) + case ROUNDMINUS: + if (Dbl_isone_sign(resultp1)) Dbl_increment(opnd3p1,opnd3p2); break; case ROUNDNEAREST: - if (guardbit) { - if (stickybit || Dbl_isone_lowmantissap2(opnd3p2)) - Dbl_increment(opnd3p1,opnd3p2); - } + if (guardbit && + (stickybit || Dbl_isone_lowmantissap2(opnd3p2))) + Dbl_increment(opnd3p1,opnd3p2); + break; } if (Dbl_isone_hidden(opnd3p1)) dest_exponent++; } Dbl_set_mantissa(resultp1,resultp2,opnd3p1,opnd3p2); - /* - * Test for overflow - */ + /* + * Test for overflow + */ if (dest_exponent >= DBL_INFINITY_EXPONENT) { - /* trap if OVERFLOWTRAP enabled */ - if (Is_overflowtrap_enabled()) { - /* - * Adjust bias of result - */ + /* trap if OVERFLOWTRAP enabled */ + if (Is_overflowtrap_enabled()) { + /* + * Adjust bias of result + */ Dbl_setwrapped_exponent(resultp1,dest_exponent,ovfl); Dbl_copytoptr(resultp1,resultp2,dstptr); if (inexact) { @@ -297,21 +297,21 @@ unsigned int *status; Set_inexactflag(); } return (OVERFLOWEXCEPTION); - } + } inexact = TRUE; Set_overflowflag(); - /* set result to infinity or largest number */ + /* set result to infinity or largest number */ Dbl_setoverflow(resultp1,resultp2); } - /* - * Test for underflow - */ + /* + * Test for underflow + */ else if (dest_exponent <= 0) { - /* trap if UNDERFLOWTRAP enabled */ - if (Is_underflowtrap_enabled()) { - /* - * Adjust bias of result - */ + /* trap if UNDERFLOWTRAP enabled */ + if (Is_underflowtrap_enabled()) { + /* + * Adjust bias of result + */ Dbl_setwrapped_exponent(resultp1,dest_exponent,unfl); Dbl_copytoptr(resultp1,resultp2,dstptr); if (inexact) { @@ -321,34 +321,34 @@ unsigned int *status; Set_inexactflag(); } return (UNDERFLOWEXCEPTION); - } + } /* Determine if should set underflow flag */ is_tiny = TRUE; if (dest_exponent == 0 && inexact) { switch (Rounding_mode()) { - case ROUNDPLUS: + case ROUNDPLUS: if (Dbl_iszero_sign(resultp1)) { Dbl_increment(opnd3p1,opnd3p2); if (Dbl_isone_hiddenoverflow(opnd3p1)) - is_tiny = FALSE; + is_tiny = FALSE; Dbl_decrement(opnd3p1,opnd3p2); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Dbl_isone_sign(resultp1)) { Dbl_increment(opnd3p1,opnd3p2); if (Dbl_isone_hiddenoverflow(opnd3p1)) - is_tiny = FALSE; + is_tiny = FALSE; Dbl_decrement(opnd3p1,opnd3p2); } break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Dbl_isone_lowmantissap2(opnd3p2))) { - Dbl_increment(opnd3p1,opnd3p2); + Dbl_increment(opnd3p1,opnd3p2); if (Dbl_isone_hiddenoverflow(opnd3p1)) - is_tiny = FALSE; + is_tiny = FALSE; Dbl_decrement(opnd3p1,opnd3p2); } break; @@ -365,24 +365,24 @@ unsigned int *status; /* return zero or smallest number */ if (inexact) { switch (Rounding_mode()) { - case ROUNDPLUS: + case ROUNDPLUS: if (Dbl_iszero_sign(resultp1)) { Dbl_increment(opnd3p1,opnd3p2); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Dbl_isone_sign(resultp1)) { Dbl_increment(opnd3p1,opnd3p2); } break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Dbl_isone_lowmantissap2(opnd3p2))) { - Dbl_increment(opnd3p1,opnd3p2); + Dbl_increment(opnd3p1,opnd3p2); } break; } - if (is_tiny) Set_underflowflag(); + if (is_tiny) Set_underflowflag(); } Dbl_set_exponentmantissa(resultp1,resultp2,opnd3p1,opnd3p2); } diff --git a/sys/arch/hppa/spmath/dfrem.c b/sys/arch/hppa/spmath/dfrem.c index d1779792d16..fc23126d485 100644 --- a/sys/arch/hppa/spmath/dfrem.c +++ b/sys/arch/hppa/spmath/dfrem.c @@ -1,25 +1,25 @@ -/* $OpenBSD: dfrem.c,v 1.3 1998/07/02 19:05:03 mickey Exp $ */ +/* $OpenBSD: dfrem.c,v 1.4 2001/03/29 03:58:17 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. */ @@ -55,7 +55,7 @@ unsigned int *status; register unsigned int opnd1p1, opnd1p2, opnd2p1, opnd2p2; register unsigned int resultp1, resultp2; register int opnd1_exponent, opnd2_exponent, dest_exponent, stepcount; - register boolean roundup = FALSE; + register int roundup = FALSE; Dbl_copyfromptr(srcptr1,opnd1p1,opnd1p2); Dbl_copyfromptr(srcptr2,opnd2p1,opnd2p2); @@ -66,46 +66,46 @@ unsigned int *status; if (Dbl_iszero_mantissa(opnd1p1,opnd1p2)) { if (Dbl_isnotnan(opnd2p1,opnd2p2)) { /* invalid since first operand is infinity */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(resultp1,resultp2); + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + Set_invalidflag(); + Dbl_makequietnan(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } } else { - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(opnd1p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd1p1); - } - /* - * is second operand a signaling NaN? + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(opnd1p1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd1p1); + } + /* + * is second operand a signaling NaN? */ else if (Dbl_is_signalingnan(opnd2p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd2p1); + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd2p1); Dbl_copytoptr(opnd2p1,opnd2p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } - /* - * return quiet NaN - */ + /* + * return quiet NaN + */ Dbl_copytoptr(opnd1p1,opnd1p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } - } + } /* * check second operand for NaN's or infinity */ @@ -117,21 +117,21 @@ unsigned int *status; Dbl_copytoptr(opnd1p1,opnd1p2,dstptr); return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(opnd2p1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(opnd2p1); - } - /* - * return quiet NaN - */ + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(opnd2p1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(opnd2p1); + } + /* + * return quiet NaN + */ Dbl_copytoptr(opnd2p1,opnd2p2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } /* * check second operand for zero @@ -139,18 +139,18 @@ unsigned int *status; if (Dbl_iszero_exponentmantissa(opnd2p1,opnd2p2)) { /* invalid since second operand is zero */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(resultp1,resultp2); + Set_invalidflag(); + Dbl_makequietnan(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } - /* + /* * get sign of result */ - resultp1 = opnd1p1; + resultp1 = opnd1p1; - /* + /* * check for denormalized operands */ if (opnd1_exponent == 0) { @@ -186,21 +186,21 @@ unsigned int *status; /* * check for opnd1/opnd2 > 1/2 * - * In this case n will round to 1, so - * r = opnd1 - opnd2 + * In this case n will round to 1, so + * r = opnd1 - opnd2 */ - if (stepcount == -1 && + if (stepcount == -1 && Dbl_isgreaterthan(opnd1p1,opnd1p2,opnd2p1,opnd2p2)) { /* set sign */ Dbl_allp1(resultp1) = ~Dbl_allp1(resultp1); /* align opnd2 with opnd1 */ - Dbl_leftshiftby1(opnd2p1,opnd2p2); + Dbl_leftshiftby1(opnd2p1,opnd2p2); Dbl_subtract(opnd2p1,opnd2p2,opnd1p1,opnd1p2, opnd2p1,opnd2p2); /* now normalize */ - while (Dbl_iszero_hidden(opnd2p1)) { - Dbl_leftshiftby1(opnd2p1,opnd2p2); - dest_exponent--; + while (Dbl_iszero_hidden(opnd2p1)) { + Dbl_leftshiftby1(opnd2p1,opnd2p2); + dest_exponent--; } Dbl_set_exponentmantissa(resultp1,resultp2,opnd2p1,opnd2p2); goto testforunderflow; @@ -208,7 +208,7 @@ unsigned int *status; /* * opnd1/opnd2 <= 1/2 * - * In this case n will round to zero, so + * In this case n will round to zero, so * r = opnd1 */ Dbl_set_exponentmantissa(resultp1,resultp2,opnd1p1,opnd1p2); @@ -228,8 +228,8 @@ unsigned int *status; Dbl_leftshiftby1(opnd1p1,opnd1p2); } /* - * Do last subtract, then determine which way to round if remainder - * is exactly 1/2 of opnd2 + * Do last subtract, then determine which way to round if remainder + * is exactly 1/2 of opnd2 */ if (Dbl_isnotlessthan(opnd1p1,opnd1p2,opnd2p1,opnd2p2)) { Dbl_subtract(opnd1p1,opnd1p2,opnd2p1,opnd2p2,opnd1p1,opnd1p2); @@ -242,8 +242,8 @@ unsigned int *status; return(NOEXCEPTION); } - /* - * Check for cases where opnd1/opnd2 < n + /* + * Check for cases where opnd1/opnd2 < n * * In this case the result's sign will be opposite that of * opnd1. The mantissa also needs some correction. @@ -255,40 +255,40 @@ unsigned int *status; Dbl_subtract(opnd2p1,opnd2p2,opnd1p1,opnd1p2,opnd1p1,opnd1p2); } /* check for remainder being exactly 1/2 of opnd2 */ - else if (Dbl_isequal(opnd1p1,opnd1p2,opnd2p1,opnd2p2) && roundup) { + else if (Dbl_isequal(opnd1p1,opnd1p2,opnd2p1,opnd2p2) && roundup) { Dbl_invert_sign(resultp1); } /* normalize result's mantissa */ - while (Dbl_iszero_hidden(opnd1p1)) { - dest_exponent--; - Dbl_leftshiftby1(opnd1p1,opnd1p2); - } + while (Dbl_iszero_hidden(opnd1p1)) { + dest_exponent--; + Dbl_leftshiftby1(opnd1p1,opnd1p2); + } Dbl_set_exponentmantissa(resultp1,resultp2,opnd1p1,opnd1p2); - /* - * Test for underflow - */ + /* + * Test for underflow + */ testforunderflow: if (dest_exponent <= 0) { - /* trap if UNDERFLOWTRAP enabled */ - if (Is_underflowtrap_enabled()) { - /* - * Adjust bias of result - */ - Dbl_setwrapped_exponent(resultp1,dest_exponent,unfl); + /* trap if UNDERFLOWTRAP enabled */ + if (Is_underflowtrap_enabled()) { + /* + * Adjust bias of result + */ + Dbl_setwrapped_exponent(resultp1,dest_exponent,unfl); /* frem is always exact */ Dbl_copytoptr(resultp1,resultp2,dstptr); return(UNDERFLOWEXCEPTION); - } - /* - * denormalize result or set to signed zero - */ - if (dest_exponent >= (1 - DBL_P)) { + } + /* + * denormalize result or set to signed zero + */ + if (dest_exponent >= (1 - DBL_P)) { Dbl_rightshift_exponentmantissa(resultp1,resultp2, 1-dest_exponent); - } - else { + } + else { Dbl_setzero_exponentmantissa(resultp1,resultp2); } } diff --git a/sys/arch/hppa/spmath/dfsqrt.c b/sys/arch/hppa/spmath/dfsqrt.c index cb109bf8a30..e5edb003dab 100644 --- a/sys/arch/hppa/spmath/dfsqrt.c +++ b/sys/arch/hppa/spmath/dfsqrt.c @@ -1,25 +1,25 @@ -/* $OpenBSD: dfsqrt.c,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: dfsqrt.c,v 1.5 2001/03/29 03:58:17 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. */ @@ -56,45 +56,45 @@ unsigned int *status; register unsigned int srcp1, srcp2, resultp1, resultp2; register unsigned int newbitp1, newbitp2, sump1, sump2; register int src_exponent; - register boolean guardbit = FALSE, even_exponent; + register int guardbit = FALSE, even_exponent; Dbl_copyfromptr(srcptr,srcp1,srcp2); - /* - * check source operand for NaN or infinity - */ - if ((src_exponent = Dbl_exponent(srcp1)) == DBL_INFINITY_EXPONENT) { - /* - * is signaling NaN? - */ - if (Dbl_isone_signaling(srcp1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(srcp1); - } - /* - * Return quiet NaN or positive infinity. + /* + * check source operand for NaN or infinity + */ + if ((src_exponent = Dbl_exponent(srcp1)) == DBL_INFINITY_EXPONENT) { + /* + * is signaling NaN? + */ + if (Dbl_isone_signaling(srcp1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(srcp1); + } + /* + * Return quiet NaN or positive infinity. * Fall thru to negative test if negative infinity. - */ - if (Dbl_iszero_sign(srcp1) || + */ + if (Dbl_iszero_sign(srcp1) || Dbl_isnotzero_mantissa(srcp1,srcp2)) { - Dbl_copytoptr(srcp1,srcp2,dstptr); - return(NOEXCEPTION); + Dbl_copytoptr(srcp1,srcp2,dstptr); + return(NOEXCEPTION); } - } + } - /* - * check for zero source operand - */ + /* + * check for zero source operand + */ if (Dbl_iszero_exponentmantissa(srcp1,srcp2)) { Dbl_copytoptr(srcp1,srcp2,dstptr); return(NOEXCEPTION); } - /* - * check for negative source operand - */ + /* + * check for negative source operand + */ if (Dbl_isone_sign(srcp1)) { /* trap if INVALIDTRAP enabled */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); @@ -126,7 +126,7 @@ unsigned int *status; } /* * Add comment here. Explain following algorithm. - * + * * Trust me, it works. * */ @@ -139,7 +139,7 @@ unsigned int *status; Dbl_leftshiftby1(newbitp1,newbitp2); /* update result */ Dbl_addition(resultp1,resultp2,newbitp1,newbitp2, - resultp1,resultp2); + resultp1,resultp2); Dbl_subtract(srcp1,srcp2,sump1,sump2,srcp1,srcp2); Dbl_rightshiftby2(newbitp1,newbitp2); } @@ -167,7 +167,7 @@ unsigned int *status; Dbl_increment(resultp1,resultp2); break; case ROUNDNEAREST: - /* stickybit is always true, so guardbit + /* stickybit is always true, so guardbit * is enough to determine rounding */ if (guardbit) { Dbl_increment(resultp1,resultp2); diff --git a/sys/arch/hppa/spmath/dfsub.c b/sys/arch/hppa/spmath/dfsub.c index 99a24ad4fbc..4e5a7d9a0e9 100644 --- a/sys/arch/hppa/spmath/dfsub.c +++ b/sys/arch/hppa/spmath/dfsub.c @@ -1,25 +1,25 @@ -/* $OpenBSD: dfsub.c,v 1.3 1998/07/02 19:05:08 mickey Exp $ */ +/* $OpenBSD: dfsub.c,v 1.4 2001/03/29 03:58:17 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. */ @@ -53,17 +53,17 @@ dbl_fsub(leftptr, rightptr, dstptr, status) register unsigned int signless_upper_left, signless_upper_right, save; register unsigned int leftp1, leftp2, rightp1, rightp2, extent; register unsigned int resultp1 = 0, resultp2 = 0; - + 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 */ Dbl_copyfromptr(leftptr,leftp1,leftp2); Dbl_copyfromptr(rightptr,rightp1,rightp2); /* A zero "save" helps discover equal operands (for later), * - * and is used in swapping operands (if needed). */ + * and is used in swapping operands (if needed). */ Dbl_xortointp1(leftp1,rightp1,/*to*/save); /* @@ -71,48 +71,48 @@ dbl_fsub(leftptr, rightptr, dstptr, status) */ if ((result_exponent = Dbl_exponent(leftp1)) == DBL_INFINITY_EXPONENT) { - if (Dbl_iszero_mantissa(leftp1,leftp2)) + if (Dbl_iszero_mantissa(leftp1,leftp2)) { - if (Dbl_isnotnan(rightp1,rightp2)) + if (Dbl_isnotnan(rightp1,rightp2)) { - if (Dbl_isinfinity(rightp1,rightp2) && save==0) + if (Dbl_isinfinity(rightp1,rightp2) && save==0) { - /* + /* * invalid since operands are same signed infinity's */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - Set_invalidflag(); - Dbl_makequietnan(resultp1,resultp2); + Set_invalidflag(); + Dbl_makequietnan(resultp1,resultp2); Dbl_copytoptr(resultp1,resultp2,dstptr); return(NOEXCEPTION); } /* - * return infinity - */ + * return infinity + */ Dbl_copytoptr(leftp1,leftp2,dstptr); return(NOEXCEPTION); } } - else + else { - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(leftp1)) + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(leftp1)) { - /* trap if INVALIDTRAP enabled */ + /* trap if INVALIDTRAP enabled */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(leftp1); - } - /* - * is second operand a signaling NaN? + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(leftp1); + } + /* + * is second operand a signaling NaN? */ - else if (Dbl_is_signalingnan(rightp1)) + else if (Dbl_is_signalingnan(rightp1)) { - /* 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(); Dbl_set_quiet(rightp1); @@ -120,30 +120,30 @@ dbl_fsub(leftptr, rightptr, dstptr, status) return(NOEXCEPTION); } /* - * return quiet NaN - */ + * return quiet NaN + */ Dbl_copytoptr(leftp1,leftp2,dstptr); - return(NOEXCEPTION); + return(NOEXCEPTION); } } /* End left NaN or Infinity processing */ /* * check second operand for NaN's or infinity */ - if (Dbl_isinfinity_exponent(rightp1)) + if (Dbl_isinfinity_exponent(rightp1)) { - if (Dbl_iszero_mantissa(rightp1,rightp2)) + if (Dbl_iszero_mantissa(rightp1,rightp2)) { /* return infinity */ Dbl_invert_sign(rightp1); Dbl_copytoptr(rightp1,rightp2,dstptr); return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(rightp1)) + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(rightp1)) { - /* trap if INVALIDTRAP enabled */ + /* trap if INVALIDTRAP enabled */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); /* make NaN quiet */ Set_invalidflag(); @@ -151,10 +151,10 @@ dbl_fsub(leftptr, rightptr, dstptr, status) } /* * return quiet NaN - */ + */ Dbl_copytoptr(rightp1,rightp2,dstptr); return(NOEXCEPTION); - } /* End right NaN or Infinity processing */ + } /* End right NaN or Infinity processing */ /* Invariant: Must be dealing with finite numbers */ @@ -166,19 +166,19 @@ dbl_fsub(leftptr, rightptr, dstptr, status) if(Dbl_ismagnitudeless(leftp2,rightp2,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" */ Dbl_xorfromintp1(save,rightp1,/*to*/rightp1); Dbl_xorfromintp1(save,leftp1,/*to*/leftp1); - Dbl_swap_lower(leftp2,rightp2); + Dbl_swap_lower(leftp2,rightp2); result_exponent = Dbl_exponent(leftp1); Dbl_invert_sign(leftp1); } - /* Invariant: left is not smaller than right. */ + /* Invariant: left is not smaller than right. */ if((right_exponent = Dbl_exponent(rightp1)) == 0) - { + { /* Denormalized operands. First look for zeroes */ - if(Dbl_iszero_mantissa(rightp1,rightp2)) + if(Dbl_iszero_mantissa(rightp1,rightp2)) { /* right is zero */ if(Dbl_iszero_exponentmantissa(leftp1,leftp2)) @@ -194,7 +194,7 @@ dbl_fsub(leftptr, rightptr, dstptr, status) Dbl_and_signs(leftp1,/*with*/rightp1); } } - else + else { /* Left is not a zero and must be the result. Trapped * underflows are signaled if left is denormalized. Result @@ -202,11 +202,11 @@ dbl_fsub(leftptr, rightptr, dstptr, status) if( (result_exponent == 0) && Is_underflowtrap_enabled() ) { /* need to normalize results mantissa */ - sign_save = Dbl_signextendedsign(leftp1); + sign_save = Dbl_signextendedsign(leftp1); Dbl_leftshiftby1(leftp1,leftp2); Dbl_normalize(leftp1,leftp2,result_exponent); Dbl_set_sign(leftp1,/*using*/sign_save); - Dbl_setwrapped_exponent(leftp1,result_exponent,unfl); + Dbl_setwrapped_exponent(leftp1,result_exponent,unfl); Dbl_copytoptr(leftp1,leftp2,dstptr); /* inexact = FALSE */ return(UNDERFLOWEXCEPTION); @@ -254,11 +254,11 @@ dbl_fsub(leftptr, rightptr, dstptr, status) if(Is_underflowtrap_enabled()) { /* need to normalize result */ - sign_save = Dbl_signextendedsign(resultp1); + sign_save = Dbl_signextendedsign(resultp1); Dbl_leftshiftby1(resultp1,resultp2); Dbl_normalize(resultp1,resultp2,result_exponent); Dbl_set_sign(resultp1,/*using*/sign_save); - Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); + Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); Dbl_copytoptr(resultp1,resultp2,dstptr); /* inexact = FALSE */ return(UNDERFLOWEXCEPTION); @@ -276,8 +276,8 @@ dbl_fsub(leftptr, rightptr, dstptr, status) Dbl_clear_exponent_set_hidden(leftp1); 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. @@ -286,7 +286,7 @@ dbl_fsub(leftptr, rightptr, dstptr, status) { diff_exponent = DBL_THRESHOLD; } - + /* Align right operand by shifting to right */ Dbl_right_align(/*operand*/rightp1,rightp2,/*shifted by*/diff_exponent, /*and lower to*/extent); @@ -310,17 +310,17 @@ dbl_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 = Dbl_signextendedsign(resultp1); - Dbl_leftshiftby1_withextent(resultp1,resultp2,extent,resultp1,resultp2); + Dbl_leftshiftby1_withextent(resultp1,resultp2,extent,resultp1,resultp2); - /* 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(Dbl_iszero(resultp1,resultp2)) + if(Dbl_iszero(resultp1,resultp2)) /* Must have been "x-x" or "x+(-x)". */ { if(Is_rounding_mode(ROUNDMINUS)) Dbl_setone_sign(resultp1); @@ -329,22 +329,18 @@ dbl_fsub(leftptr, rightptr, dstptr, status) } result_exponent--; /* Look to see if normalization is finished. */ - if(Dbl_isone_hidden(resultp1)) - { - if(result_exponent==0) - { + if(Dbl_isone_hidden(resultp1)) { + if(result_exponent==0) { /* Denormalized, exponent should be zero. Left operand * * was normalized, so extent (guard, round) was zero */ goto underflow; - } - else - { - /* No further normalization is needed. */ - Dbl_set_sign(resultp1,/*using*/sign_save); - Ext_leftshiftby1(extent); - goto round; - } + } else { + /* No further normalization is needed. */ + Dbl_set_sign(resultp1,/*using*/sign_save); + Ext_leftshiftby1(extent); + goto round; } + } /* Check for denormalized, exponent should be zero. Left * * operand was normalized, so extent (guard, round) was zero */ @@ -386,7 +382,7 @@ dbl_fsub(leftptr, rightptr, dstptr, status) return(NOEXCEPTION); } Dbl_sethigh4bits(resultp1,/*using*/sign_save); - switch(jumpsize) + switch(jumpsize) { case 1: { @@ -411,7 +407,7 @@ dbl_fsub(leftptr, rightptr, dstptr, status) break; } } - if(result_exponent > 0) + if(result_exponent > 0) { Dbl_set_exponent(resultp1,/*using*/result_exponent); Dbl_copytoptr(resultp1,resultp2,dstptr); @@ -422,12 +418,12 @@ dbl_fsub(leftptr, rightptr, dstptr, status) if(Is_underflowtrap_enabled()) { Dbl_set_sign(resultp1,sign_save); - Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); + Dbl_setwrapped_exponent(resultp1,result_exponent,unfl); Dbl_copytoptr(resultp1,resultp2,dstptr); /* inexact = FALSE */ return(UNDERFLOWEXCEPTION); } - /* + /* * Since we cannot get an inexact denormalized result, * we can now return. */ @@ -439,7 +435,7 @@ dbl_fsub(leftptr, rightptr, dstptr, status) } /* end if(hidden...)... */ /* Fall through and round */ } /* end if(save >= 0)... */ - else + else { /* Subtract magnitudes */ Dbl_addition(leftp1,leftp2,rightp1,rightp2,/*to*/resultp1,resultp2); @@ -451,7 +447,7 @@ dbl_fsub(leftptr, rightptr, dstptr, status) result_exponent++; } /* end if hiddenoverflow... */ } /* end else ...subtract 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 @@ -482,35 +478,35 @@ dbl_fsub(leftptr, rightptr, dstptr, status) Dbl_increment(resultp1,resultp2); } break; - + case ROUNDMINUS: if(Dbl_isone_sign(resultp1)) { /* Round down negative results */ Dbl_increment(resultp1,resultp2); } - + case ROUNDZERO:; /* truncate is simple */ } /* end switch... */ if(Dbl_isone_hiddenoverflow(resultp1)) result_exponent++; } if(result_exponent == DBL_INFINITY_EXPONENT) - { - /* Overflow */ - if(Is_overflowtrap_enabled()) + { + /* Overflow */ + if(Is_overflowtrap_enabled()) { Dbl_setwrapped_exponent(resultp1,result_exponent,ovfl); Dbl_copytoptr(resultp1,resultp2,dstptr); if (inexact) { - if (Is_inexacttrap_enabled()) + if (Is_inexacttrap_enabled()) return(OVERFLOWEXCEPTION | INEXACTEXCEPTION); else Set_inexactflag(); } return(OVERFLOWEXCEPTION); } - else + else { inexact = TRUE; Set_overflowflag(); diff --git a/sys/arch/hppa/spmath/divsfm.c b/sys/arch/hppa/spmath/divsfm.c index 89a395d33aa..4a999085b32 100644 --- a/sys/arch/hppa/spmath/divsfm.c +++ b/sys/arch/hppa/spmath/divsfm.c @@ -1,25 +1,25 @@ -/* $OpenBSD: divsfm.c,v 1.3 1998/07/02 19:05:09 mickey Exp $ */ +/* $OpenBSD: divsfm.c,v 1.4 2001/03/29 03:58:17 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. */ @@ -67,10 +67,10 @@ struct mdsfu_register *result; else op1_sign = FALSE; if (opnd2 < 0) opnd2 = -opnd2; - /* - * check for overflow + /* + * check for overflow * - * if abs(opnd1) < 0, then opnd1 = -2**31 + * if abs(opnd1) < 0, then opnd1 = -2**31 * and abs(opnd1) >= abs(opnd2) always */ if (opnd1 >= opnd2 || opnd1 < 0) { diff --git a/sys/arch/hppa/spmath/divsfr.c b/sys/arch/hppa/spmath/divsfr.c index c32bb32a611..972a01fe603 100644 --- a/sys/arch/hppa/spmath/divsfr.c +++ b/sys/arch/hppa/spmath/divsfr.c @@ -1,25 +1,25 @@ -/* $OpenBSD: divsfr.c,v 1.3 1998/07/02 19:05:10 mickey Exp $ */ +/* $OpenBSD: divsfr.c,v 1.4 2001/03/29 03:58:18 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. */ @@ -67,8 +67,8 @@ struct mdsfu_register *result; else op1_sign = FALSE; if (opnd2 < 0) opnd2 = -opnd2; - /* - * check for overflow + /* + * check for overflow * * if abs(opnd1) < 0, then opnd1 = -2**31 * and abs(opnd1) >= abs(opnd2) always diff --git a/sys/arch/hppa/spmath/divsim.c b/sys/arch/hppa/spmath/divsim.c index fe3a56d15e3..1f77e0f53ad 100644 --- a/sys/arch/hppa/spmath/divsim.c +++ b/sys/arch/hppa/spmath/divsim.c @@ -1,25 +1,25 @@ -/* $OpenBSD: divsim.c,v 1.3 1998/07/02 19:05:12 mickey Exp $ */ +/* $OpenBSD: divsim.c,v 1.4 2001/03/29 03:58:18 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. */ @@ -82,16 +82,16 @@ struct mdsfu_register *result; /* do the divide */ divu(0,opnd1,opnd2,result); - /* + /* * check for overflow - * - * at this point, the only way we can get overflow - * is with opnd1 = -2**31 and opnd2 = -1 - */ - if (sign>0 && result_lo<0) { - overflow = TRUE; - return; - } + * + * at this point, the only way we can get overflow + * is with opnd1 = -2**31 and opnd2 = -1 + */ + if (sign>0 && result_lo<0) { + overflow = TRUE; + return; + } } overflow = FALSE; diff --git a/sys/arch/hppa/spmath/divsir.c b/sys/arch/hppa/spmath/divsir.c index 635521d4a57..24715b170be 100644 --- a/sys/arch/hppa/spmath/divsir.c +++ b/sys/arch/hppa/spmath/divsir.c @@ -1,25 +1,25 @@ -/* $OpenBSD: divsir.c,v 1.4 1998/07/02 19:10:50 mickey Exp $ */ +/* $OpenBSD: divsir.c,v 1.5 2001/03/29 03:58:18 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. */ @@ -82,8 +82,8 @@ struct mdsfu_register *result; /* do the divide */ divu(0,opnd1,opnd2,result); - /* - * check for overflow + /* + * check for overflow * * at this point, the only way we can get overflow * is with opnd1 = -2**31 and opnd2 = -1 diff --git a/sys/arch/hppa/spmath/divu.S b/sys/arch/hppa/spmath/divu.S index 7566a39d58a..402f6a31a35 100644 --- a/sys/arch/hppa/spmath/divu.S +++ b/sys/arch/hppa/spmath/divu.S @@ -1,25 +1,25 @@ -/* $OpenBSD: divu.S,v 1.4 2001/03/28 23:55:59 mickey Exp $ */ +/* $OpenBSD: divu.S,v 1.5 2001/03/29 03:58:18 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,22 +27,22 @@ /* * (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. */ #include <machine/asm.h> /************************************************************************** - * Implement an integer divide routine for 32-bit operands and 32-bit quotient + * Implement an integer divide routine for 32-bit operands and 32-bit quotient * and remainder with operand values of zero (divisor only) treated specially. * ***************************************************************************/ @@ -144,9 +144,9 @@ ENTRY(divu) ; ; end of divide routine ; -finish stws rem,0(arg3) ; save remainder in high part +finish stws rem,0(arg3) ; save remainder in high part ; of result - stws quo,4(arg3) ; save quotient in low part + stws quo,4(arg3) ; save quotient in low part ; of result ldws,mb -4(sp),tp ; restore registers ldws,mb -4(sp),dvr ; restore registers @@ -166,7 +166,7 @@ nosub addi 0,0,0 ; otherwise clear carry addib,> -1,tp,loop ; inc. counter; finished? addc quo,quo,quo ; shift bit of result into dvdl b finish+4 ; finish up - stws rem,0(arg3) ; save remainder in high part + stws rem,0(arg3) ; save remainder in high part ; of result EXIT(divu) diff --git a/sys/arch/hppa/spmath/divufr.c b/sys/arch/hppa/spmath/divufr.c index dc33ec35fbd..2ba867130e7 100644 --- a/sys/arch/hppa/spmath/divufr.c +++ b/sys/arch/hppa/spmath/divufr.c @@ -1,25 +1,25 @@ -/* $OpenBSD: divufr.c,v 1.4 1998/07/02 19:10:52 mickey Exp $ */ +/* $OpenBSD: divufr.c,v 1.5 2001/03/29 03:58:18 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. */ diff --git a/sys/arch/hppa/spmath/divuir.c b/sys/arch/hppa/spmath/divuir.c index 360d3a67c10..42b56306b3d 100644 --- a/sys/arch/hppa/spmath/divuir.c +++ b/sys/arch/hppa/spmath/divuir.c @@ -1,25 +1,25 @@ -/* $OpenBSD: divuir.c,v 1.4 1998/07/02 19:10:53 mickey Exp $ */ +/* $OpenBSD: divuir.c,v 1.5 2001/03/29 03:58:18 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. */ diff --git a/sys/arch/hppa/spmath/fcnvff.c b/sys/arch/hppa/spmath/fcnvff.c index 69be58d011b..3d9ba849bb8 100644 --- a/sys/arch/hppa/spmath/fcnvff.c +++ b/sys/arch/hppa/spmath/fcnvff.c @@ -1,25 +1,25 @@ -/* $OpenBSD: fcnvff.c,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: fcnvff.c,v 1.5 2001/03/29 03:58:18 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. */ @@ -45,7 +45,7 @@ #include "../spmath/cnv_float.h" /* - * Single Floating-point to Double Floating-point + * Single Floating-point to Double Floating-point */ /*ARGSUSED*/ int @@ -61,9 +61,9 @@ unsigned int *status; src = *srcptr; src_exponent = Sgl_exponent(src); Dbl_allp1(resultp1) = Sgl_all(src); /* set sign of result */ - /* - * Test for NaN or infinity - */ + /* + * Test for NaN or infinity + */ if (src_exponent == SGL_INFINITY_EXPONENT) { /* * determine if NaN or infinity @@ -77,7 +77,7 @@ unsigned int *status; return(NOEXCEPTION); } else { - /* + /* * is NaN; signaling or quiet? */ if (Sgl_isone_signaling(src)) { @@ -90,8 +90,8 @@ unsigned int *status; Sgl_set_quiet(src); } } - /* - * NaN is quiet, return as double NaN + /* + * NaN is quiet, return as double NaN */ Dbl_setinfinity_exponent(resultp1); Sgl_to_dbl_mantissa(src,resultp1,resultp2); @@ -99,9 +99,9 @@ unsigned int *status; return(NOEXCEPTION); } } - /* - * Test for zero or denormalized - */ + /* + * Test for zero or denormalized + */ if (src_exponent == 0) { /* * determine if zero or denormalized @@ -132,7 +132,7 @@ unsigned int *status; } /* - * Double Floating-point to Single Floating-point + * Double Floating-point to Single Floating-point */ /*ARGSUSED*/ int @@ -142,57 +142,57 @@ dbl_floating_point *srcptr; sgl_floating_point *dstptr; unsigned int *status; { - register unsigned int srcp1, srcp2, result; - register int src_exponent, dest_exponent, dest_mantissa; - register boolean inexact = FALSE, guardbit = FALSE, stickybit = FALSE; - register boolean lsb_odd = FALSE; - boolean is_tiny; + register unsigned int srcp1, srcp2, result; + register int src_exponent, dest_exponent, dest_mantissa; + register int inexact = FALSE, guardbit = FALSE, stickybit = FALSE; + register int lsb_odd = FALSE; + int is_tiny; Dbl_copyfromptr(srcptr,srcp1,srcp2); - src_exponent = Dbl_exponent(srcp1); + src_exponent = Dbl_exponent(srcp1); Sgl_all(result) = Dbl_allp1(srcp1); /* set sign of result */ - /* - * Test for NaN or infinity - */ - if (src_exponent == DBL_INFINITY_EXPONENT) { - /* - * determine if NaN or infinity - */ - if (Dbl_iszero_mantissa(srcp1,srcp2)) { - /* - * is infinity; want to return single infinity - */ - Sgl_setinfinity_exponentmantissa(result); - *dstptr = result; - return(NOEXCEPTION); - } - /* - * is NaN; signaling or quiet? - */ - if (Dbl_isone_signaling(srcp1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - else { + /* + * Test for NaN or infinity + */ + if (src_exponent == DBL_INFINITY_EXPONENT) { + /* + * determine if NaN or infinity + */ + if (Dbl_iszero_mantissa(srcp1,srcp2)) { + /* + * is infinity; want to return single infinity + */ + Sgl_setinfinity_exponentmantissa(result); + *dstptr = result; + return(NOEXCEPTION); + } + /* + * is NaN; signaling or quiet? + */ + if (Dbl_isone_signaling(srcp1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + else { Set_invalidflag(); - /* make NaN quiet */ - Dbl_set_quiet(srcp1); + /* make NaN quiet */ + Dbl_set_quiet(srcp1); } - } - /* - * NaN is quiet, return as single NaN - */ - Sgl_setinfinity_exponent(result); + } + /* + * NaN is quiet, return as single NaN + */ + Sgl_setinfinity_exponent(result); Sgl_set_mantissa(result,Dallp1(srcp1)<<3 | Dallp2(srcp2)>>29); if (Sgl_iszero_mantissa(result)) Sgl_set_quiet(result); - *dstptr = result; - return(NOEXCEPTION); - } - /* - * Generate result - */ - Dbl_to_sgl_exponent(src_exponent,dest_exponent); + *dstptr = result; + return(NOEXCEPTION); + } + /* + * Generate result + */ + Dbl_to_sgl_exponent(src_exponent,dest_exponent); if (dest_exponent > 0) { - Dbl_to_sgl_mantissa(srcp1,srcp2,dest_mantissa,inexact,guardbit, + Dbl_to_sgl_mantissa(srcp1,srcp2,dest_mantissa,inexact,guardbit, stickybit,lsb_odd); } else { @@ -201,10 +201,10 @@ unsigned int *status; *dstptr = result; return(NOEXCEPTION); } - if (Is_underflowtrap_enabled()) { + if (Is_underflowtrap_enabled()) { Dbl_to_sgl_mantissa(srcp1,srcp2,dest_mantissa,inexact, guardbit,stickybit,lsb_odd); - } + } else { /* compute result, determine inexact info, * and set Underflowflag if appropriate @@ -214,46 +214,46 @@ unsigned int *status; is_tiny); } } - /* - * Now round result if not exact - */ - if (inexact) { - switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(result)) dest_mantissa++; - break; - case ROUNDMINUS: - if (Sgl_isone_sign(result)) dest_mantissa++; - break; - case ROUNDNEAREST: - if (guardbit) { - if (stickybit || lsb_odd) dest_mantissa++; - } - } - } - Sgl_set_exponentmantissa(result,dest_mantissa); + /* + * Now round result if not exact + */ + if (inexact) { + switch (Rounding_mode()) { + case ROUNDPLUS: + if (Sgl_iszero_sign(result)) dest_mantissa++; + break; + case ROUNDMINUS: + if (Sgl_isone_sign(result)) dest_mantissa++; + break; + case ROUNDNEAREST: + if (guardbit) { + if (stickybit || lsb_odd) dest_mantissa++; + } + } + } + Sgl_set_exponentmantissa(result,dest_mantissa); - /* - * check for mantissa overflow after rounding - */ - if ((dest_exponent>0 || Is_underflowtrap_enabled()) && + /* + * check for mantissa overflow after rounding + */ + if ((dest_exponent>0 || Is_underflowtrap_enabled()) && Sgl_isone_hidden(result)) dest_exponent++; - /* - * Test for overflow - */ - if (dest_exponent >= SGL_INFINITY_EXPONENT) { - /* trap if OVERFLOWTRAP enabled */ - if (Is_overflowtrap_enabled()) { - /* - * Check for gross overflow - */ - if (dest_exponent >= SGL_INFINITY_EXPONENT+SGL_WRAP) - return(UNIMPLEMENTEDEXCEPTION); - - /* - * Adjust bias of result - */ + /* + * Test for overflow + */ + if (dest_exponent >= SGL_INFINITY_EXPONENT) { + /* trap if OVERFLOWTRAP enabled */ + if (Is_overflowtrap_enabled()) { + /* + * Check for gross overflow + */ + if (dest_exponent >= SGL_INFINITY_EXPONENT+SGL_WRAP) + return(UNIMPLEMENTEDEXCEPTION); + + /* + * Adjust bias of result + */ Sgl_setwrapped_exponent(result,dest_exponent,ovfl); *dstptr = result; if (inexact) { @@ -262,27 +262,27 @@ unsigned int *status; else Set_inexactflag(); } - return(OVERFLOWEXCEPTION); - } - Set_overflowflag(); + return(OVERFLOWEXCEPTION); + } + Set_overflowflag(); inexact = TRUE; /* set result to infinity or largest number */ Sgl_setoverflow(result); - } - /* - * Test for underflow - */ - else if (dest_exponent <= 0) { - /* trap if UNDERFLOWTRAP enabled */ - if (Is_underflowtrap_enabled()) { - /* - * Check for gross underflow - */ - if (dest_exponent <= -(SGL_WRAP)) - return(UNIMPLEMENTEDEXCEPTION); - /* - * Adjust bias of result - */ + } + /* + * Test for underflow + */ + else if (dest_exponent <= 0) { + /* trap if UNDERFLOWTRAP enabled */ + if (Is_underflowtrap_enabled()) { + /* + * Check for gross underflow + */ + if (dest_exponent <= -(SGL_WRAP)) + return(UNIMPLEMENTEDEXCEPTION); + /* + * Adjust bias of result + */ Sgl_setwrapped_exponent(result,dest_exponent,unfl); *dstptr = result; if (inexact) { @@ -291,22 +291,24 @@ unsigned int *status; else Set_inexactflag(); } - return(UNDERFLOWEXCEPTION); - } - /* - * result is denormalized or signed zero - */ - if (inexact && is_tiny) Set_underflowflag(); + return(UNDERFLOWEXCEPTION); + } + /* + * result is denormalized or signed zero + */ + if (inexact && is_tiny) Set_underflowflag(); - } + } else Sgl_set_exponent(result,dest_exponent); *dstptr = result; - /* - * Trap if inexact trap is enabled - */ - if (inexact) { - if (Is_inexacttrap_enabled()) return(INEXACTEXCEPTION); - else Set_inexactflag(); + /* + * Trap if inexact trap is enabled + */ + if (inexact) { + if (Is_inexacttrap_enabled()) + return(INEXACTEXCEPTION); + else + Set_inexactflag(); } - return(NOEXCEPTION); + return(NOEXCEPTION); } diff --git a/sys/arch/hppa/spmath/fcnvfx.c b/sys/arch/hppa/spmath/fcnvfx.c index 3a5e86a9198..c646d8dffaa 100644 --- a/sys/arch/hppa/spmath/fcnvfx.c +++ b/sys/arch/hppa/spmath/fcnvfx.c @@ -1,25 +1,25 @@ -/* $OpenBSD: fcnvfx.c,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: fcnvfx.c,v 1.5 2001/03/29 03:58:18 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. */ @@ -45,7 +45,7 @@ #include "../spmath/cnv_float.h" /* - * Single Floating-point to Single Fixed-point + * Single Floating-point to Single Fixed-point */ /*ARGSUSED*/ int @@ -57,23 +57,23 @@ unsigned int *status; { register unsigned int src, temp; register int src_exponent, result; - register boolean inexact = FALSE; + register int inexact = FALSE; src = *srcptr; src_exponent = Sgl_exponent(src) - SGL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > SGL_FX_MAX_EXP) { /* check for MININT */ - if ((src_exponent > SGL_FX_MAX_EXP + 1) || + if ((src_exponent > SGL_FX_MAX_EXP + 1) || Sgl_isnotzero_mantissa(src) || Sgl_iszero_sign(src)) { - /* - * Since source is a number which cannot be + /* + * Since source is a number which cannot be * represented in fixed-point format, return * largest (or smallest) fixed-point number. - */ + */ Sgl_return_overflow(src,dstptr); } } @@ -100,13 +100,13 @@ unsigned int *status; break; case ROUNDNEAREST: if (Sgl_isone_roundbit(src,src_exponent)) { - if (Sgl_isone_stickybit(src,src_exponent) + if (Sgl_isone_stickybit(src,src_exponent) || (Sgl_isone_lowmantissa(temp))) { - if (Sgl_iszero_sign(src)) result++; - else result--; + if (Sgl_iszero_sign(src)) result++; + else result--; } } - } + } } } else { @@ -125,11 +125,11 @@ unsigned int *status; break; case ROUNDNEAREST: if (src_exponent == -1) - if (Sgl_isnotzero_mantissa(src)) { - if (Sgl_iszero_sign(src)) result++; - else result--; + if (Sgl_isnotzero_mantissa(src)) { + if (Sgl_iszero_sign(src)) result++; + else result--; } - } + } } } *dstptr = result; @@ -141,7 +141,7 @@ unsigned int *status; } /* - * Single Floating-point to Double Fixed-point + * Single Floating-point to Double Fixed-point */ /*ARGSUSED*/ int @@ -153,23 +153,23 @@ unsigned int *status; { register int src_exponent, resultp1; register unsigned int src, temp, resultp2; - register boolean inexact = FALSE; + register int inexact = FALSE; src = *srcptr; src_exponent = Sgl_exponent(src) - SGL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > DBL_FX_MAX_EXP) { /* check for MININT */ - if ((src_exponent > DBL_FX_MAX_EXP + 1) || + if ((src_exponent > DBL_FX_MAX_EXP + 1) || Sgl_isnotzero_mantissa(src) || Sgl_iszero_sign(src)) { - /* - * Since source is a number which cannot be + /* + * Since source is a number which cannot be * represented in fixed-point format, return * largest (or smallest) fixed-point number. - */ + */ Sgl_return_overflow_dbl(src,dstptr); } Dint_set_minint(resultp1,resultp2); @@ -190,57 +190,57 @@ unsigned int *status; /* check for inexact */ if (Sgl_isinexact_to_fix(src,src_exponent)) { inexact = TRUE; - /* round result */ - switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(src)) { + /* round result */ + switch (Rounding_mode()) { + case ROUNDPLUS: + if (Sgl_iszero_sign(src)) { Dint_increment(resultp1,resultp2); } - break; - case ROUNDMINUS: - if (Sgl_isone_sign(src)) { + break; + case ROUNDMINUS: + if (Sgl_isone_sign(src)) { Dint_decrement(resultp1,resultp2); } - break; - case ROUNDNEAREST: - if (Sgl_isone_roundbit(src,src_exponent)) - if (Sgl_isone_stickybit(src,src_exponent) || + break; + case ROUNDNEAREST: + if (Sgl_isone_roundbit(src,src_exponent)) + if (Sgl_isone_stickybit(src,src_exponent) || (Dint_isone_lowp2(resultp2))) { if (Sgl_iszero_sign(src)) { Dint_increment(resultp1,resultp2); } - else { + else { Dint_decrement(resultp1,resultp2); } } - } - } - } + } + } + } else { Dint_setzero(resultp1,resultp2); /* check for inexact */ if (Sgl_isnotzero_exponentmantissa(src)) { inexact = TRUE; - /* round result */ - switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(src)) { + /* round result */ + switch (Rounding_mode()) { + case ROUNDPLUS: + if (Sgl_iszero_sign(src)) { Dint_increment(resultp1,resultp2); } - break; - case ROUNDMINUS: - if (Sgl_isone_sign(src)) { + break; + case ROUNDMINUS: + if (Sgl_isone_sign(src)) { Dint_decrement(resultp1,resultp2); } - break; - case ROUNDNEAREST: - if (src_exponent == -1) - if (Sgl_isnotzero_mantissa(src)) { - if (Sgl_iszero_sign(src)) { + break; + case ROUNDNEAREST: + if (src_exponent == -1) + if (Sgl_isnotzero_mantissa(src)) { + if (Sgl_iszero_sign(src)) { Dint_increment(resultp1,resultp2); } - else { + else { Dint_decrement(resultp1,resultp2); } } @@ -256,7 +256,7 @@ unsigned int *status; } /* - * Double Floating-point to Single Fixed-point + * Double Floating-point to Single Fixed-point */ /*ARGSUSED*/ int @@ -268,19 +268,19 @@ unsigned int *status; { register unsigned int srcp1,srcp2, tempp1,tempp2; register int src_exponent, result; - register boolean inexact = FALSE; + register int inexact = FALSE; Dbl_copyfromptr(srcptr,srcp1,srcp2); src_exponent = Dbl_exponent(srcp1) - DBL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > SGL_FX_MAX_EXP) { /* check for MININT */ if (Dbl_isoverflow_to_int(src_exponent,srcp1,srcp2)) { - /* - * Since source is a number which cannot be + /* + * Since source is a number which cannot be * represented in fixed-point format, return * largest (or smallest) fixed-point number. */ @@ -301,63 +301,63 @@ unsigned int *status; /* check for inexact */ if (Dbl_isinexact_to_fix(srcp1,srcp2,src_exponent)) { - inexact = TRUE; - /* round result */ - switch (Rounding_mode()) { - case ROUNDPLUS: - if (Dbl_iszero_sign(srcp1)) result++; - break; - case ROUNDMINUS: - if (Dbl_isone_sign(srcp1)) result--; - break; - case ROUNDNEAREST: - if (Dbl_isone_roundbit(srcp1,srcp2,src_exponent)) - if (Dbl_isone_stickybit(srcp1,srcp2,src_exponent) || + inexact = TRUE; + /* round result */ + switch (Rounding_mode()) { + case ROUNDPLUS: + if (Dbl_iszero_sign(srcp1)) result++; + break; + case ROUNDMINUS: + if (Dbl_isone_sign(srcp1)) result--; + break; + case ROUNDNEAREST: + if (Dbl_isone_roundbit(srcp1,srcp2,src_exponent)) + if (Dbl_isone_stickybit(srcp1,srcp2,src_exponent) || (Dbl_isone_lowmantissap1(tempp1))) { - if (Dbl_iszero_sign(srcp1)) result++; - else result--; + if (Dbl_iszero_sign(srcp1)) result++; + else result--; } - } + } /* check for overflow */ if ((Dbl_iszero_sign(srcp1) && result < 0) || (Dbl_isone_sign(srcp1) && result > 0)) { Dbl_return_overflow(srcp1,srcp2,dstptr); } - } + } } else { result = 0; /* check for inexact */ if (Dbl_isnotzero_exponentmantissa(srcp1,srcp2)) { - inexact = TRUE; - /* round result */ - switch (Rounding_mode()) { - case ROUNDPLUS: - if (Dbl_iszero_sign(srcp1)) result++; - break; - case ROUNDMINUS: - if (Dbl_isone_sign(srcp1)) result--; - break; - case ROUNDNEAREST: - if (src_exponent == -1) - if (Dbl_isnotzero_mantissa(srcp1,srcp2)) { - if (Dbl_iszero_sign(srcp1)) result++; - else result--; + inexact = TRUE; + /* round result */ + switch (Rounding_mode()) { + case ROUNDPLUS: + if (Dbl_iszero_sign(srcp1)) result++; + break; + case ROUNDMINUS: + if (Dbl_isone_sign(srcp1)) result--; + break; + case ROUNDNEAREST: + if (src_exponent == -1) + if (Dbl_isnotzero_mantissa(srcp1,srcp2)) { + if (Dbl_iszero_sign(srcp1)) result++; + else result--; } } - } + } } *dstptr = result; - if (inexact) { - if (Is_inexacttrap_enabled()) return(INEXACTEXCEPTION); + if (inexact) { + if (Is_inexacttrap_enabled()) return(INEXACTEXCEPTION); else Set_inexactflag(); - } + } return(NOEXCEPTION); } /* - * Double Floating-point to Double Fixed-point + * Double Floating-point to Double Fixed-point */ /*ARGSUSED*/ int @@ -369,27 +369,27 @@ unsigned int *status; { register int src_exponent, resultp1; register unsigned int srcp1, srcp2, tempp1, tempp2, resultp2; - register boolean inexact = FALSE; + register int inexact = FALSE; Dbl_copyfromptr(srcptr,srcp1,srcp2); src_exponent = Dbl_exponent(srcp1) - DBL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > DBL_FX_MAX_EXP) { /* check for MININT */ - if ((src_exponent > DBL_FX_MAX_EXP + 1) || + if ((src_exponent > DBL_FX_MAX_EXP + 1) || Dbl_isnotzero_mantissa(srcp1,srcp2) || Dbl_iszero_sign(srcp1)) { - /* - * Since source is a number which cannot be + /* + * Since source is a number which cannot be * represented in fixed-point format, return * largest (or smallest) fixed-point number. - */ + */ Dbl_return_overflow_dbl(srcp1,srcp2,dstptr); } } - + /* * Generate result */ @@ -405,68 +405,68 @@ unsigned int *status; /* check for inexact */ if (Dbl_isinexact_to_fix(srcp1,srcp2,src_exponent)) { - inexact = TRUE; - /* round result */ - switch (Rounding_mode()) { - case ROUNDPLUS: - if (Dbl_iszero_sign(srcp1)) { + inexact = TRUE; + /* round result */ + switch (Rounding_mode()) { + case ROUNDPLUS: + if (Dbl_iszero_sign(srcp1)) { Dint_increment(resultp1,resultp2); } - break; - case ROUNDMINUS: - if (Dbl_isone_sign(srcp1)) { + break; + case ROUNDMINUS: + if (Dbl_isone_sign(srcp1)) { Dint_decrement(resultp1,resultp2); } - break; - case ROUNDNEAREST: - if (Dbl_isone_roundbit(srcp1,srcp2,src_exponent)) - if (Dbl_isone_stickybit(srcp1,srcp2,src_exponent) || + break; + case ROUNDNEAREST: + if (Dbl_isone_roundbit(srcp1,srcp2,src_exponent)) + if (Dbl_isone_stickybit(srcp1,srcp2,src_exponent) || (Dint_isone_lowp2(resultp2))) { - if (Dbl_iszero_sign(srcp1)) { + if (Dbl_iszero_sign(srcp1)) { Dint_increment(resultp1,resultp2); } - else { + else { Dint_decrement(resultp1,resultp2); } } - } - } + } + } } else { Dint_setzero(resultp1,resultp2); /* check for inexact */ if (Dbl_isnotzero_exponentmantissa(srcp1,srcp2)) { - inexact = TRUE; - /* round result */ - switch (Rounding_mode()) { - case ROUNDPLUS: - if (Dbl_iszero_sign(srcp1)) { + inexact = TRUE; + /* round result */ + switch (Rounding_mode()) { + case ROUNDPLUS: + if (Dbl_iszero_sign(srcp1)) { Dint_increment(resultp1,resultp2); } - break; - case ROUNDMINUS: - if (Dbl_isone_sign(srcp1)) { + break; + case ROUNDMINUS: + if (Dbl_isone_sign(srcp1)) { Dint_decrement(resultp1,resultp2); } - break; - case ROUNDNEAREST: - if (src_exponent == -1) - if (Dbl_isnotzero_mantissa(srcp1,srcp2)) { - if (Dbl_iszero_sign(srcp1)) { + break; + case ROUNDNEAREST: + if (src_exponent == -1) + if (Dbl_isnotzero_mantissa(srcp1,srcp2)) { + if (Dbl_iszero_sign(srcp1)) { Dint_increment(resultp1,resultp2); } - else { + else { Dint_decrement(resultp1,resultp2); - } + } } } - } + } } Dint_copytoptr(resultp1,resultp2,dstptr); - if (inexact) { - if (Is_inexacttrap_enabled()) return(INEXACTEXCEPTION); - else Set_inexactflag(); - } + if (inexact) { + if (Is_inexacttrap_enabled()) return(INEXACTEXCEPTION); + else Set_inexactflag(); + } return(NOEXCEPTION); } diff --git a/sys/arch/hppa/spmath/fcnvfxt.c b/sys/arch/hppa/spmath/fcnvfxt.c index 3ccb7bc8006..e20be8b112a 100644 --- a/sys/arch/hppa/spmath/fcnvfxt.c +++ b/sys/arch/hppa/spmath/fcnvfxt.c @@ -1,25 +1,25 @@ -/* $OpenBSD: fcnvfxt.c,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: fcnvfxt.c,v 1.5 2001/03/29 03:58:18 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. */ @@ -62,18 +62,18 @@ unsigned int *status; src = *srcptr; src_exponent = Sgl_exponent(src) - SGL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > SGL_FX_MAX_EXP) { /* check for MININT */ - if ((src_exponent > SGL_FX_MAX_EXP + 1) || + if ((src_exponent > SGL_FX_MAX_EXP + 1) || Sgl_isnotzero_mantissa(src) || Sgl_iszero_sign(src)) { - /* - * Since source is a number which cannot be + /* + * Since source is a number which cannot be * represented in fixed-point format, return * largest (or smallest) fixed-point number. - */ + */ Sgl_return_overflow(src,dstptr); } } @@ -107,7 +107,7 @@ unsigned int *status; } /* - * Single Floating-point to Double Fixed-point + * Single Floating-point to Double Fixed-point */ /*ARGSUSED*/ int @@ -123,18 +123,18 @@ unsigned int *status; src = *srcptr; src_exponent = Sgl_exponent(src) - SGL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > DBL_FX_MAX_EXP) { /* check for MININT */ - if ((src_exponent > DBL_FX_MAX_EXP + 1) || + if ((src_exponent > DBL_FX_MAX_EXP + 1) || Sgl_isnotzero_mantissa(src) || Sgl_iszero_sign(src)) { - /* - * Since source is a number which cannot be + /* + * Since source is a number which cannot be * represented in fixed-point format, return * largest (or smallest) fixed-point number. - */ + */ Sgl_return_overflow_dbl(src,dstptr); } Dint_set_minint(resultp1,resultp2); @@ -173,7 +173,7 @@ unsigned int *status; } /* - * Double Floating-point to Single Fixed-point + * Double Floating-point to Single Fixed-point */ /*ARGSUSED*/ int @@ -189,7 +189,7 @@ unsigned int *status; Dbl_copyfromptr(srcptr,srcp1,srcp2); src_exponent = Dbl_exponent(srcp1) - DBL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > SGL_FX_MAX_EXP) { @@ -230,7 +230,7 @@ unsigned int *status; } /* - * Double Floating-point to Double Fixed-point + * Double Floating-point to Double Fixed-point */ /*ARGSUSED*/ int @@ -246,18 +246,18 @@ unsigned int *status; Dbl_copyfromptr(srcptr,srcp1,srcp2); src_exponent = Dbl_exponent(srcp1) - DBL_BIAS; - /* + /* * Test for overflow */ if (src_exponent > DBL_FX_MAX_EXP) { /* check for MININT */ - if ((src_exponent > DBL_FX_MAX_EXP + 1) || + if ((src_exponent > DBL_FX_MAX_EXP + 1) || Dbl_isnotzero_mantissa(srcp1,srcp2) || Dbl_iszero_sign(srcp1)) { - /* - * Since source is a number which cannot be + /* + * Since source is a number which cannot be * represented in fixed-point format, return * largest (or smallest) fixed-point number. - */ + */ Dbl_return_overflow_dbl(srcp1,srcp2,dstptr); } } diff --git a/sys/arch/hppa/spmath/fcnvxf.c b/sys/arch/hppa/spmath/fcnvxf.c index 7728aedaf9c..d80705e8ee0 100644 --- a/sys/arch/hppa/spmath/fcnvxf.c +++ b/sys/arch/hppa/spmath/fcnvxf.c @@ -1,25 +1,25 @@ -/* $OpenBSD: fcnvxf.c,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: fcnvxf.c,v 1.5 2001/03/29 03:58:18 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. */ @@ -58,21 +58,21 @@ unsigned int *status; register unsigned int result = 0; src = *srcptr; - /* - * set sign bit of result and get magnitude of source + /* + * set sign bit of result and get magnitude of source */ if (src < 0) { - Sgl_setone_sign(result); + Sgl_setone_sign(result); Int_negate(src); } else { Sgl_setzero_sign(result); - /* Check for zero */ - if (src == 0) { - Sgl_setzero(result); + /* Check for zero */ + if (src == 0) { + Sgl_setzero(result); *dstptr = result; - return(NOEXCEPTION); - } + return(NOEXCEPTION); + } } /* * Generate exponent and normalized mantissa @@ -93,12 +93,12 @@ unsigned int *status; /* check for inexact */ if (Int_isinexact_to_sgl(src)) { switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(result)) + case ROUNDPLUS: + if (Sgl_iszero_sign(result)) Sgl_increment(result); break; - case ROUNDMINUS: - if (Sgl_isone_sign(result)) + case ROUNDMINUS: + if (Sgl_isone_sign(result)) Sgl_increment(result); break; case ROUNDNEAREST: @@ -115,7 +115,7 @@ unsigned int *status; } /* - * Single Fixed-point to Double Floating-point + * Single Fixed-point to Double Floating-point */ int sgl_to_dbl_fcnvxf(srcptr,dstptr,status) @@ -128,21 +128,21 @@ unsigned int *status; register unsigned int resultp1 = 0, resultp2 = 0; src = *srcptr; - /* - * set sign bit of result and get magnitude of source + /* + * set sign bit of result and get magnitude of source */ if (src < 0) { - Dbl_setone_sign(resultp1); + Dbl_setone_sign(resultp1); Int_negate(src); } else { Dbl_setzero_sign(resultp1); - /* Check for zero */ - if (src == 0) { - Dbl_setzero(resultp1,resultp2); - Dbl_copytoptr(resultp1,resultp2,dstptr); - return(NOEXCEPTION); - } + /* Check for zero */ + if (src == 0) { + Dbl_setzero(resultp1,resultp2); + Dbl_copytoptr(resultp1,resultp2,dstptr); + return(NOEXCEPTION); + } } /* * Generate exponent and normalized mantissa @@ -165,7 +165,7 @@ unsigned int *status; } /* - * Double Fixed-point to Single Floating-point + * Double Fixed-point to Single Floating-point */ int dbl_to_sgl_fcnvxf(srcptr,dstptr,status) @@ -178,22 +178,22 @@ unsigned int *status; unsigned int result = 0, srcp2; Dint_copyfromptr(srcptr,srcp1,srcp2); - /* - * set sign bit of result and get magnitude of source + /* + * set sign bit of result and get magnitude of source */ if (srcp1 < 0) { - Sgl_setone_sign(result); + Sgl_setone_sign(result); Dint_negate(srcp1,srcp2); } else { Sgl_setzero_sign(result); - /* Check for zero */ - if (srcp1 == 0 && srcp2 == 0) { - Sgl_setzero(result); - *dstptr = result; - return(NOEXCEPTION); + /* Check for zero */ + if (srcp1 == 0 && srcp2 == 0) { + Sgl_setzero(result); + *dstptr = result; + return(NOEXCEPTION); } - } + } /* * Generate exponent and normalized mantissa */ @@ -207,15 +207,15 @@ unsigned int *status; Find_ms_one_bit(srcp2,dst_exponent); /* left justify source, with msb at bit position 1 */ if (dst_exponent >= 0) { - srcp1 = srcp2 << dst_exponent; + srcp1 = srcp2 << dst_exponent; srcp2 = 0; } else { srcp1 = srcp2 >> 1; - srcp2 <<= 31; + srcp2 <<= 31; } /* - * since msb set is in second word, need to + * since msb set is in second word, need to * adjust bit position count */ dst_exponent += 32; @@ -231,12 +231,12 @@ unsigned int *status; /* left justify source, with msb at bit position 1 */ if (dst_exponent > 0) { Variable_shift_double(srcp1,srcp2,(32-dst_exponent), - srcp1); + srcp1); srcp2 <<= dst_exponent; } /* * If dst_exponent = 0, we don't need to shift anything. - * If dst_exponent = -1, src = - 2**63 so we won't need to + * If dst_exponent = -1, src = - 2**63 so we won't need to * shift srcp2. */ else srcp1 >>= -(dst_exponent); @@ -247,12 +247,12 @@ unsigned int *status; /* check for inexact */ if (Dint_isinexact_to_sgl(srcp1,srcp2)) { switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(result)) + case ROUNDPLUS: + if (Sgl_iszero_sign(result)) Sgl_increment(result); break; - case ROUNDMINUS: - if (Sgl_isone_sign(result)) + case ROUNDMINUS: + if (Sgl_isone_sign(result)) Sgl_increment(result); break; case ROUNDNEAREST: @@ -269,7 +269,7 @@ unsigned int *status; } /* - * Double Fixed-point to Double Floating-point + * Double Fixed-point to Double Floating-point */ int dbl_to_dbl_fcnvxf(srcptr,dstptr,status) @@ -282,8 +282,8 @@ unsigned int *status; register unsigned int srcp2, resultp1 = 0, resultp2 = 0; Dint_copyfromptr(srcptr,srcp1,srcp2); - /* - * set sign bit of result and get magnitude of source + /* + * set sign bit of result and get magnitude of source */ if (srcp1 < 0) { Dbl_setone_sign(resultp1); @@ -291,13 +291,13 @@ unsigned int *status; } else { Dbl_setzero_sign(resultp1); - /* Check for zero */ - if (srcp1 == 0 && srcp2 ==0) { - Dbl_setzero(resultp1,resultp2); - Dbl_copytoptr(resultp1,resultp2,dstptr); - return(NOEXCEPTION); + /* Check for zero */ + if (srcp1 == 0 && srcp2 ==0) { + Dbl_setzero(resultp1,resultp2); + Dbl_copytoptr(resultp1,resultp2,dstptr); + return(NOEXCEPTION); } - } + } /* * Generate exponent and normalized mantissa */ @@ -311,7 +311,7 @@ unsigned int *status; Find_ms_one_bit(srcp2,dst_exponent); /* left justify source, with msb at bit position 1 */ if (dst_exponent >= 0) { - srcp1 = srcp2 << dst_exponent; + srcp1 = srcp2 << dst_exponent; srcp2 = 0; } else { @@ -319,7 +319,7 @@ unsigned int *status; srcp2 <<= 31; } /* - * since msb set is in second word, need to + * since msb set is in second word, need to * adjust bit position count */ dst_exponent += 32; @@ -334,12 +334,12 @@ unsigned int *status; /* left justify source, with msb at bit position 1 */ if (dst_exponent > 0) { Variable_shift_double(srcp1,srcp2,(32-dst_exponent), - srcp1); + srcp1); srcp2 <<= dst_exponent; } /* * If dst_exponent = 0, we don't need to shift anything. - * If dst_exponent = -1, src = - 2**63 so we won't need to + * If dst_exponent = -1, src = - 2**63 so we won't need to * shift srcp2. */ else srcp1 >>= -(dst_exponent); @@ -351,12 +351,12 @@ unsigned int *status; /* check for inexact */ if (Dint_isinexact_to_dbl(srcp2)) { switch (Rounding_mode()) { - case ROUNDPLUS: + case ROUNDPLUS: if (Dbl_iszero_sign(resultp1)) { Dbl_increment(resultp1,resultp2); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Dbl_isone_sign(resultp1)) { Dbl_increment(resultp1,resultp2); } diff --git a/sys/arch/hppa/spmath/float.h b/sys/arch/hppa/spmath/float.h index 6776a1132ab..a84651605a6 100644 --- a/sys/arch/hppa/spmath/float.h +++ b/sys/arch/hppa/spmath/float.h @@ -1,24 +1,24 @@ -/* $OpenBSD: float.h,v 1.3 1998/07/02 19:05:26 mickey Exp $ */ +/* $OpenBSD: float.h,v 1.4 2001/03/29 03:58:18 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 @@ -26,26 +26,28 @@ /* * (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. */ +#include <machine/float.h> + #include "../spmath/fpbits.h" #include "../spmath/hppa.h" /* * Declare the basic structures for the 3 different * floating-point precisions. - * - * Single number + * + * Single number * +-------+-------+-------+-------+-------+-------+-------+-------+ * |s| exp | mantissa | * +-------+-------+-------+-------+-------+-------+-------+-------+ @@ -97,7 +99,7 @@ #define Is_sbit30(object) Bitfield_mask( 30, 1,object) #define Is_sbit31(object) Bitfield_mask( 31, 1,object) -/* +/* * Double number. * +-------+-------+-------+-------+-------+-------+-------+-------+ * |s| exponent | mantissa part 1 | @@ -174,7 +176,7 @@ #define Is_dbit30p2(object) Bitfield_mask( 30, 1,object) #define Is_dbit31p2(object) Bitfield_mask( 31, 1,object) -/* +/* * Quad number. * +-------+-------+-------+-------+-------+-------+-------+-------+ * |s| exponent | mantissa part 1 | @@ -236,7 +238,7 @@ typedef struct Bitfield_extract( 1, 31,u_qlow31p3,qlow31p3) Bitfield_extract( 0, 1,u_qhighp3,qhighp3) Bitfield_extract( 0, 31,u_qhigh31p3,qhigh31p3) - */ + */ } quad_u3; union { @@ -262,15 +264,15 @@ typedef struct /* * Declare the basic structures for the 3 different * fixed-point precisions. - * - * Single number + * + * Single number * +-------+-------+-------+-------+-------+-------+-------+-------+ * |s| integer | * +-------+-------+-------+-------+-------+-------+-------+-------+ */ typedef int sgl_integer; -/* +/* * Double number. * +-------+-------+-------+-------+-------+-------+-------+-------+ * |s| high integer | @@ -281,16 +283,16 @@ typedef int sgl_integer; * +-------+-------+-------+-------+-------+-------+-------+-------+ */ struct dint { - int wd0; - unsigned int wd1; + int wd0; + unsigned int wd1; }; struct dblwd { - unsigned int wd0; - unsigned int wd1; + unsigned int wd0; + unsigned int wd1; }; -/* +/* * Quad number. * +-------+-------+-------+-------+-------+-------+-------+-------+ * |s| integer part1 | @@ -310,10 +312,10 @@ struct dblwd { */ struct quadwd { - int wd0; - unsigned int wd1; - unsigned int wd2; - unsigned int wd3; + int wd0; + unsigned int wd1; + unsigned int wd2; + unsigned int wd3; }; typedef struct quadwd quad_integer; @@ -324,35 +326,29 @@ typedef int sgl_floating_point; typedef struct dblwd dbl_floating_point; typedef struct dint dbl_integer; -/* +/* * Define the different precisions' parameters. */ #define SGL_BITLENGTH 32 -#define SGL_EMAX 127 -#define SGL_EMIN (-126) #define SGL_BIAS 127 #define SGL_WRAP 192 -#define SGL_INFINITY_EXPONENT (SGL_EMAX+SGL_BIAS+1) +#define SGL_INFINITY_EXPONENT (FLT_MAX_EXP+SGL_BIAS+1) #define SGL_THRESHOLD 32 #define SGL_EXP_LENGTH 8 #define SGL_P 24 #define DBL_BITLENGTH 64 -#define DBL_EMAX 1023 -#define DBL_EMIN (-1022) #define DBL_BIAS 1023 #define DBL_WRAP 1536 -#define DBL_INFINITY_EXPONENT (DBL_EMAX+DBL_BIAS+1) +#define DBL_INFINITY_EXPONENT (DBL_MAX_EXP+DBL_BIAS+1) #define DBL_THRESHOLD 64 #define DBL_EXP_LENGTH 11 #define DBL_P 53 #define QUAD_BITLENGTH 128 -#define QUAD_EMAX 16383 -#define QUAD_EMIN (-16382) #define QUAD_BIAS 16383 #define QUAD_WRAP 24576 -#define QUAD_INFINITY_EXPONENT (QUAD_EMAX+QUAD_BIAS+1) +#define QUAD_INFINITY_EXPONENT (LDBL_MAX_EXP+QUAD_BIAS+1) #define QUAD_P 113 /* Boolean Values etc. */ @@ -361,22 +357,6 @@ typedef struct dint dbl_integer; #define NOT ! #define XOR ^ -/* other constants */ -#undef NULL -#define NULL 0 -#define NIL 0 -#define SGL 0 -#define DBL 1 -#define BADFMT 2 -#define QUAD 3 - - -/* Types */ -typedef int boolean; -typedef int FORMAT; -typedef int VOID; - - /* Declare status register equivalent to FPUs architecture. * * 0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1 @@ -416,7 +396,7 @@ typedef int VOID; #define INEXACTEXCEPTION 0x02 #define UNIMPLEMENTEDEXCEPTION 0x01 -/* Declare exception registers equivalent to FPUs architecture +/* Declare exception registers equivalent to FPUs architecture * * 0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1 * +-------+-------+-------+-------+-------+-------+-------+-------+ @@ -516,30 +496,3 @@ typedef int VOID; (int )Extall(extent) = 0 - (int )Extall(extent) #define Ext_setone_low(extent) Bitfield_deposit(1,31,1,extent) -typedef int operation; - -/* error messages */ - -#define NONE 0 -#define UNDEFFPINST 1 - -/* Function definitions: opcode, opclass */ -#define FTEST (1<<2) | 0 -#define FCPY (2<<2) | 0 -#define FABS (3<<2) | 0 -#define FSQRT (4<<2) | 0 -#define FRND (5<<2) | 0 - -#define FCNVFF (0<<2) | 1 -#define FCNVXF (1<<2) | 1 -#define FCNVFX (2<<2) | 1 -#define FCNVFXT (3<<2) | 1 - -#define FCMP (0<<2) | 2 - -#define FADD (0<<2) | 3 -#define FSUB (1<<2) | 3 -#define FMPY (2<<2) | 3 -#define FDIV (3<<2) | 3 -#define FREM (4<<2) | 3 - diff --git a/sys/arch/hppa/spmath/fpbits.h b/sys/arch/hppa/spmath/fpbits.h index d7f416ffb9a..bc1f38c0413 100644 --- a/sys/arch/hppa/spmath/fpbits.h +++ b/sys/arch/hppa/spmath/fpbits.h @@ -1,24 +1,24 @@ -/* $OpenBSD: fpbits.h,v 1.3 1998/07/02 19:05:28 mickey Exp $ */ +/* $OpenBSD: fpbits.h,v 1.4 2001/03/29 03:58:18 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 @@ -26,15 +26,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. */ @@ -62,10 +62,10 @@ * function "DeclBitfR" except its use is restricted to occur within a larger * enclosing structure or union definition. This declaration is an unnamed * structure with the argument, name, as the member name and the argument, - * uname, as the element name. + * uname, as the element name. *----------------------------------------------------------------------- */ -#define Bitfield_extract(start, length, object) \ - ((object) >> (HOSTWDSZ - (start) - (length)) & \ +#define Bitfield_extract(start, length, object) \ + ((object) >> (HOSTWDSZ - (start) - (length)) & \ ((unsigned)-1 >> (HOSTWDSZ - (length)))) #define Bitfield_signed_extract(start, length, object) \ diff --git a/sys/arch/hppa/spmath/frnd.c b/sys/arch/hppa/spmath/frnd.c index a37595bddae..656c0171d9b 100644 --- a/sys/arch/hppa/spmath/frnd.c +++ b/sys/arch/hppa/spmath/frnd.c @@ -1,25 +1,25 @@ -/* $OpenBSD: frnd.c,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: frnd.c,v 1.5 2001/03/29 03:58:18 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. */ @@ -58,30 +58,30 @@ unsigned int *status; { register unsigned int src, result; register int src_exponent; - register boolean inexact = FALSE; + register int inexact = FALSE; src = *srcptr; - /* - * check source operand for NaN or infinity - */ - if ((src_exponent = Sgl_exponent(src)) == SGL_INFINITY_EXPONENT) { - /* - * is signaling NaN? - */ - if (Sgl_isone_signaling(src)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(src); - } - /* - * return quiet NaN or infinity - */ - *dstptr = src; - return(NOEXCEPTION); - } - /* + /* + * check source operand for NaN or infinity + */ + if ((src_exponent = Sgl_exponent(src)) == SGL_INFINITY_EXPONENT) { + /* + * is signaling NaN? + */ + if (Sgl_isone_signaling(src)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(src); + } + /* + * return quiet NaN or infinity + */ + *dstptr = src; + return(NOEXCEPTION); + } + /* * Need to round? */ if ((src_exponent -= SGL_BIAS) >= SGL_P - 1) { @@ -108,18 +108,18 @@ unsigned int *status; break; case ROUNDNEAREST: if (Sgl_isone_roundbit(src,src_exponent)) - if (Sgl_isone_stickybit(src,src_exponent) - || (Sgl_isone_lowmantissa(result))) + if (Sgl_isone_stickybit(src,src_exponent) + || (Sgl_isone_lowmantissa(result))) Sgl_increment(result); - } + } } Sgl_leftshift(result,(SGL_P-1) - (src_exponent)); - if (Sgl_isone_hiddenoverflow(result)) + if (Sgl_isone_hiddenoverflow(result)) Sgl_set_exponent(result,src_exponent + (SGL_BIAS+1)); else Sgl_set_exponent(result,src_exponent + SGL_BIAS); } else { - result = src; /* set sign */ + result = src; /* set sign */ Sgl_setzero_exponentmantissa(result); /* check for inexact */ if (Sgl_isnotzero_exponentmantissa(src)) { @@ -127,18 +127,18 @@ unsigned int *status; /* round result */ switch (Rounding_mode()) { case ROUNDPLUS: - if (Sgl_iszero_sign(src)) + if (Sgl_iszero_sign(src)) Sgl_set_exponent(result,SGL_BIAS); break; case ROUNDMINUS: - if (Sgl_isone_sign(src)) + if (Sgl_isone_sign(src)) Sgl_set_exponent(result,SGL_BIAS); break; case ROUNDNEAREST: if (src_exponent == -1) - if (Sgl_isnotzero_mantissa(src)) + if (Sgl_isnotzero_mantissa(src)) Sgl_set_exponent(result,SGL_BIAS); - } + } } } *dstptr = result; @@ -147,7 +147,7 @@ unsigned int *status; else Set_inexactflag(); } return(NOEXCEPTION); -} +} /* * Double Floating-point Round to Integer @@ -162,30 +162,30 @@ unsigned int *status; { register unsigned int srcp1, srcp2, resultp1, resultp2; register int src_exponent; - register boolean inexact = FALSE; + register int inexact = FALSE; Dbl_copyfromptr(srcptr,srcp1,srcp2); - /* - * check source operand for NaN or infinity - */ - if ((src_exponent = Dbl_exponent(srcp1)) == DBL_INFINITY_EXPONENT) { - /* - * is signaling NaN? - */ - if (Dbl_isone_signaling(srcp1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Dbl_set_quiet(srcp1); - } - /* - * return quiet NaN or infinity - */ - Dbl_copytoptr(srcp1,srcp2,dstptr); - return(NOEXCEPTION); - } - /* + /* + * check source operand for NaN or infinity + */ + if ((src_exponent = Dbl_exponent(srcp1)) == DBL_INFINITY_EXPONENT) { + /* + * is signaling NaN? + */ + if (Dbl_isone_signaling(srcp1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Dbl_set_quiet(srcp1); + } + /* + * return quiet NaN or infinity + */ + Dbl_copytoptr(srcp1,srcp2,dstptr); + return(NOEXCEPTION); + } + /* * Need to round? */ if ((src_exponent -= DBL_BIAS) >= DBL_P - 1) { @@ -206,19 +206,19 @@ unsigned int *status; /* round result */ switch (Rounding_mode()) { case ROUNDPLUS: - if (Dbl_iszero_sign(srcp1)) + if (Dbl_iszero_sign(srcp1)) Dbl_increment(resultp1,resultp2); break; case ROUNDMINUS: - if (Dbl_isone_sign(srcp1)) + if (Dbl_isone_sign(srcp1)) Dbl_increment(resultp1,resultp2); break; case ROUNDNEAREST: if (Dbl_isone_roundbit(srcp1,srcp2,src_exponent)) - if (Dbl_isone_stickybit(srcp1,srcp2,src_exponent) - || (Dbl_isone_lowmantissap2(resultp2))) + if (Dbl_isone_stickybit(srcp1,srcp2,src_exponent) + || (Dbl_isone_lowmantissap2(resultp2))) Dbl_increment(resultp1,resultp2); - } + } } Dbl_leftshift(resultp1,resultp2,(DBL_P-1) - (src_exponent)); if (Dbl_isone_hiddenoverflow(resultp1)) @@ -234,18 +234,18 @@ unsigned int *status; /* round result */ switch (Rounding_mode()) { case ROUNDPLUS: - if (Dbl_iszero_sign(srcp1)) + if (Dbl_iszero_sign(srcp1)) Dbl_set_exponent(resultp1,DBL_BIAS); break; case ROUNDMINUS: - if (Dbl_isone_sign(srcp1)) + if (Dbl_isone_sign(srcp1)) Dbl_set_exponent(resultp1,DBL_BIAS); break; case ROUNDNEAREST: if (src_exponent == -1) - if (Dbl_isnotzero_mantissa(srcp1,srcp2)) + if (Dbl_isnotzero_mantissa(srcp1,srcp2)) Dbl_set_exponent(resultp1,DBL_BIAS); - } + } } } Dbl_copytoptr(resultp1,resultp2,dstptr); diff --git a/sys/arch/hppa/spmath/hppa.h b/sys/arch/hppa/spmath/hppa.h index a7e7eb005b9..e9cf4f0064d 100644 --- a/sys/arch/hppa/spmath/hppa.h +++ b/sys/arch/hppa/spmath/hppa.h @@ -1,24 +1,24 @@ -/* $OpenBSD: hppa.h,v 1.3 1998/07/02 19:05:31 mickey Exp $ */ +/* $OpenBSD: hppa.h,v 1.4 2001/03/29 03:58:18 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 @@ -26,15 +26,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. */ @@ -48,7 +48,7 @@ /* unsigned int left, right; int amount, dest; */ \ if (amount == 0) dest = right; \ else dest = ((((unsigned) left)&0x7fffffff) << (32-(amount))) | \ - ((unsigned) right >> (amount)) + ((unsigned) right >> (amount)) /* amount must be between 0 and 32 (non-inclusive) */ #define Variable_shift_double(left,right,amount,dest) \ diff --git a/sys/arch/hppa/spmath/impys.S b/sys/arch/hppa/spmath/impys.S index 8e2efec5db7..22265675409 100644 --- a/sys/arch/hppa/spmath/impys.S +++ b/sys/arch/hppa/spmath/impys.S @@ -1,25 +1,25 @@ -/* $OpenBSD: impys.S,v 1.4 2001/03/28 23:55:59 mickey Exp $ */ +/* $OpenBSD: impys.S,v 1.5 2001/03/29 03:58:18 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. */ @@ -43,11 +43,11 @@ /**************************************************************************** * - * Implement an integer multiply routine for 32-bit operands and 64-bit product + * Implement an integer multiply routine for 32-bit operands and 64-bit product * with operand values of zero (multiplicand only) and -2**31 treated specially. * The algorithm uses the absolute value of the multiplier, four bits at a time, * from right to left, to generate partial product. Execution speed is more - * important than program size in this implementation. + * important than program size in this implementation. * ***************************************************************************/ /* @@ -88,14 +88,14 @@ mpy1 comb,< op1,gr0,mpya ; br. if multiplicand < 0 addib,= 0,op1,fini0 ; op1 = 0, product = 0 mpy2 addi 1,gr0,pc ; initialize pc to 00...01 movib,tr 8,cnt,mloop ; set count for mpy loop - extru op2,31,4,brindex ; 4 bits as index into table + extru op2,31,4,brindex ; 4 bits as index into table ; .align 8 ; b sh4c ; br. if sign overflow sh4n shd pu,pl,4,pl ; shift product right 4 bits addib,<= -1,cnt,mulend ; reduce count by 1, exit if - extru pu,27,28,pu ; <= zero + extru pu,27,28,pu ; <= zero ; mloop blr brindex,gr0 ; br. into table ; entries of 2 words @@ -118,13 +118,13 @@ mtable ; two words per entry ; ; ---- bits = 0010 ---- add op1, add op1, then shift 4 bits ; - addb,tr op1,pu,sh4n ; add 2*op1, to shift - addb,uv op1,pu,sh4c ; product right 4 bits + addb,tr op1,pu,sh4n ; add 2*op1, to shift + addb,uv op1,pu,sh4c ; product right 4 bits ; ; ---- bits = 0011 ---- add op1, add 2*op1, shift 4 bits ; - addb,tr op1,pu,sh4n-4 ; add op1 & 2*op1, shift - sh1add,nsv op1,pu,pu ; product right 4 bits + addb,tr op1,pu,sh4n-4 ; add op1 & 2*op1, shift + sh1add,nsv op1,pu,pu ; product right 4 bits ; ; ---- bits = 0100 ---- shift 2, add op1, shift 2 ; @@ -207,21 +207,21 @@ sh4c addib,> -1,cnt,mloop ; decrement count, loop if > 0 mpyb add,= op2,op2,gr0 ; if <> 0, back to main sect. b mpy1 sub 0,op2,op2 ; op2 = |multiplier| - add,>= op1,gr0,gr0 ; if op1 < 0, invert sign, + add,>= op1,gr0,gr0 ; if op1 < 0, invert sign, xor pm,sign,sign ; for correct result ; ; special case for multiplier = -2**31, op1 = signed multiplicand ; or multiplicand = -2**31, op1 = signed multiplier ; shd op1,0,1,pl ; shift op1 left 31 bits -mmax extrs op1,30,31,pu +mmax extrs op1,30,31,pu b signs ; negate product (if needed) bb,>=,n sign,0,fini ; test sign of product ; mpya add,= op1,op1,gr0 ; op1 = -2**31, special case b mpy2 sub 0,op1,op1 ; op1 = |multiplicand| - add,>= op2,gr0,gr0 ; if op2 < 0, invert sign, + add,>= op2,gr0,gr0 ; if op2 < 0, invert sign, xor pm,sign,sign ; for correct result movb,tr op2,op1,mmax ; use op2 as multiplicand shd op1,0,1,pl ; shift it left 31 bits @@ -252,8 +252,8 @@ sh1 addib,> -1,cnt,mloop ; loop if count > 0 sh2ns addib,tr 1,brindex,sh2sb+4 ; increment index extru pu,29,30,pu ; shift unsigned ; -sh2s shd pu,pl,2,pl ; shift with minus sign - shd pm,pu,2,pu ; +sh2s shd pu,pl,2,pl ; shift with minus sign + shd pm,pu,2,pu ; sub pu,op1,pu ; subtract op1 shd pu,pl,2,pl ; shift with minus sign addib,tr -1,cnt,mloop ; decrement count, loop @@ -279,7 +279,7 @@ sh2us extru pu,29,30,pu ; shift 2 unsigned addb,tr op1,pu,sh2a ; add op1 shd pu,pl,2,pl ; shift 2 bits ; -sh2c shd pu,pl,2,pl +sh2c shd pu,pl,2,pl shd pc,pu,2,pu ; shift with carry addb,tr op1,pu,sh2a ; add op1 to product shd pu,pl,2,pl ; br. to sh2 to shift pu diff --git a/sys/arch/hppa/spmath/impyu.S b/sys/arch/hppa/spmath/impyu.S index 7cc30b3b0af..1fec205e28f 100644 --- a/sys/arch/hppa/spmath/impyu.S +++ b/sys/arch/hppa/spmath/impyu.S @@ -1,25 +1,25 @@ -/* $OpenBSD: impyu.S,v 1.4 2001/03/28 23:55:59 mickey Exp $ */ +/* $OpenBSD: impyu.S,v 1.5 2001/03/29 03:58:18 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. */ @@ -43,11 +43,11 @@ /**************************************************************************** * - *Implement an integer multiply routine for 32-bit operands and 64-bit product + *Implement an integer multiply routine for 32-bit operands and 64-bit product * with operand values of zero (multiplicand only) and 2**32reated specially. * The algorithm uses the multiplier, four bits at a time, from right to left, * to generate partial product. Execution speed is more important than program - * size in this implementation. + * size in this implementation. * *****************************************************************************/ ; @@ -60,7 +60,7 @@ op2 .equ 4 ; multiplier op1 .equ 5 ; multiplicand cnt .equ 6 ; count in multiply brindex .equ 7 ; index into the br. table -saveop2 .equ 8 ; save op2 if high bit of multiplicand +saveop2 .equ 8 ; save op2 if high bit of multiplicand ; is set pc .equ 9 ; carry bit of product, = 00...01 pm .equ 10 ; value of -1 used in shifting @@ -99,20 +99,20 @@ impyu stws,ma pu,4(sp) ; save registers on stack b mpy1 ; if op1 < 2**32, start multiply add op2,gr0,saveop2 ; save op2 in saveop2 shd gr0,op2,1,pu ; shift op2 left 31 for result - b fini ; go to finish + b fini ; go to finish shd op2,gr0,1,pl ; -mpy1 addi -1,gr0,pm ; initialize pm to 111...1 +mpy1 addi -1,gr0,pm ; initialize pm to 111...1 addi 1,gr0,pc ; initialize pc to 00...01 movib,tr 8,cnt,mloop ; set count for mpy loop - extru op2,31,4,brindex ; 4 bits as index into table + extru op2,31,4,brindex ; 4 bits as index into table ; .align 8 ; b sh4c ; br. if sign overflow sh4n shd pu,pl,4,pl ; shift product right 4 bits addib,<= -1,cnt,mulend ; reduce count by 1, exit if - extru pu,27,28,pu ; <= zero + extru pu,27,28,pu ; <= zero ; mloop blr brindex,gr0 ; br. into table ; entries of 2 words @@ -135,13 +135,13 @@ mtable ; two words per entry ; ; ---- bits = 0010 ---- add op1, add op1, then shift 4 bits ; - addb,tr op1,pu,sh4n ; add 2*op1, to shift - addb,uv op1,pu,sh4c ; product right 4 bits + addb,tr op1,pu,sh4n ; add 2*op1, to shift + addb,uv op1,pu,sh4c ; product right 4 bits ; ; ---- bits = 0011 ---- add op1, add 2*op1, shift 4 bits ; - addb,tr op1,pu,sh4n-4 ; add op1 & 2*op1, shift - sh1add,nuv op1,pu,pu ; product right 4 bits + addb,tr op1,pu,sh4n-4 ; add op1 & 2*op1, shift + sh1add,nuv op1,pu,pu ; product right 4 bits ; ; ---- bits = 0100 ---- shift 2, add op1, shift 2 ; @@ -249,8 +249,8 @@ sh1 addib,> -1,cnt,mloop ; loop if count > 0 sh2ns addib,tr 1,brindex,sh2sb+4 ; increment index extru pu,29,30,pu ; shift unsigned ; -sh2s shd pu,pl,2,pl ; shift with minus sign - shd pm,pu,2,pu ; +sh2s shd pu,pl,2,pl ; shift with minus sign + shd pm,pu,2,pu ; sub pu,op1,pu ; subtract op1 shd pu,pl,2,pl ; shift with minus sign addib,> -1,cnt,mloop ; decrement count, loop if > 0 @@ -270,7 +270,7 @@ sh1sa extrs pu,30,31,pu ; signed sub pu,op1,pu ; subtract op1 from product shd pu,pl,3,pl ; shift 3 with minus sign addib,> -1,cnt,mloop ; decrement count, loop if >0 - shd pm,pu,3,pu + shd pm,pu,3,pu addb,tr op1,pu,lastadd ; do one more add, then finish addb,=,n saveop2,gr0,fini ; check saveop2 ; @@ -281,7 +281,7 @@ sh2us extru pu,29,30,pu ; shift 2 unsigned addb,tr op1,pu,sh2a ; add op1 shd pu,pl,2,pl ; shift 2 bits ; -sh2c shd pu,pl,2,pl +sh2c shd pu,pl,2,pl shd pc,pu,2,pu ; shift with carry addb,tr op1,pu,sh2a ; add op1 to product shd pu,pl,2,pl ; br. to sh2 to shift pu diff --git a/sys/arch/hppa/spmath/md.h b/sys/arch/hppa/spmath/md.h index d2b4701f612..14215032c4f 100644 --- a/sys/arch/hppa/spmath/md.h +++ b/sys/arch/hppa/spmath/md.h @@ -1,25 +1,25 @@ -/* $OpenBSD: md.h,v 1.3 1998/07/02 19:05:35 mickey Exp $ */ +/* $OpenBSD: md.h,v 1.4 2001/03/29 03:58:18 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. */ @@ -45,8 +45,8 @@ * Muliply/Divide SFU Internal State * *****************************************************************/ struct mdsfu_register { - int rslt_hi, - rslt_lo, + int rslt_hi, + rslt_lo, ovflow; }; @@ -55,20 +55,13 @@ struct mdsfu_register { #define overflow result->ovflow /* - * Types - */ -typedef int VOID; -typedef int boolean; - - -/* * Constants */ #undef FALSE #define FALSE 0 -#undef TRUE +#undef TRUE #define TRUE (!FALSE) #undef NIL diff --git a/sys/arch/hppa/spmath/mpyaccs.c b/sys/arch/hppa/spmath/mpyaccs.c index 079df8ff5ec..86bbf112ac8 100644 --- a/sys/arch/hppa/spmath/mpyaccs.c +++ b/sys/arch/hppa/spmath/mpyaccs.c @@ -1,25 +1,25 @@ -/* $OpenBSD: mpyaccs.c,v 1.3 1998/07/02 19:05:40 mickey Exp $ */ +/* $OpenBSD: mpyaccs.c,v 1.4 2001/03/29 03:58:18 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. */ @@ -54,7 +54,7 @@ struct mdsfu_register *result; impys(&opnd1,&opnd2,&temp); /* get result of low word add, and check for carry out */ - if ((result_lo += (unsigned)temp.rslt_lo) < (unsigned)temp.rslt_lo) + if ((result_lo += (unsigned)temp.rslt_lo) < (unsigned)temp.rslt_lo) carry = 1; else carry = 0; diff --git a/sys/arch/hppa/spmath/mpyaccu.c b/sys/arch/hppa/spmath/mpyaccu.c index 274a2355d92..f0f27a559dc 100644 --- a/sys/arch/hppa/spmath/mpyaccu.c +++ b/sys/arch/hppa/spmath/mpyaccu.c @@ -1,25 +1,25 @@ -/* $OpenBSD: mpyaccu.c,v 1.4 1998/07/02 19:10:54 mickey Exp $ */ +/* $OpenBSD: mpyaccu.c,v 1.5 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. */ @@ -54,12 +54,12 @@ struct mdsfu_register *result; impyu(&opnd1,&opnd2,&temp); /* get result of low word add, and check for carry out */ - if ((result_lo += (unsigned)temp.rslt_lo) < (unsigned)temp.rslt_lo) + if ((result_lo += (unsigned)temp.rslt_lo) < (unsigned)temp.rslt_lo) carry = 1; else carry = 0; /* get result of high word add, and determine overflow status */ - if ((result_hi += (unsigned)temp.rslt_hi + carry) < + if ((result_hi += (unsigned)temp.rslt_hi + carry) < (unsigned)temp.rslt_hi) overflow = TRUE; return; diff --git a/sys/arch/hppa/spmath/mpys.c b/sys/arch/hppa/spmath/mpys.c index c8d93e19375..e8ec579dcbe 100644 --- a/sys/arch/hppa/spmath/mpys.c +++ b/sys/arch/hppa/spmath/mpys.c @@ -1,25 +1,25 @@ -/* $OpenBSD: mpys.c,v 1.4 1998/07/02 19:10:56 mickey Exp $ */ +/* $OpenBSD: mpys.c,v 1.5 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. */ diff --git a/sys/arch/hppa/spmath/mpyscv.c b/sys/arch/hppa/spmath/mpyscv.c index 847463dfadf..5f75e311dd5 100644 --- a/sys/arch/hppa/spmath/mpyscv.c +++ b/sys/arch/hppa/spmath/mpyscv.c @@ -1,25 +1,25 @@ -/* $OpenBSD: mpyscv.c,v 1.4 1998/07/02 19:10:57 mickey Exp $ */ +/* $OpenBSD: mpyscv.c,v 1.5 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. */ diff --git a/sys/arch/hppa/spmath/mpyu.c b/sys/arch/hppa/spmath/mpyu.c index 8a62afb8178..46fbcbf7934 100644 --- a/sys/arch/hppa/spmath/mpyu.c +++ b/sys/arch/hppa/spmath/mpyu.c @@ -1,25 +1,25 @@ -/* $OpenBSD: mpyu.c,v 1.3 1998/07/02 19:05:46 mickey Exp $ */ +/* $OpenBSD: mpyu.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. */ diff --git a/sys/arch/hppa/spmath/mpyucv.c b/sys/arch/hppa/spmath/mpyucv.c index 921ececfaea..2050e2eccad 100644 --- a/sys/arch/hppa/spmath/mpyucv.c +++ b/sys/arch/hppa/spmath/mpyucv.c @@ -1,25 +1,25 @@ -/* $OpenBSD: mpyucv.c,v 1.3 1998/07/02 19:05:47 mickey Exp $ */ +/* $OpenBSD: mpyucv.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. */ diff --git a/sys/arch/hppa/spmath/quad_float.h b/sys/arch/hppa/spmath/quad_float.h index aaf3a91b1d1..c441b8a3a71 100644 --- a/sys/arch/hppa/spmath/quad_float.h +++ b/sys/arch/hppa/spmath/quad_float.h @@ -1,25 +1,25 @@ -/* $OpenBSD: quad_float.h,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: quad_float.h,v 1.5 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. */ @@ -74,9 +74,9 @@ * unsigned int signlessleft, signlessright; */ \ ( signlessleft<=signlessright && \ (signlessleft<signlessright || (Qallp2(leftp2)<=Qallp2(rightp2) && \ - (Qallp2(leftp2)<Qallp2(rightp2) || (Qallp3(leftp3)<=Qallp3(rightp3) && \ + (Qallp2(leftp2)<Qallp2(rightp2) || (Qallp3(leftp3)<=Qallp3(rightp3) && \ (Qallp3(leftp3)<Qallp3(rightp3) || Qallp4(leftp4)<Qallp4(rightp4))))))) - + #define Quad_xor_to_intp1(leftp1,rightp1,result) \ /* quad_floating_point left, right; \ * unsigned int result; */ \ diff --git a/sys/arch/hppa/spmath/setovfl.c b/sys/arch/hppa/spmath/setovfl.c index c4b61303ea0..55d30750c9e 100644 --- a/sys/arch/hppa/spmath/setovfl.c +++ b/sys/arch/hppa/spmath/setovfl.c @@ -1,25 +1,25 @@ -/* $OpenBSD: setovfl.c,v 1.3 1998/07/02 19:05:50 mickey Exp $ */ +/* $OpenBSD: setovfl.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. */ diff --git a/sys/arch/hppa/spmath/sfadd.c b/sys/arch/hppa/spmath/sfadd.c index 3e052e85d50..98afffe8929 100644 --- a/sys/arch/hppa/spmath/sfadd.c +++ b/sys/arch/hppa/spmath/sfadd.c @@ -1,25 +1,25 @@ -/* $OpenBSD: sfadd.c,v 1.3 1998/07/02 19:05:51 mickey Exp $ */ +/* $OpenBSD: sfadd.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,19 +52,19 @@ sgl_fadd(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; - register boolean underflowtrap; - + register int inexact = FALSE; + register int 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); /* @@ -72,48 +72,48 @@ sgl_fadd(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 opposite 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); @@ -121,29 +121,29 @@ sgl_fadd(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 */ *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(); @@ -151,10 +151,10 @@ sgl_fadd(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 */ @@ -166,17 +166,17 @@ sgl_fadd(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); } - /* 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)) @@ -191,7 +191,7 @@ sgl_fadd(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 @@ -199,7 +199,7 @@ sgl_fadd(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); @@ -248,11 +248,11 @@ sgl_fadd(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; return(UNDERFLOWEXCEPTION); } @@ -269,8 +269,8 @@ sgl_fadd(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. @@ -279,7 +279,7 @@ sgl_fadd(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); @@ -302,17 +302,17 @@ sgl_fadd(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); @@ -326,19 +326,19 @@ sgl_fadd(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; } } - /* Check for denormalized, exponent should be zero. Left * + /* Check for denormalized, exponent should be zero. Left * * operand was normalized, so extent (guard, round) was zero */ if(!(underflowtrap = Is_underflowtrap_enabled()) && result_exponent==0) goto underflow; @@ -378,7 +378,7 @@ sgl_fadd(leftptr, rightptr, dstptr, status) return(NOEXCEPTION); } Sgl_sethigh4bits(result,/*using*/sign_save); - switch(jumpsize) + switch(jumpsize) { case 1: { @@ -403,7 +403,7 @@ sgl_fadd(leftptr, rightptr, dstptr, status) break; } } - if(result_exponent > 0) + if(result_exponent > 0) { Sgl_set_exponent(result,/*using*/result_exponent); *dstptr = result; @@ -414,12 +414,12 @@ sgl_fadd(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); } - /* + /* * Since we cannot get an inexact denormalized result, * we can now return. */ @@ -431,7 +431,7 @@ sgl_fadd(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); @@ -443,7 +443,7 @@ sgl_fadd(leftptr, rightptr, dstptr, status) result_exponent++; } /* end if hiddenoverflow... */ } /* end else ...add 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 @@ -474,23 +474,23 @@ sgl_fadd(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; @@ -501,7 +501,7 @@ sgl_fadd(leftptr, rightptr, dstptr, status) } return(OVERFLOWEXCEPTION); } - else + else { Set_overflowflag(); inexact = TRUE; diff --git a/sys/arch/hppa/spmath/sfcmp.c b/sys/arch/hppa/spmath/sfcmp.c index 369ca341476..ec9aca6cf62 100644 --- a/sys/arch/hppa/spmath/sfcmp.c +++ b/sys/arch/hppa/spmath/sfcmp.c @@ -1,25 +1,25 @@ -/* $OpenBSD: sfcmp.c,v 1.3 1998/07/02 19:05:53 mickey Exp $ */ +/* $OpenBSD: sfcmp.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,21 +27,21 @@ /* * (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. */ #include "../spmath/float.h" #include "../spmath/sgl_float.h" - + /* * sgl_cmp: compare two values */ @@ -53,7 +53,7 @@ sgl_fcmp(leftptr, rightptr, cond, status) { register unsigned int left, right; register int xorresult; - + /* Create local copies of the numbers */ left = *leftptr; right = *rightptr; @@ -61,21 +61,21 @@ sgl_fcmp(leftptr, rightptr, cond, status) * Test for NaN */ if( (Sgl_exponent(left) == SGL_INFINITY_EXPONENT) - || (Sgl_exponent(right) == SGL_INFINITY_EXPONENT) ) + || (Sgl_exponent(right) == SGL_INFINITY_EXPONENT) ) { - /* Check if a NaN is involved. Signal an invalid exception when + /* Check if a NaN is involved. Signal an invalid exception when * comparing a signaling NaN or when comparing quiet NaNs and the * low bit of the condition is set */ - if( ( (Sgl_exponent(left) == SGL_INFINITY_EXPONENT) - && Sgl_isnotzero_mantissa(left) + if( ( (Sgl_exponent(left) == SGL_INFINITY_EXPONENT) + && Sgl_isnotzero_mantissa(left) && (Exception(cond) || Sgl_isone_signaling(left))) || ( (Sgl_exponent(right) == SGL_INFINITY_EXPONENT) - && Sgl_isnotzero_mantissa(right) + && Sgl_isnotzero_mantissa(right) && (Exception(cond) || Sgl_isone_signaling(right)) ) ) { if( Is_invalidtrap_enabled() ) { - Set_status_cbit(Unordered(cond)); + Set_status_cbit(Unordered(cond)); return(INVALIDEXCEPTION); } else Set_invalidflag(); @@ -84,7 +84,7 @@ sgl_fcmp(leftptr, rightptr, cond, status) } /* All the exceptional conditions are handled, now special case NaN compares */ - else if( ((Sgl_exponent(left) == SGL_INFINITY_EXPONENT) + else if( ((Sgl_exponent(left) == SGL_INFINITY_EXPONENT) && Sgl_isnotzero_mantissa(left)) || ((Sgl_exponent(right) == SGL_INFINITY_EXPONENT) @@ -100,12 +100,12 @@ sgl_fcmp(leftptr, rightptr, cond, status) * special equal case */ Sgl_xortointp1(left,right,xorresult); if( xorresult < 0 ) - { - /* left negative => less, left positive => greater. - * equal is possible if both operands are zeros. */ - if( Sgl_iszero_exponentmantissa(left) + { + /* left negative => less, left positive => greater. + * equal is possible if both operands are zeros. */ + if( Sgl_iszero_exponentmantissa(left) && Sgl_iszero_exponentmantissa(right) ) - { + { Set_status_cbit(Equal(cond)); } else if( Sgl_isone_sign(left) ) @@ -116,17 +116,17 @@ sgl_fcmp(leftptr, rightptr, cond, status) { Set_status_cbit(Greaterthan(cond)); } - } + } /* Signs are the same. Treat negative numbers separately * from the positives because of the reversed sense. */ else if( Sgl_all(left) == Sgl_all(right) ) - { - Set_status_cbit(Equal(cond)); - } + { + Set_status_cbit(Equal(cond)); + } else if( Sgl_iszero_sign(left) ) - { - /* Positive compare */ - if( Sgl_all(left) < Sgl_all(right) ) + { + /* Positive compare */ + if( Sgl_all(left) < Sgl_all(right) ) { Set_status_cbit(Lessthan(cond)); } @@ -136,18 +136,18 @@ sgl_fcmp(leftptr, rightptr, cond, status) } } else - { - /* Negative compare. Signed or unsigned compares - * both work the same. That distinction is only - * important when the sign bits differ. */ - if( Sgl_all(left) > Sgl_all(right) ) + { + /* Negative compare. Signed or unsigned compares + * both work the same. That distinction is only + * important when the sign bits differ. */ + if( Sgl_all(left) > Sgl_all(right) ) { Set_status_cbit(Lessthan(cond)); } - else + else { Set_status_cbit(Greaterthan(cond)); } - } + } return(NOEXCEPTION); } diff --git a/sys/arch/hppa/spmath/sfdiv.c b/sys/arch/hppa/spmath/sfdiv.c index 9ea439aed50..aa005d2bf02 100644 --- a/sys/arch/hppa/spmath/sfdiv.c +++ b/sys/arch/hppa/spmath/sfdiv.c @@ -1,25 +1,25 @@ -/* $OpenBSD: sfdiv.c,v 1.3 1998/07/02 19:05:56 mickey Exp $ */ +/* $OpenBSD: sfdiv.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. */ @@ -53,15 +53,15 @@ unsigned int *status; { register unsigned int opnd1, opnd2, opnd3, result; register int dest_exponent, count; - register boolean inexact = FALSE, guardbit = FALSE, stickybit = FALSE; - boolean is_tiny; + register int inexact = FALSE, guardbit = FALSE, stickybit = FALSE; + int is_tiny; opnd1 = *srcptr1; opnd2 = *srcptr2; - /* - * set sign bit of result + /* + * set sign bit of result */ - if (Sgl_sign(opnd1) ^ Sgl_sign(opnd2)) Sgl_setnegativezero(result); + if (Sgl_sign(opnd1) ^ Sgl_sign(opnd2)) Sgl_setnegativezero(result); else Sgl_setzero(result); /* * check first operand for NaN's or infinity @@ -70,55 +70,55 @@ unsigned int *status; if (Sgl_iszero_mantissa(opnd1)) { if (Sgl_isnotnan(opnd2)) { if (Sgl_isinfinity(opnd2)) { - /* - * invalid since both operands - * are infinity + /* + * invalid since both operands + * are infinity */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Sgl_makequietnan(result); + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + Set_invalidflag(); + Sgl_makequietnan(result); *dstptr = result; return(NOEXCEPTION); } /* - * return infinity - */ + * return infinity + */ Sgl_setinfinity_exponentmantissa(result); *dstptr = result; return(NOEXCEPTION); } } else { - /* - * is NaN; signaling or quiet? - */ - if (Sgl_isone_signaling(opnd1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd1); - } - /* - * is second operand a signaling NaN? + /* + * is NaN; signaling or quiet? + */ + if (Sgl_isone_signaling(opnd1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd1); + } + /* + * is second operand a signaling NaN? */ else if (Sgl_is_signalingnan(opnd2)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd2); - *dstptr = opnd2; - return(NOEXCEPTION); + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd2); + *dstptr = opnd2; + return(NOEXCEPTION); } - /* - * return quiet NaN - */ - *dstptr = opnd1; - return(NOEXCEPTION); + /* + * return quiet NaN + */ + *dstptr = opnd1; + return(NOEXCEPTION); } } /* @@ -133,21 +133,21 @@ unsigned int *status; *dstptr = result; return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Sgl_isone_signaling(opnd2)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd2); - } - /* - * return quiet NaN - */ - *dstptr = opnd2; - return(NOEXCEPTION); + /* + * is NaN; signaling or quiet? + */ + if (Sgl_isone_signaling(opnd2)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd2); + } + /* + * return quiet NaN + */ + *dstptr = opnd2; + return(NOEXCEPTION); } /* * check for division by zero @@ -156,20 +156,20 @@ unsigned int *status; if (Sgl_iszero_exponentmantissa(opnd1)) { /* invalid since both operands are zero */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - Set_invalidflag(); - Sgl_makequietnan(result); + Set_invalidflag(); + Sgl_makequietnan(result); *dstptr = result; return(NOEXCEPTION); } if (Is_divisionbyzerotrap_enabled()) - return(DIVISIONBYZEROEXCEPTION); - Set_divisionbyzeroflag(); - Sgl_setinfinity_exponentmantissa(result); + return(DIVISIONBYZEROEXCEPTION); + Set_divisionbyzeroflag(); + Sgl_setinfinity_exponentmantissa(result); *dstptr = result; return(NOEXCEPTION); } /* - * Generate exponent + * Generate exponent */ dest_exponent = Sgl_exponent(opnd1) - Sgl_exponent(opnd2) + SGL_BIAS; @@ -187,9 +187,9 @@ unsigned int *status; *dstptr = result; return(NOEXCEPTION); } - /* is denormalized; want to normalize */ - Sgl_clear_signexponent(opnd1); - Sgl_leftshiftby1(opnd1); + /* is denormalized; want to normalize */ + Sgl_clear_signexponent(opnd1); + Sgl_leftshiftby1(opnd1); Sgl_normalize(opnd1,dest_exponent); } /* opnd2 needs to have hidden bit set with msb in hidden bit */ @@ -197,9 +197,9 @@ unsigned int *status; Sgl_clear_signexponent_set_hidden(opnd2); } else { - /* is denormalized; want to normalize */ - Sgl_clear_signexponent(opnd2); - Sgl_leftshiftby1(opnd2); + /* is denormalized; want to normalize */ + Sgl_clear_signexponent(opnd2); + Sgl_leftshiftby1(opnd2); while(Sgl_iszero_hiddenhigh7mantissa(opnd2)) { Sgl_leftshiftby8(opnd2); dest_exponent += 8; @@ -256,111 +256,110 @@ unsigned int *status; } inexact = guardbit | stickybit; - /* - * round result + /* + * round result */ if (inexact && (dest_exponent > 0 || Is_underflowtrap_enabled())) { Sgl_clear_signexponent(opnd3); switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(result)) + case ROUNDPLUS: + if (Sgl_iszero_sign(result)) Sgl_increment_mantissa(opnd3); break; - case ROUNDMINUS: - if (Sgl_isone_sign(result)) + case ROUNDMINUS: + if (Sgl_isone_sign(result)) Sgl_increment_mantissa(opnd3); break; case ROUNDNEAREST: - if (guardbit) { - if (stickybit || Sgl_isone_lowmantissa(opnd3)) - Sgl_increment_mantissa(opnd3); - } + if (guardbit && + (stickybit || Sgl_isone_lowmantissa(opnd3))) + Sgl_increment_mantissa(opnd3); } if (Sgl_isone_hidden(opnd3)) dest_exponent++; } Sgl_set_mantissa(result,opnd3); - /* - * Test for overflow - */ + /* + * Test for overflow + */ if (dest_exponent >= SGL_INFINITY_EXPONENT) { - /* trap if OVERFLOWTRAP enabled */ - if (Is_overflowtrap_enabled()) { - /* - * Adjust bias of result - */ - Sgl_setwrapped_exponent(result,dest_exponent,ovfl); - *dstptr = result; - if (inexact) { - if (Is_inexacttrap_enabled()) - return(OVERFLOWEXCEPTION | INEXACTEXCEPTION); - else Set_inexactflag(); + /* trap if OVERFLOWTRAP enabled */ + if (Is_overflowtrap_enabled()) { + /* + * Adjust bias of result + */ + Sgl_setwrapped_exponent(result,dest_exponent,ovfl); + *dstptr = result; + if (inexact) { + if (Is_inexacttrap_enabled()) + return(OVERFLOWEXCEPTION | INEXACTEXCEPTION); + else Set_inexactflag(); } - return(OVERFLOWEXCEPTION); - } + return(OVERFLOWEXCEPTION); + } Set_overflowflag(); - /* set result to infinity or largest number */ + /* set result to infinity or largest number */ Sgl_setoverflow(result); inexact = TRUE; } - /* - * Test for underflow - */ + /* + * Test for underflow + */ else if (dest_exponent <= 0) { - /* trap if UNDERFLOWTRAP enabled */ - if (Is_underflowtrap_enabled()) { - /* - * Adjust bias of result - */ - Sgl_setwrapped_exponent(result,dest_exponent,unfl); - *dstptr = result; - if (inexact) { - if (Is_inexacttrap_enabled()) - return(UNDERFLOWEXCEPTION | INEXACTEXCEPTION); - else Set_inexactflag(); + /* trap if UNDERFLOWTRAP enabled */ + if (Is_underflowtrap_enabled()) { + /* + * Adjust bias of result + */ + Sgl_setwrapped_exponent(result,dest_exponent,unfl); + *dstptr = result; + if (inexact) { + if (Is_inexacttrap_enabled()) + return(UNDERFLOWEXCEPTION | INEXACTEXCEPTION); + else Set_inexactflag(); } - return(UNDERFLOWEXCEPTION); - } + return(UNDERFLOWEXCEPTION); + } /* Determine if should set underflow flag */ is_tiny = TRUE; if (dest_exponent == 0 && inexact) { switch (Rounding_mode()) { - case ROUNDPLUS: + case ROUNDPLUS: if (Sgl_iszero_sign(result)) { Sgl_increment(opnd3); if (Sgl_isone_hiddenoverflow(opnd3)) - is_tiny = FALSE; + is_tiny = FALSE; Sgl_decrement(opnd3); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Sgl_isone_sign(result)) { Sgl_increment(opnd3); if (Sgl_isone_hiddenoverflow(opnd3)) - is_tiny = FALSE; + is_tiny = FALSE; Sgl_decrement(opnd3); } break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Sgl_isone_lowmantissa(opnd3))) { - Sgl_increment(opnd3); + Sgl_increment(opnd3); if (Sgl_isone_hiddenoverflow(opnd3)) - is_tiny = FALSE; + is_tiny = FALSE; Sgl_decrement(opnd3); } break; } } - /* - * denormalize result or set to signed zero - */ + /* + * denormalize result or set to signed zero + */ stickybit = inexact; Sgl_denormalize(opnd3,dest_exponent,guardbit,stickybit,inexact); - /* return rounded number */ + /* return rounded number */ if (inexact) { switch (Rounding_mode()) { case ROUNDPLUS: @@ -368,20 +367,20 @@ unsigned int *status; Sgl_increment(opnd3); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Sgl_isone_sign(result)) { Sgl_increment(opnd3); } break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Sgl_isone_lowmantissa(opnd3))) { - Sgl_increment(opnd3); + Sgl_increment(opnd3); } break; } - if (is_tiny) Set_underflowflag(); - } + if (is_tiny) Set_underflowflag(); + } Sgl_set_exponentmantissa(result,opnd3); } else Sgl_set_exponent(result,dest_exponent); diff --git a/sys/arch/hppa/spmath/sfmpy.c b/sys/arch/hppa/spmath/sfmpy.c index 2368657fc07..9c219030dcf 100644 --- a/sys/arch/hppa/spmath/sfmpy.c +++ b/sys/arch/hppa/spmath/sfmpy.c @@ -1,25 +1,25 @@ -/* $OpenBSD: sfmpy.c,v 1.3 1998/07/02 19:05:58 mickey Exp $ */ +/* $OpenBSD: sfmpy.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. */ @@ -53,15 +53,15 @@ unsigned int *status; { register unsigned int opnd1, opnd2, opnd3, result; register int dest_exponent, count; - register boolean inexact = FALSE, guardbit = FALSE, stickybit = FALSE; - boolean is_tiny; + register int inexact = FALSE, guardbit = FALSE, stickybit = FALSE; + int is_tiny; opnd1 = *srcptr1; opnd2 = *srcptr2; - /* - * set sign bit of result + /* + * set sign bit of result */ - if (Sgl_sign(opnd1) ^ Sgl_sign(opnd2)) Sgl_setnegativezero(result); + if (Sgl_sign(opnd1) ^ Sgl_sign(opnd2)) Sgl_setnegativezero(result); else Sgl_setzero(result); /* * check first operand for NaN's or infinity @@ -70,55 +70,55 @@ unsigned int *status; if (Sgl_iszero_mantissa(opnd1)) { if (Sgl_isnotnan(opnd2)) { if (Sgl_iszero_exponentmantissa(opnd2)) { - /* - * invalid since operands are infinity - * and zero + /* + * invalid since operands are infinity + * and zero */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Sgl_makequietnan(result); + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + Set_invalidflag(); + Sgl_makequietnan(result); *dstptr = result; return(NOEXCEPTION); } /* - * return infinity - */ + * return infinity + */ Sgl_setinfinity_exponentmantissa(result); *dstptr = result; return(NOEXCEPTION); } } else { - /* - * is NaN; signaling or quiet? - */ - if (Sgl_isone_signaling(opnd1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd1); - } - /* - * is second operand a signaling NaN? + /* + * is NaN; signaling or quiet? + */ + if (Sgl_isone_signaling(opnd1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd1); + } + /* + * is second operand a signaling NaN? */ else if (Sgl_is_signalingnan(opnd2)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd2); - *dstptr = opnd2; - return(NOEXCEPTION); + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd2); + *dstptr = opnd2; + return(NOEXCEPTION); } - /* - * return quiet NaN - */ - *dstptr = opnd1; - return(NOEXCEPTION); + /* + * return quiet NaN + */ + *dstptr = opnd1; + return(NOEXCEPTION); } } /* @@ -128,10 +128,10 @@ unsigned int *status; if (Sgl_iszero_mantissa(opnd2)) { if (Sgl_iszero_exponentmantissa(opnd1)) { /* invalid since operands are zero & infinity */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Sgl_makequietnan(opnd2); + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + Set_invalidflag(); + Sgl_makequietnan(opnd2); *dstptr = opnd2; return(NOEXCEPTION); } @@ -142,25 +142,25 @@ unsigned int *status; *dstptr = result; return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Sgl_isone_signaling(opnd2)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* + * is NaN; signaling or quiet? + */ + if (Sgl_isone_signaling(opnd2)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd2); - } - /* - * return quiet NaN - */ - *dstptr = opnd2; - return(NOEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd2); + } + /* + * return quiet NaN + */ + *dstptr = opnd2; + return(NOEXCEPTION); } /* - * Generate exponent + * Generate exponent */ dest_exponent = Sgl_exponent(opnd1) + Sgl_exponent(opnd2) - SGL_BIAS; @@ -178,8 +178,8 @@ unsigned int *status; *dstptr = result; return(NOEXCEPTION); } - /* is denormalized, adjust exponent */ - Sgl_clear_signexponent(opnd1); + /* is denormalized, adjust exponent */ + Sgl_clear_signexponent(opnd1); Sgl_leftshiftby1(opnd1); Sgl_normalize(opnd1,dest_exponent); } @@ -194,9 +194,9 @@ unsigned int *status; *dstptr = result; return(NOEXCEPTION); } - /* is denormalized; want to normalize */ - Sgl_clear_signexponent(opnd2); - Sgl_leftshiftby1(opnd2); + /* is denormalized; want to normalize */ + Sgl_clear_signexponent(opnd2); + Sgl_leftshiftby1(opnd2); Sgl_normalize(opnd2,dest_exponent); } @@ -240,39 +240,39 @@ unsigned int *status; /* re-align mantissa */ Sgl_rightshiftby8(opnd3); - /* - * round result + /* + * round result */ if (inexact && (dest_exponent>0 || Is_underflowtrap_enabled())) { Sgl_clear_signexponent(opnd3); switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(result)) + case ROUNDPLUS: + if (Sgl_iszero_sign(result)) Sgl_increment(opnd3); break; - case ROUNDMINUS: - if (Sgl_isone_sign(result)) + case ROUNDMINUS: + if (Sgl_isone_sign(result)) Sgl_increment(opnd3); break; case ROUNDNEAREST: - if (guardbit) { - if (stickybit || Sgl_isone_lowmantissa(opnd3)) - Sgl_increment(opnd3); - } + if (guardbit && + (stickybit || Sgl_isone_lowmantissa(opnd3))) + Sgl_increment(opnd3); + break; } if (Sgl_isone_hidden(opnd3)) dest_exponent++; } Sgl_set_mantissa(result,opnd3); - /* - * Test for overflow - */ + /* + * Test for overflow + */ if (dest_exponent >= SGL_INFINITY_EXPONENT) { - /* trap if OVERFLOWTRAP enabled */ - if (Is_overflowtrap_enabled()) { - /* - * Adjust bias of result - */ + /* trap if OVERFLOWTRAP enabled */ + if (Is_overflowtrap_enabled()) { + /* + * Adjust bias of result + */ Sgl_setwrapped_exponent(result,dest_exponent,ovfl); *dstptr = result; if (inexact) { @@ -281,21 +281,21 @@ unsigned int *status; else Set_inexactflag(); } return(OVERFLOWEXCEPTION); - } + } inexact = TRUE; Set_overflowflag(); - /* set result to infinity or largest number */ + /* set result to infinity or largest number */ Sgl_setoverflow(result); } - /* - * Test for underflow - */ + /* + * Test for underflow + */ else if (dest_exponent <= 0) { - /* trap if UNDERFLOWTRAP enabled */ - if (Is_underflowtrap_enabled()) { - /* - * Adjust bias of result - */ + /* trap if UNDERFLOWTRAP enabled */ + if (Is_underflowtrap_enabled()) { + /* + * Adjust bias of result + */ Sgl_setwrapped_exponent(result,dest_exponent,unfl); *dstptr = result; if (inexact) { @@ -304,67 +304,64 @@ unsigned int *status; else Set_inexactflag(); } return(UNDERFLOWEXCEPTION); - } + } /* Determine if should set underflow flag */ is_tiny = TRUE; if (dest_exponent == 0 && inexact) { switch (Rounding_mode()) { - case ROUNDPLUS: + case ROUNDPLUS: if (Sgl_iszero_sign(result)) { Sgl_increment(opnd3); if (Sgl_isone_hiddenoverflow(opnd3)) - is_tiny = FALSE; + is_tiny = FALSE; Sgl_decrement(opnd3); } break; - case ROUNDMINUS: + case ROUNDMINUS: if (Sgl_isone_sign(result)) { Sgl_increment(opnd3); if (Sgl_isone_hiddenoverflow(opnd3)) - is_tiny = FALSE; + is_tiny = FALSE; Sgl_decrement(opnd3); } break; case ROUNDNEAREST: - if (guardbit && (stickybit || + if (guardbit && (stickybit || Sgl_isone_lowmantissa(opnd3))) { - Sgl_increment(opnd3); + Sgl_increment(opnd3); if (Sgl_isone_hiddenoverflow(opnd3)) - is_tiny = FALSE; + is_tiny = FALSE; Sgl_decrement(opnd3); } break; } } - /* - * denormalize result or set to signed zero - */ + /* + * denormalize result or set to signed zero + */ stickybit = inexact; Sgl_denormalize(opnd3,dest_exponent,guardbit,stickybit,inexact); /* return zero or smallest number */ if (inexact) { switch (Rounding_mode()) { - case ROUNDPLUS: - if (Sgl_iszero_sign(result)) { + case ROUNDPLUS: + if (Sgl_iszero_sign(result)) Sgl_increment(opnd3); - } break; - case ROUNDMINUS: - if (Sgl_isone_sign(result)) { + case ROUNDMINUS: + if (Sgl_isone_sign(result)) Sgl_increment(opnd3); - } break; case ROUNDNEAREST: - if (guardbit && (stickybit || - Sgl_isone_lowmantissa(opnd3))) { - Sgl_increment(opnd3); - } + if (guardbit && (stickybit || + Sgl_isone_lowmantissa(opnd3))) + Sgl_increment(opnd3); break; } - if (is_tiny) Set_underflowflag(); + if (is_tiny) Set_underflowflag(); } Sgl_set_exponentmantissa(result,opnd3); } diff --git a/sys/arch/hppa/spmath/sfrem.c b/sys/arch/hppa/spmath/sfrem.c index 8a51e9f1088..fb6c4597f27 100644 --- a/sys/arch/hppa/spmath/sfrem.c +++ b/sys/arch/hppa/spmath/sfrem.c @@ -1,25 +1,25 @@ -/* $OpenBSD: sfrem.c,v 1.3 1998/07/02 19:05:59 mickey Exp $ */ +/* $OpenBSD: sfrem.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. */ @@ -54,7 +54,7 @@ unsigned int *status; { register unsigned int opnd1, opnd2, result; register int opnd1_exponent, opnd2_exponent, dest_exponent, stepcount; - register boolean roundup = FALSE; + register int roundup = FALSE; opnd1 = *srcptr1; opnd2 = *srcptr2; @@ -65,46 +65,46 @@ unsigned int *status; if (Sgl_iszero_mantissa(opnd1)) { if (Sgl_isnotnan(opnd2)) { /* invalid since first operand is infinity */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - Set_invalidflag(); - Sgl_makequietnan(result); + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + Set_invalidflag(); + Sgl_makequietnan(result); *dstptr = result; return(NOEXCEPTION); } } else { - /* - * is NaN; signaling or quiet? - */ - if (Sgl_isone_signaling(opnd1)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd1); - } - /* - * is second operand a signaling NaN? + /* + * is NaN; signaling or quiet? + */ + if (Sgl_isone_signaling(opnd1)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd1); + } + /* + * is second operand a signaling NaN? */ else if (Sgl_is_signalingnan(opnd2)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) - return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd2); - *dstptr = opnd2; - return(NOEXCEPTION); + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) + return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd2); + *dstptr = opnd2; + return(NOEXCEPTION); } - /* - * return quiet NaN - */ - *dstptr = opnd1; - return(NOEXCEPTION); + /* + * return quiet NaN + */ + *dstptr = opnd1; + return(NOEXCEPTION); } - } + } /* * check second operand for NaN's or infinity */ @@ -113,24 +113,24 @@ unsigned int *status; /* * return first operand */ - *dstptr = opnd1; + *dstptr = opnd1; return(NOEXCEPTION); } - /* - * is NaN; signaling or quiet? - */ - if (Sgl_isone_signaling(opnd2)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(opnd2); - } - /* - * return quiet NaN - */ - *dstptr = opnd2; - return(NOEXCEPTION); + /* + * is NaN; signaling or quiet? + */ + if (Sgl_isone_signaling(opnd2)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(opnd2); + } + /* + * return quiet NaN + */ + *dstptr = opnd2; + return(NOEXCEPTION); } /* * check second operand for zero @@ -138,18 +138,18 @@ unsigned int *status; if (Sgl_iszero_exponentmantissa(opnd2)) { /* invalid since second operand is zero */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - Set_invalidflag(); - Sgl_makequietnan(result); + Set_invalidflag(); + Sgl_makequietnan(result); *dstptr = result; return(NOEXCEPTION); } - /* + /* * get sign of result */ - result = opnd1; + result = opnd1; - /* + /* * check for denormalized operands */ if (opnd1_exponent == 0) { @@ -185,18 +185,18 @@ unsigned int *status; /* * check for opnd1/opnd2 > 1/2 * - * In this case n will round to 1, so - * r = opnd1 - opnd2 + * In this case n will round to 1, so + * r = opnd1 - opnd2 */ if (stepcount == -1 && Sgl_isgreaterthan(opnd1,opnd2)) { Sgl_all(result) = ~Sgl_all(result); /* set sign */ /* align opnd2 with opnd1 */ - Sgl_leftshiftby1(opnd2); + Sgl_leftshiftby1(opnd2); Sgl_subtract(opnd2,opnd1,opnd2); /* now normalize */ - while (Sgl_iszero_hidden(opnd2)) { - Sgl_leftshiftby1(opnd2); - dest_exponent--; + while (Sgl_iszero_hidden(opnd2)) { + Sgl_leftshiftby1(opnd2); + dest_exponent--; } Sgl_set_exponentmantissa(result,opnd2); goto testforunderflow; @@ -204,7 +204,7 @@ unsigned int *status; /* * opnd1/opnd2 <= 1/2 * - * In this case n will round to zero, so + * In this case n will round to zero, so * r = opnd1 */ Sgl_set_exponentmantissa(result,opnd1); @@ -223,8 +223,8 @@ unsigned int *status; Sgl_leftshiftby1(opnd1); } /* - * Do last subtract, then determine which way to round if remainder - * is exactly 1/2 of opnd2 + * Do last subtract, then determine which way to round if remainder + * is exactly 1/2 of opnd2 */ if (Sgl_isnotlessthan(opnd1,opnd2)) { Sgl_subtract(opnd1,opnd2,opnd1); @@ -237,8 +237,8 @@ unsigned int *status; return(NOEXCEPTION); } - /* - * Check for cases where opnd1/opnd2 < n + /* + * Check for cases where opnd1/opnd2 < n * * In this case the result's sign will be opposite that of * opnd1. The mantissa also needs some correction. @@ -249,39 +249,38 @@ unsigned int *status; Sgl_subtract((opnd2<<1),opnd1,opnd1); } /* check for remainder being exactly 1/2 of opnd2 */ - else if (Sgl_isequal(opnd1,opnd2) && roundup) { + else if (Sgl_isequal(opnd1,opnd2) && roundup) { Sgl_invert_sign(result); } /* normalize result's mantissa */ - while (Sgl_iszero_hidden(opnd1)) { - dest_exponent--; - Sgl_leftshiftby1(opnd1); - } + while (Sgl_iszero_hidden(opnd1)) { + dest_exponent--; + Sgl_leftshiftby1(opnd1); + } Sgl_set_exponentmantissa(result,opnd1); - /* - * Test for underflow - */ + /* + * Test for underflow + */ testforunderflow: if (dest_exponent <= 0) { - /* trap if UNDERFLOWTRAP enabled */ - if (Is_underflowtrap_enabled()) { - /* - * Adjust bias of result - */ - Sgl_setwrapped_exponent(result,dest_exponent,unfl); + /* trap if UNDERFLOWTRAP enabled */ + if (Is_underflowtrap_enabled()) { + /* + * Adjust bias of result + */ + Sgl_setwrapped_exponent(result,dest_exponent,unfl); *dstptr = result; /* frem is always exact */ return(UNDERFLOWEXCEPTION); - } - /* - * denormalize result or set to signed zero - */ - if (dest_exponent >= (1 - SGL_P)) { + } + /* + * denormalize result or set to signed zero + */ + if (dest_exponent >= (1 - SGL_P)) { Sgl_rightshift_exponentmantissa(result,1-dest_exponent); - } - else { + } else { Sgl_setzero_exponentmantissa(result); } } diff --git a/sys/arch/hppa/spmath/sfsqrt.c b/sys/arch/hppa/spmath/sfsqrt.c index 95d08afa2ac..c6a14d697d2 100644 --- a/sys/arch/hppa/spmath/sfsqrt.c +++ b/sys/arch/hppa/spmath/sfsqrt.c @@ -1,25 +1,25 @@ -/* $OpenBSD: sfsqrt.c,v 1.4 2000/01/11 08:18:43 mickey Exp $ */ +/* $OpenBSD: sfsqrt.c,v 1.5 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. */ @@ -55,44 +55,44 @@ unsigned int *status; { register unsigned int src, result; register int src_exponent, newbit, sum; - register boolean guardbit = FALSE, even_exponent; + register int guardbit = FALSE, even_exponent; src = *srcptr; - /* - * check source operand for NaN or infinity - */ - if ((src_exponent = Sgl_exponent(src)) == SGL_INFINITY_EXPONENT) { - /* - * is signaling NaN? - */ - if (Sgl_isone_signaling(src)) { - /* trap if INVALIDTRAP enabled */ - if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); - /* make NaN quiet */ - Set_invalidflag(); - Sgl_set_quiet(src); - } - /* - * Return quiet NaN or positive infinity. + /* + * check source operand for NaN or infinity + */ + if ((src_exponent = Sgl_exponent(src)) == SGL_INFINITY_EXPONENT) { + /* + * is signaling NaN? + */ + if (Sgl_isone_signaling(src)) { + /* trap if INVALIDTRAP enabled */ + if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); + /* make NaN quiet */ + Set_invalidflag(); + Sgl_set_quiet(src); + } + /* + * Return quiet NaN or positive infinity. * Fall thru to negative test if negative infinity. - */ + */ if (Sgl_iszero_sign(src) || Sgl_isnotzero_mantissa(src)) { - *dstptr = src; - return(NOEXCEPTION); + *dstptr = src; + return(NOEXCEPTION); } - } + } - /* - * check for zero source operand - */ + /* + * check for zero source operand + */ if (Sgl_iszero_exponentmantissa(src)) { *dstptr = src; return(NOEXCEPTION); } - /* - * check for negative source operand - */ + /* + * check for negative source operand + */ if (Sgl_isone_sign(src)) { /* trap if INVALIDTRAP enabled */ if (Is_invalidtrap_enabled()) return(INVALIDEXCEPTION); @@ -124,7 +124,7 @@ unsigned int *status; } /* * Add comment here. Explain following algorithm. - * + * * Trust me, it works. * */ @@ -147,7 +147,7 @@ unsigned int *status; /* check for inexact */ if (Sgl_isnotzero(src)) { - if (!even_exponent & Sgl_islessthan(result,src)) + if (!even_exponent & Sgl_islessthan(result,src)) Sgl_increment(result); guardbit = Sgl_lowmantissa(result); Sgl_rightshiftby1(result); @@ -158,7 +158,7 @@ unsigned int *status; Sgl_increment(result); break; case ROUNDNEAREST: - /* stickybit is always true, so guardbit + /* stickybit is always true, so guardbit * is enough to determine rounding */ if (guardbit) { Sgl_increment(result); 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; diff --git a/sys/arch/hppa/spmath/sgl_float.h b/sys/arch/hppa/spmath/sgl_float.h index dd36669753f..5081f68f056 100644 --- a/sys/arch/hppa/spmath/sgl_float.h +++ b/sys/arch/hppa/spmath/sgl_float.h @@ -1,24 +1,24 @@ -/* $OpenBSD: sgl_float.h,v 1.4 2000/01/11 08:25:08 mickey Exp $ */ +/* $OpenBSD: sgl_float.h,v 1.5 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 @@ -26,15 +26,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. */ @@ -82,12 +82,12 @@ #define Sgl_leftshiftby1_withextent(left,right,result) \ Shiftdouble(Sall(left),Extall(right),31,Sall(result)) - + #define Sgl_rightshiftby1_withextent(left,right,dst) \ Shiftdouble(Sall(left),Extall(right),1,Extall(right)) #define Sgl_arithrightshiftby1(srcdst) \ Sall(srcdst) = (int)Sall(srcdst) >> 1 - + /* Sign extend the sign bit with an integer destination */ #define Sgl_signextendedsign(value) Ssignedsign(value) @@ -125,9 +125,9 @@ #define Sgl_iszero_mantissa(sgl_value) (Smantissa(sgl_value)==0) #define Sgl_iszero_exponentmantissa(sgl_value) \ (Sexponentmantissa(sgl_value)==0) -#define Sgl_isinfinity_exponent(sgl_value) \ +#define Sgl_isinfinity_exponent(sgl_value) \ (Sgl_exponent(sgl_value)==SGL_INFINITY_EXPONENT) -#define Sgl_isnotinfinity_exponent(sgl_value) \ +#define Sgl_isnotinfinity_exponent(sgl_value) \ (Sgl_exponent(sgl_value)!=SGL_INFINITY_EXPONENT) #define Sgl_isinfinity(sgl_value) \ (Sgl_exponent(sgl_value)==SGL_INFINITY_EXPONENT && \ @@ -163,11 +163,11 @@ Sall(sgl_value) >>= 4 #define Sgl_rightshiftby8(sgl_value) \ Sall(sgl_value) >>= 8 - + #define Sgl_ismagnitudeless(signlessleft,signlessright) \ /* unsigned int signlessleft, signlessright; */ \ - (signlessleft < signlessright) - + (signlessleft < signlessright) + #define Sgl_copytoint_exponentmantissa(source,dest) \ dest = Sexponentmantissa(source) @@ -215,23 +215,23 @@ #define Sgl_setwrapped_exponent(sgl_value,exponent,op) \ Deposit_sexponent(sgl_value,(exponent op SGL_WRAP)) -#define Sgl_setlargestpositive(sgl_value) \ - Sall(sgl_value) = ((SGL_EMAX+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ - | ((1<<(32-(1+SGL_EXP_LENGTH))) - 1) +#define Sgl_setlargestpositive(sgl_value) \ + Sall(sgl_value) = ((FLT_MAX_EXP+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ + | ((1<<(32-(1+SGL_EXP_LENGTH))) - 1) #define Sgl_setlargestnegative(sgl_value) \ - Sall(sgl_value) = ((SGL_EMAX+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ - | ((1<<(32-(1+SGL_EXP_LENGTH))) - 1 ) | (1<<31) + Sall(sgl_value) = ((FLT_MAX_EXP+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ + | ((1<<(32-(1+SGL_EXP_LENGTH))) - 1 ) | (1<<31) #define Sgl_setnegativeinfinity(sgl_value) \ - Sall(sgl_value) = \ + Sall(sgl_value) = \ ((1<<SGL_EXP_LENGTH) | SGL_INFINITY_EXPONENT) << (32-(1+SGL_EXP_LENGTH)) -#define Sgl_setlargest(sgl_value,sign) \ +#define Sgl_setlargest(sgl_value,sign) \ Sall(sgl_value) = ((sign) << 31) | \ - (((SGL_EMAX+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ + (((FLT_MAX_EXP+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ | ((1 << (32-(1+SGL_EXP_LENGTH))) - 1 )) #define Sgl_setlargest_exponentmantissa(sgl_value) \ Sall(sgl_value) = (Sall(sgl_value) & (1<<31)) | \ - (((SGL_EMAX+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ + (((FLT_MAX_EXP+SGL_BIAS) << (32-(1+SGL_EXP_LENGTH))) \ | ((1 << (32-(1+SGL_EXP_LENGTH))) - 1 )) /* The high bit is always zero so arithmetic or logical shifts will work. */ @@ -239,7 +239,7 @@ /* sgl_floating_point srcdst; int shift; extension extent */ \ if (shift < 32) { \ Extall(extent) = Sall(srcdst) << (32-(shift)); \ - Sall(srcdst) >>= shift; \ + Sall(srcdst) >>= shift; \ } \ else { \ Extall(extent) = Sall(srcdst); \ @@ -272,11 +272,11 @@ /* Need to Initialize */ #define Sgl_makequietnan(dest) \ - Sall(dest) = ((SGL_EMAX+SGL_BIAS)+1)<< (32-(1+SGL_EXP_LENGTH)) \ - | (1<<(32-(1+SGL_EXP_LENGTH+2))) + Sall(dest) = ((FLT_MAX_EXP+SGL_BIAS)+1)<< (32-(1+SGL_EXP_LENGTH)) \ + | (1<<(32-(1+SGL_EXP_LENGTH+2))) #define Sgl_makesignalingnan(dest) \ - Sall(dest) = ((SGL_EMAX+SGL_BIAS)+1)<< (32-(1+SGL_EXP_LENGTH)) \ - | (1<<(32-(1+SGL_EXP_LENGTH+1))) + Sall(dest) = ((FLT_MAX_EXP+SGL_BIAS)+1)<< (32-(1+SGL_EXP_LENGTH)) \ + | (1<<(32-(1+SGL_EXP_LENGTH+1))) #define Sgl_normalize(sgl_opnd,exponent) \ while(Sgl_iszero_hiddenhigh7mantissa(sgl_opnd)) { \ |