* Copyright (c) 1986 Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#if defined(SYSLIBC_SCCS) && !defined(lint)
.asciz "@(#)addf.s 1.2 (Berkeley) %G%"
#endif /* SYSLIBC_SCCS and not lint */
#include <tahoemath//fp.h>
XENTRY(addf, R2|R3|R4|R5|R6|R7|R8|R9|R10)
* see which operand has a greater exponent
* The greater one will be fetched into r0,r2,r3.
* r0- 'pure' fraction, r2 - exponent, r3 - sign).
* The smaller operand will be fetched into r4,r6,r7.
movl 12(fp),r0 # bigger operand to r0
movl 4(fp),r4 # smaller operand to r4
movl 4(fp),r0 # bigger operand to r0
movl 12(fp),r4 # smaller operand to r4
andl3 $EXPMASK,r0,r2 # r2 will hold the exponent of greater operand.
jeql is_res1 # check for reserved operand.
andl3 $EXPMASK,r4,r6 # r6 will hold the exponent of smaller operand.
jeql is_res2 # check for reserved operand.
ret # return the bigger number.
bbc $31,r0,sign2 # if negative remember it.(R3=1)
bbc $31,r4,frac # if negative remember it.(R7=1)
*compute 'pure' fraction:
# clear the non fraction parts.
andl2 $(0!(EXPMASK | SIGNBIT)),r0
# clear the non fraction parts.
andl2 $(0!(EXPMASK | SIGNBIT)),r4
*shift the smaller operand:
bbs $0,r3,negative # the bigger operand was negative.
movl r4,r0 # return the smaller operand.
ret # we allready have the 'result' in r0,r1.