2005-01-09 Joerg Wunsch * libm/fplib/addsf3.S: Make labels local, add Id line. * libm/fplib/addsf3x.S: (Ditto.) * libm/fplib/asin.S: (Ditto.) * libm/fplib/ceil.S: (Ditto.) * libm/fplib/cos.S: (Ditto.) * libm/fplib/cosh.S: (Ditto.) * libm/fplib/divsf3.S: (Ditto.) * libm/fplib/divsf3x.S: (Ditto.) * libm/fplib/exp.S: (Ditto.) * libm/fplib/fixsfsi.S: (Ditto.) * libm/fplib/floatsisf.S: (Ditto.) * libm/fplib/floor.S: (Ditto.) * libm/fplib/fp_cmp.S: (Ditto.) * libm/fplib/fp_cosinus.S: (Ditto.) * libm/fplib/fp_flashconst.S: (Ditto.) * libm/fplib/fp_merge.S: (Ditto.) * libm/fplib/fp_nan.S: (Ditto.) * libm/fplib/fp_powerseries.S: (Ditto.) * libm/fplib/fp_split.S: (Ditto.) * libm/fplib/fp_zero.S: (Ditto.) * libm/fplib/frexp.S: (Ditto.) * libm/fplib/ldexp.S: (Ditto.) * libm/fplib/log.S: (Ditto.) * libm/fplib/log10.S: (Ditto.) * libm/fplib/modf.S: (Ditto.) * libm/fplib/mulsf3.S: (Ditto.) * libm/fplib/mulsf3x.S: (Ditto.) * libm/fplib/negsf2.S: (Ditto.) * libm/fplib/pow.S: (Ditto.) * libm/fplib/sin.S: (Ditto.) * libm/fplib/sinh.S: (Ditto.) * libm/fplib/sqrt.S: (Ditto.) * libm/fplib/strtod.S: (Ditto.) * libm/fplib/tan.S: (Ditto.) * libm/fplib/tanh.S: (Ditto.) Index: libm/fplib/addsf3.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/addsf3.S,v retrieving revision 1.2 diff -u -r1.2 addsf3.S --- libm/fplib/addsf3.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/addsf3.S 9 Jan 2005 21:52:45 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* addsf3.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/addsf3x.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/addsf3x.S,v retrieving revision 1.3 diff -u -r1.3 addsf3x.S --- libm/fplib/addsf3x.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/addsf3x.S 9 Jan 2005 21:52:45 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* addsf3x.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -59,12 +61,12 @@ CPC rA1,rB1 ; CPC rA2,rB2 ; CPC rA3,rB3 ; A - B - BREQ ___addsf3x_300 - BRCC ___addsf3x_100 ; A >= B + BREQ 300f + BRCC 100f ; A >= B - BRTC ___addsf3x_01 ; if T clear the A & B of same sign + BRTC 1f ; if T clear the A & B of same sign COM rT1c ; else complement sign - ___addsf3x_01: +1: MOV rT0,rAE MOV rAE,rBE MOV rBE,rT0 @@ -82,54 +84,54 @@ MOV rB3,rT0 ; now A > B - ___addsf3x_100: ; denormalize lower mantissa until exponents are the same +100: ; denormalize lower mantissa until exponents are the same CLR rTI0 ; holds mantissa extension beyond rBE TST rB3 ; - BREQ ___addsf3x_130 ; A + 0 + BREQ 50f ; A + 0 SUB rB3,rA3 ; get difference, rB3 negative - BREQ ___addsf3x_120 ; same : no shift + BREQ 2f ; same : no shift CPI rB3,LOW(-25) ; no significant digits left after shift - BRCS ___addsf3x_130 ; - ___addsf3x_110: ; + BRCS 50f ; +1: ; LSR rB2 ; ROR rB1 ; ROR rB0 ; ROR rBE ; fraction >> 1 ; SBCI rTI0,0 ; mark if any overflow beyond rBE ; INC rB3 ; exponent ++ - BRNE ___addsf3x_110 ; + BRNE 1b - ___addsf3x_120: - BRTS ___addsf3x_200 ; branch if different sign +2: + BRTS 200f ; branch if different sign ADD rAE,rBE ; maybe rAE and rBE are preset adc rA0,rB0 ; adc rA1,rB1 ; adc rA2,rB2 ; add both mantissae - BRCC ___addsf3x_130 ; no fraction overflow if C = 0 + BRCC 50f ; no fraction overflow if C = 0 ROR rA2 ; correct overflow ROR rA1 ROR rA0 ROR rAE ; fraction >> 1 SBCI rTI0,0 ; mark if any overflow beyond rBE INC rA3 ; exponent++ - ___addsf3x_130: +50: BST rT1c,7 MOV rT0,rTI0 RET - ___addsf3x_200: +200: SUB rAE,rTI0 ; extended mantissa : 0 - lost bits CLR rAE SBC rAE,rBE ; subtract the lower from the larger SBC rA0,rB0 ; extended mantissa : if rBE == 0x80 -> rAE = 0x80 SBC rA1,rB1 ; SBC rA2,rB2 ; - RJMP ___addsf3x_130 ; + RJMP 50b ; ; A == B - ___addsf3x_300: - BRTC ___addsf3x_100 ; same sign, test for zero & add +300: + BRTC 100b ; same sign, test for zero & add RJMP _U(__fp_zerox) ; different signs ENDFUNC Index: libm/fplib/asin.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/asin.S,v retrieving revision 1.5 diff -u -r1.5 asin.S --- libm/fplib/asin.S 7 Jan 2005 21:16:25 -0000 1.5 +++ libm/fplib/asin.S 9 Jan 2005 21:52:45 -0000 @@ -66,11 +66,11 @@ CPC rA1, __zero_reg__ CPC rA2, rB2 CPC rA3, rB3 ; A - 1.0000001192092896 - BRCS _asin_calc ; A <= 1.0 + BRCS 1f ; A <= 1.0 XCALL (__fp_nanEDOM) ; A > 1.0 -> argument range error POP sign ; clean-up RET ; return with NAN - _asin_calc: ; here x <= 1.0 +1: ; here x <= 1.0 PUSH rA3 PUSH rA2 PUSH rA1 @@ -129,7 +129,7 @@ PGM_SECTION - table_asin: DCB 7 +table_asin: DCB 7 DCB 0x75, 0xA5, 0x7A, 0x2C ; P7 DCB 0x77, 0x5A, 0x90, 0xC5 ; P6 DCB 0x79, 0x8B, 0xFC, 0x66 ; P5 Index: libm/fplib/ceil.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/ceil.S,v retrieving revision 1.2 diff -u -r1.2 ceil.S --- libm/fplib/ceil.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/ceil.S 9 Jan 2005 21:52:46 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* ceil.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -67,36 +69,36 @@ RCALL _U(__fp_split1) ; split up in sign : exp : fraction : fraction extention ; x T R19 R18:rSI0:R16: R1 CPI rA3,0x7F ; Exp >= 0x7F -> arg >= 1.0 - BRCC _ceil_100 ; - BRTS _ceil_01 ; |arg| < 1.0 -> ceil = / 1.0 fr X > 0.0 + BRCC 100f + BRTS 1f ; |arg| < 1.0 -> ceil = / 1.0 fr X > 0.0 TST rA3 ; \ 0.0 fr X <= 0.0 - BREQ _ceil_01 + BREQ 1f LDI rA3,0x3F LDI rA2,0x80 CLR rA1 CLR rA0 RET - _ceil_01: +1: RJMP _U(__fp_zero) - _ceil_100_1: +1: LSR rA2 ; ROR rA1 ; shift out fractional bits to the right ROR rA0 ; until mantissa is a normalized unsigned adc rAE,rT1c ; rAE cleard by fp_split1, rT1c = __zero_reg__ INC rA3 ; ; |arg| >= 1.0 - _ceil_100: ; |arg| >= 1.0 +100: ; |arg| >= 1.0 CPI rA3,0x96 ; - BRCS _ceil_100_1; + BRCS 1b - _ceil_200: - BRTS _ceil_300 ; LSB now is exactely 1 or greater +2: + BRTS 3f ; LSB now is exactely 1 or greater TST rAE ; any bit shiftet out? if LSB > 1 then rAE is zero - BREQ _ceil_300 ; no! + BREQ 3f ; no! SUBI rA0,0xFF ; else next bigger value SBCI rA1,0xFF SBCI rA2,0xFF - _ceil_300: +3: CLR rAE ; rT0 must not be cleared : rAE=0 no rounding anyway RJMP _U(__fp_merge) Index: libm/fplib/cos.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/cos.S,v retrieving revision 1.3 diff -u -r1.3 cos.S --- libm/fplib/cos.S 7 Jan 2005 21:16:25 -0000 1.3 +++ libm/fplib/cos.S 9 Jan 2005 21:52:46 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* cos.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/cosh.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/cosh.S,v retrieving revision 1.3 diff -u -r1.3 cosh.S --- libm/fplib/cosh.S 7 Jan 2005 21:16:25 -0000 1.3 +++ libm/fplib/cosh.S 9 Jan 2005 21:52:46 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* cosh.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/divsf3.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/divsf3.S,v retrieving revision 1.3 diff -u -r1.3 divsf3.S --- libm/fplib/divsf3.S 7 Jan 2005 21:16:25 -0000 1.3 +++ libm/fplib/divsf3.S 9 Jan 2005 21:52:46 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* divsf3.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/divsf3x.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/divsf3x.S,v retrieving revision 1.2 diff -u -r1.2 divsf3x.S --- libm/fplib/divsf3x.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/divsf3x.S 9 Jan 2005 21:52:46 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id $*/ + /* divsf3x.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -54,35 +56,34 @@ GLOBAL(__divsf3x) TST rB3 - BREQ ___divsf3x_INF ; even 0/0 + BREQ 10f ; even 0/0 TST rA3 - BREQ ___divsf3x_ZERO ; 0/x = 0 + BREQ 20f ; 0/x = 0 ;calculate new exponent & check for overflow underflow ; rA3 = rA3-rB3+0x7F - ___divsf3x_10: SUBI rA3,0x7F ; both exponents signed char now SUBI rB3,0x7F ; both exponents signed char now SUB rA3,rB3 ; calcualte new exponent - BRVC ___divsf3x_100 ; no signed overflow? - BRPL ___divsf3x_ZERO ; underflow + BRVC 1f ; no signed overflow? + BRPL 20f ; underflow CPI rA3,0x80 ; if exp(A) - exp(B) = exp(R) == 0x80 - BRNE ___divsf3x_INF ; and mant(A) < mant(B) exp(R) will be dec + BRNE 10f ; and mant(A) < mant(B) exp(R) will be dec SUBI rA3,0x81 ; - RJMP ___divsf3x_110 ; - ___divsf3x_INF: + RJMP 2f +10: RJMP _U(__fp_nanx) ; returns to ___mulsf3 or a high level function : rT1c ok - ___divsf3x_100: +1: SUBI rA3,0x81 ; add 0x7F CPI rA3,0xFF ; - BRNE ___divsf3x_110 ; underflow? - ___divsf3x_ZERO: + BRNE 2f ; underflow? +20: RJMP _U(__fp_zerox) - ___divsf3x_110: +2: CLR rAE ; high extention CLR rT1c ; for comparison ; (some functions call ___divsf3x directely @@ -95,7 +96,7 @@ CPC rA1,rB1 CPC rA2,rB2 ; CPC rAE,rBE ; upper extention, both cleared (?) - BRCC ___divsf3x_140 + BRCC 1f ; if A < B the result would be < 1.0 -> ; assure we have 25 bits of precision in the end ADD rA0,rA0 @@ -103,16 +104,15 @@ adc rA2,rA2 adc rAE,rAE SUBI rA3,1 - BRCS ___divsf3x_ZERO - ___divsf3x_140: + BRCS 20b +1: ; AM >= BM - RCALL ___divsf3x_loop200 + RCALL 200f PUSH rT0 - RCALL ___divsf3x_loop200 + RCALL 200f PUSH rT0 - RCALL ___divsf3x_loop200 + RCALL 200f - ___divsf3x_300: ; division done : if AM(rest) > BM the next digit would be set and more -> round up ; if AM(rest) == BM exactely the next digit would be set -> round to LSB zero ; else do not round up @@ -121,10 +121,10 @@ CPC rB1,rA1 CPC rB2,rA2 CPC rT1c,rAE ; - BREQ ___divsf3x_310 ; AM == BM round to LSB zero + BREQ 1f ; AM == BM round to LSB zero SBCI rBE,0x80 ; if AM > BM c is set - ___divsf3x_310: +1: MOV rAE,rBE MOV rA0,rT0 POP rA1 @@ -132,27 +132,27 @@ CLR rT0 ; RET - ___divsf3x_loop200: +200: LDI rBE,0x80 CLR rT0 ; result holder - ___divsf3x_loop210: +1: CP rA0,rB0 CPC rA1,rB1 CPC rA2,rB2 CPC rAE,rT1c - BRCS ___divsf3x_loop211 + BRCS 2f SUB rA0,rB0 SBC rA1,rB1 SBC rA2,rB2 SBC rAE,rT1c OR rT0,rBE - ___divsf3x_loop211: +2: ADD rA0,rA0 ; adc rA1,rA1 ; adc rA2,rA2 ; adc rAE,rAE ; LSR rBE - BRNE ___divsf3x_loop210 + BRNE 1b RET ENDFUNC Index: libm/fplib/exp.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/exp.S,v retrieving revision 1.4 diff -u -r1.4 exp.S --- libm/fplib/exp.S 7 Jan 2005 21:16:25 -0000 1.4 +++ libm/fplib/exp.S 9 Jan 2005 21:52:47 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* exp.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -55,7 +57,7 @@ GLOBAL(exp) MOV rT0,rA3 TST rA3 - BRMI _exp_100 + BRMI 1f LDI rB3,0x42 LDI rB2,0xB1 LDI rB1,0x72 @@ -63,10 +65,10 @@ CPC rA1,rB1 CPC rA2,rB2 CPC rA3,rB3 ; compare with 88.72283935546875 = | ln(FLT_MAX) | - BRCS _exp_200 ; no overflow + BRCS 2f ; no overflow RJMP _U(__fp_nanERANGE) - _exp_100: ; A < 0, check for underflow +1: ; A < 0, check for underflow ANDI rA3,0x7F LDI rB3,0x42 LDI rB2,0xAE @@ -75,10 +77,10 @@ CPC rA1,rB1 CPC rA2,rB2 CPC rA3,rB3 ; compare with 87.3365478515625 = | ln(FLT_MIN) | - BRCS _exp_200 ; no underflow + BRCS 2f ; no underflow RJMP _U(__fp_zero) - _exp_200: +2: PUSH rT0 ; push sign only LDI rB3,0x3F LDI rB2,0xB8 @@ -114,15 +116,15 @@ SUB rTI0,rB3 ; CLR rB3 ORI rB2,0x80 - RJMP _exp_300 - _exp_200_1: + RJMP 2f +1: LSR rB2 ROR rB1 ROR rB0 ROR rB3 - _exp_300: +2: DEC rTI0 - BRPL _exp_200_1 + BRPL 1b ; now rB2::rB0:rB3 = long integer (only rB3 should be set) MOV rB2,rB3 ADD rB3,rB3 Index: libm/fplib/fixsfsi.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fixsfsi.S,v retrieving revision 1.2 diff -u -r1.2 fixsfsi.S --- libm/fplib/fixsfsi.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/fixsfsi.S 9 Jan 2005 21:52:47 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fixsfsi.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -54,27 +56,27 @@ BST rA3,7 RCALL _U(__fp_split1) cpi rA3,0x7F - brcs ___fixsfsi_zero ; fabs(x) < 1.0, shift count >= 32 + brcs 1f ; fabs(x) < 1.0, shift count >= 32 LDI rTI0,0x7F+31 SUB rTI0,rA3 MOV rA3,rA2 MOV rA2,rA1 MOV rA1,rA0 MOV rA0,rAE - RJMP ___fixsfsi_10 + RJMP 5f - ___fixsfsi_zero: +1: rjmp _U(__fp_zero) - ___fixsfsi_05: +2: LSR rA3 ROR rA2 ROR rA1 ROR rA0 - ___fixsfsi_10: +5: SUBI rTI0,1 - BRCC ___fixsfsi_05 - BRTC no_neg + BRCC 2b + BRTC 1f /* TEXT_SEG(fp_lneg) */ GLOBAL(__fp_lneg) COM rA3 @@ -84,7 +86,7 @@ SBCI rA1,0xFF SBCI rA2,0xFF SBCI rA3,0xFF - no_neg: +1: RET ENDFUNC Index: libm/fplib/floatsisf.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/floatsisf.S,v retrieving revision 1.3 diff -u -r1.3 floatsisf.S --- libm/fplib/floatsisf.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/floatsisf.S 9 Jan 2005 21:52:47 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* floatsisf.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -52,7 +54,7 @@ GLOBAL(__floatunssisf) ; - convert signed long to float CLT ; fp_merge expects T:sign - RJMP ___floatsisf_10 + RJMP 1f /*------------------------------------------------------------------------------------------- * A = (float)(signed long)A @@ -60,9 +62,9 @@ GLOBAL(__floatsisf) ; - convert signed long to float BST rA3,7 ; fp_merge expects T:sign - BRTC ___floatsisf_10 + BRTC 1f RCALL _U(__fp_lneg) - ___floatsisf_10: +1: MOV rAE,rA0 ; rA2::rA0:rAE mantissa MOV rA0,rA1 MOV rA1,rA2 Index: libm/fplib/floor.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/floor.S,v retrieving revision 1.2 diff -u -r1.2 floor.S --- libm/fplib/floor.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/floor.S 9 Jan 2005 21:52:47 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* floor.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -58,32 +60,32 @@ RCALL _U(__fp_split1) ; split up in sign : exp : fraction : fraction extention ; x T R19 R18:rSI0:R16: R1 CPI rA3,0x7F ; Exp >= 0x7F -> arg >= 1.0 - BRCC _floor_100 ; - BRTS _floor_01 ; |arg| < 1.0 -> floor = / 0.0 fr X >= 0.0 + BRCC 3f + BRTS 1f ; |arg| < 1.0 -> floor = / 0.0 fr X >= 0.0 RJMP _U(__fp_zero) ; \ -1.0 fr X < 0.0 - _floor_01: +1: LDI rA3,0xBF LDI rA2,0x80 CLR rA1 CLR rA0 RET - _floor_100_1: +2: LSR rA2 ; ROR rA1 ; shift out fractional bits to the right ROR rA0 ; until mantissa is a normalized unsigned adc rAE,rT1c ; rAE cleard by fp_split1, rT1c = __zero_reg__ INC rA3 - _floor_100: ; |arg| >= 1.0 +3: ; |arg| >= 1.0 CPI rA3,0x96 ; - BRCS _floor_100_1 ; - _floor_200: - BRTC _floor_300 ; LSB now is exactely 1 + BRCS 2b + + BRTC 1f ; LSB now is exactely 1 TST rAE - BREQ _floor_300 + BREQ 1f SUBI rA0,0xFF SBCI rA1,0xFF SBCI rA2,0xFF - _floor_300: +1: CLR rAE ; rT0 must not be cleared : rAE=0 no rounding anyway RJMP _U(__fp_merge) Index: libm/fplib/fp_cmp.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_cmp.S,v retrieving revision 1.2 diff -u -r1.2 fp_cmp.S --- libm/fplib/fp_cmp.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/fp_cmp.S 9 Jan 2005 21:52:47 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_cmp.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -56,8 +58,8 @@ GLOBAL(__ltsf2) GLOBAL(__lesf2) rcall .fp_cmp - brts .fp_cmp_gt ; return 1 (not equal / false) if we got a NaN - rjmp .fp_cmp_ret + brts .Lfp_cmp_gt ; return 1 (not equal / false) if we got a NaN + rjmp .Lfp_cmp_ret ENDFUNC @@ -66,8 +68,8 @@ GLOBAL(__gtsf2) ; greater than : true, if Z clear and C clear GLOBAL(__gesf2) rcall .fp_cmp - brts .fp_cmp_lt - rjmp .fp_cmp_ret + brts .Lfp_cmp_lt + rjmp .Lfp_cmp_ret ENDFUNC @@ -75,16 +77,16 @@ GLOBAL(__cmpsf2) ; returns 1 for A > B ; 0 for A == B ; -1 for A < B ; NaN ? rcall .fp_cmp -.fp_cmp_ret: - breq .fp_cmp_eq - brcc .fp_cmp_gt -.fp_cmp_lt: +.Lfp_cmp_ret: + breq .Lfp_cmp_eq + brcc .Lfp_cmp_gt +.Lfp_cmp_lt: ldi retByte,0xFF ret -.fp_cmp_eq: +.Lfp_cmp_eq: ldi retByte,0x00 ret -.fp_cmp_gt: +.Lfp_cmp_gt: ldi retByte,0x01 ret @@ -109,22 +111,22 @@ RCALL _U(__fp_split2) ; does not return on NaN (T set then) CLT SBRC rT0,7 - RJMP .fp_cmp_10 ; different signs + RJMP 1f ; different signs ; same signs : compare CP rA0,rB0 CPC rA1,rB1 CPC rA2,rB2 CPC rA3,rB3 ; A - B ; set Z if equal, sets C if A < B (unsigned) - BREQ .fp_cmp_20 - BRCC .fp_cmp_10 ; A > B (unsigned) + BREQ 2f + BRCC 1f ; A > B (unsigned) COM rT0 ; A < B (unsigned) -.fp_cmp_10: ; different signs (-0 < +0!) +1: ; different signs (-0 < +0!) ; sign(A) == 0 (positive) -> A > B, C = 0 , Z = 0 ; sign(A) == 1 (negative) -> A < B, C = 1 , Z = 0 ROR rT0 ; C = sign(A) CLZ ; Z = 0 -.fp_cmp_20: +2: ret ENDFUNC Index: libm/fplib/fp_cosinus.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_cosinus.S,v retrieving revision 1.4 diff -u -r1.4 fp_cosinus.S --- libm/fplib/fp_cosinus.S 7 Jan 2005 21:16:25 -0000 1.4 +++ libm/fplib/fp_cosinus.S 9 Jan 2005 21:52:48 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_cosinus.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -81,13 +83,13 @@ CPC rA1,rB1 ; CPC rA2,rB2 CPC rA3,rB3 ; cmp A to PI/2 - BRCS fp_cosinus_00 ; branch if lower + BRCS 1f ; branch if lower ; now (A = x) > PI/2, B = PI/2 LDI rB3,0xC0 LDI rB2,0x49 ; B = -PI RCALL _U(__addsf3) ; PI-A = -(A+-PI) CLR rSI0 ; no sign complement (a,d) - fp_cosinus_00: +1: RCALL _U(square) ; xý ORI rA3,0x80 ; -xý ; @@ -110,7 +112,7 @@ * 2nd byte : msb of mantissa with sign as bit 7 * 3rd & 4th byte : mantissa */ - table_cos: +table_cos: DCB 8 ; no of table entries - 1 (preload value) ; looks like 6 steps are sufficient ; 7 steps for sin(pi) == 0 Index: libm/fplib/fp_flashconst.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_flashconst.S,v retrieving revision 1.3 diff -u -r1.3 fp_flashconst.S --- libm/fplib/fp_flashconst.S 7 Jan 2005 21:16:25 -0000 1.3 +++ libm/fplib/fp_flashconst.S 9 Jan 2005 21:52:48 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_flashconst.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/fp_merge.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_merge.S,v retrieving revision 1.3 diff -u -r1.3 fp_merge.S --- libm/fplib/fp_merge.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/fp_merge.S 9 Jan 2005 21:52:48 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_merge.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -47,9 +49,9 @@ #include "fplib.inc" TEXT_SEG(fplib, __fp_merge) - .func fp_merge_10 + FUNCTION(__fp_merge) - fp_merge_10: +1: DEC rA3 ADD rAE,rAE adc rA0,rA0 @@ -59,35 +61,35 @@ GLOBAL(__fp_merge) CLR rT1c ; clr rT1c on all return paths TST rA3 ; exponent == 0 - BREQ fp_merge300 ; underflow + BREQ 3f ; underflow TST rA2 - BRPL fp_merge_10 ; shift left until MSB set + BRPL 1b ; shift left until MSB set CPI rA3,0xFF - BREQ fp_merge200 ; keep exp == 0xFF, no rounding + BREQ 2f ; keep exp == 0xFF, no rounding ; if rAE == 0x80 (exactely 0.5 LSB, half way between two numbers ) ; choose the one which makes the lsb of the answer 0. ; what about rAE:rr1:rr0 of mul ADD rAE,rAE - BRCC fp_merge200 ; no LSB : round to lower number - BRNE fp_merge100 ; rAE > 0x80 : round to upper number + BRCC 2f ; no LSB : round to lower number + BRNE 1f ; rAE > 0x80 : round to upper number TST rT0 - BRNE fp_merge100 ; rAE=0x80:NN:MM , rT1c = NN | MM + BRNE 1f ; rAE=0x80:NN:MM , rT1c = NN | MM SBRS rA0,0 ; R1 == 0x80 : round to even - RJMP fp_merge200 ; - fp_merge100: ; + RJMP 2f ; +1: SUBI rA0,0xFF SBCI rA1,0xFF SBCI rA2,0xFF SBCI rA3,0xFF - fp_merge200: ; pack expanded FP number +2: ; pack expanded FP number ROL rA2 ; MSB is hidden 1 ROR rA3 ROR rA2 BLD rA3,7 ; get sign RET - fp_merge300: +3: RJMP _U(__fp_zero) ; merge segments ENDFUNC Index: libm/fplib/fp_nan.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_nan.S,v retrieving revision 1.2 diff -u -r1.2 fp_nan.S --- libm/fplib/fp_nan.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/fp_nan.S 9 Jan 2005 21:52:48 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_nan.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/fp_powerseries.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_powerseries.S,v retrieving revision 1.4 diff -u -r1.4 fp_powerseries.S --- libm/fplib/fp_powerseries.S 7 Jan 2005 21:16:25 -0000 1.4 +++ libm/fplib/fp_powerseries.S 9 Jan 2005 21:52:48 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_powerseries.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -77,11 +79,11 @@ MOV rArg1,rA1 MOV rArg0,rA0 LPMRdZpp(rGrade) ; first entry of fp table is byte with entry count - RCALL fp_powerloop + RCALL 100f LPMRdZpp(rGrade) ; increment first (last access or loop counter) TST rGrade - BREQ fp_power200 ; no dividing + BREQ 1f ; no dividing PUSH rA3 PUSH rA2 @@ -92,7 +94,7 @@ MOV rA1,rArg1 MOV rA2,rArg2 MOV rA3,rArg3 ; get power series argument again - RCALL fp_powerloop + RCALL 100f POP rB0 POP rB1 @@ -100,7 +102,7 @@ POP rB3 RCALL _U(__divsf3x) ; this clears rT0 - fp_power200: +1: POP rS5 POP rS4 POP rS3 @@ -115,21 +117,21 @@ */ RJMP _U(__fp_merge) - fp_powerloop: +100: ; AX preset with argument, rFlags.7 sign of AX RCALL _U(__fp_flashconst) ; BX = *array[n] BST rB2,7 ; store sign(B) to T ORI rB2,0x80 ; set implicit one - RJMP fp_powerloop11 + RJMP 2f - fp_powerloop10: +1: MOV rB0,rArg0 MOV rB1,rArg1 MOV rB2,rArg2 MOV rB3,rArg3 ; get power series argument - fp_powerloop11: +2: PUSH ZL PUSH ZH @@ -159,20 +161,20 @@ POP ZH ; now normalize and round TST rA3 ; exponent == 0 - BREQ fp_powerloop20 ; underflow - fp_powerloop19: + BREQ 4f ; underflow +3: TST rA2 - BRMI fp_powerloop20 ; shift left until MSB set + BRMI 4f ; shift left until MSB set DEC rA3 ADD rAE,rAE adc rA0,rA0 adc rA1,rA1 adc rA2,rA2 - RJMP fp_powerloop19 + RJMP 3b - fp_powerloop20: +4: DEC rGrade - BRNE fp_powerloop10 ; + BRNE 1b RET ENDFUNC Index: libm/fplib/fp_split.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_split.S,v retrieving revision 1.4 diff -u -r1.4 fp_split.S --- libm/fplib/fp_split.S 14 Dec 2004 23:36:46 -0000 1.4 +++ libm/fplib/fp_split.S 9 Jan 2005 21:52:49 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_split.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/fp_zero.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/fp_zero.S,v retrieving revision 1.2 diff -u -r1.2 fp_zero.S --- libm/fplib/fp_zero.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/fp_zero.S 9 Jan 2005 21:52:49 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* fp_zero.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/frexp.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/frexp.S,v retrieving revision 1.3 diff -u -r1.3 frexp.S --- libm/fplib/frexp.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/frexp.S 9 Jan 2005 21:52:49 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* frexp.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -62,7 +64,7 @@ RCALL _U(__fp_split1) ; TST rA3 - BREQ _frexp_200 + BREQ 1f SUBI rA3,0x7E ; 0.5 -> 0.5 * 2^0 ; 1.0 -> 0.5 * 2^1 SBC rB0,rB0 ; sign expand rA3 @@ -74,7 +76,7 @@ BLD rA3,7 RET - _frexp_200: +1: ST Z,rA3 STD Z+1,rT1c RJMP _U(__fp_zero) ; frexp(0) returns 0 not A = 0x00800000 of fp_split1 Index: libm/fplib/ldexp.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/ldexp.S,v retrieving revision 1.3 diff -u -r1.3 ldexp.S --- libm/fplib/ldexp.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/ldexp.S 9 Jan 2005 21:52:49 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* ldexp.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -55,25 +57,24 @@ BST rA3,7 RCALL _U(__fp_split1) ; clears rAE TST rA3 ; - BREQ _ldexp_01 ; 2^x*0 = 0 + BREQ 1f ; 2^x*0 = 0 CPI rPH,0xFF - BREQ _ldexp_10 ; negative + BREQ 10f ; negative TST rPH - BREQ _ldexp_10 + BREQ 10f ; overflow or underflow - _dlexp_00: - BRPL _ldexp_NaN ; overflow - _ldexp_01: + BRPL 2f ; overflow +1: RJMP _U(__fp_zero) - _ldexp_NaN: +2: RJMP _U(__fp_nanERANGE) ; overflow - _ldexp_10: +10: ADD rA3,rPL adc rT1c,rPH ; ; check for overflow - BRNE _ldexp_20 - _ldexp_20: + BRNE 1f +1: RJMP _U(__fp_merge) ; rT0 must not be cleared : rAE=0 no rounding anyway ENDFUNC Index: libm/fplib/log.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/log.S,v retrieving revision 1.4 diff -u -r1.4 log.S --- libm/fplib/log.S 7 Jan 2005 21:16:25 -0000 1.4 +++ libm/fplib/log.S 9 Jan 2005 21:52:49 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* log.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -74,13 +76,13 @@ GLOBAL(log) SBRC rA3,7 RJMP _U(__fp_nanEDOM) ; A < 0 argument range error - _log_10: +1: RCALL _U(__fp_split1) TST rA3 - BRNE _log_20 + BRNE 2f RJMP _U(__fp_nanEDOM) ; A == 0 argument range error - _log_20: +2: PUSH rS0 PUSH rS1 PUSH rS2 @@ -129,7 +131,7 @@ * 3rd & 4th byte : mantissa */ - table_log: +table_log: DCB 5 ; no of table entries - 1 (preload value) DCB 0x81,0x35,0x04,0xF4 /* Q5 = 5.65685 */ DCB 0x83,0x20,0x00,0x01 /* Q4 = 20 */ Index: libm/fplib/log10.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/log10.S,v retrieving revision 1.2 diff -u -r1.2 log10.S --- libm/fplib/log10.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/log10.S 9 Jan 2005 21:52:50 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* log10.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/modf.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/modf.S,v retrieving revision 1.2 diff -u -r1.2 modf.S --- libm/fplib/modf.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/modf.S 9 Jan 2005 21:52:50 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* modf.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -62,11 +64,10 @@ CLR rB0 ; preset zero integral part TST rA3 ; if zero return zero for *int and mantissa - BREQ _modf_200 + BREQ 10f CPI rA3,0x7F ; Exp < 0x7F -> arg < 1.0 -> no integer part - BRCS _modf_200 ; + BRCS 10f - _modf_100: MOV rTI0,rA3 ; keep temporarily RCALL _U(__fp_merge) ; rT0 must not be cleared : rAE=0 no rounding anyway MOV rB3,rA3 @@ -75,35 +76,35 @@ MOV rB0,rA0 CPI rTI0,0x96 ; rA3 >= 0x96 -> no fractional part - BRCC _modf_150 ; + BRCC 2f RCALL _U(__fixsfsi) ; RCALL _U(__floatsisf) ; CPI YL,0 CPC YL,YH - BREQ _modf_130 + BREQ 1f ST Y+,rA0 ST Y+,rA1 ST Y+,rA2 ST Y+,rA3 ; A = integer part - _modf_130: +1: SUBI rA3,0x80 ; A = -int(x) POP YH POP YL RJMP _U(__addsf3) - _modf_150: +2: CLR rA3 CLR rA2 CLR rA1 CLR rA0 - _modf_200: +10: CPI YL,0 CPC YL,YH - BREQ _modf_250 + BREQ 1f ST Y+,rB0 ST Y+,rB1 ST Y+,rB2 ST Y+,rB3 ; no fractional part - _modf_250: +1: POP YH POP YL RJMP _U(__fp_merge) ; rT0 must not be cleared : rAE=0 no rounding anyway Index: libm/fplib/mulsf3.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/mulsf3.S,v retrieving revision 1.2 diff -u -r1.2 mulsf3.S --- libm/fplib/mulsf3.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/mulsf3.S 9 Jan 2005 21:52:50 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* mulsf3.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/mulsf3x.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/mulsf3x.S,v retrieving revision 1.3 diff -u -r1.3 mulsf3x.S --- libm/fplib/mulsf3x.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/mulsf3x.S 9 Jan 2005 21:52:50 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* mulsf3x.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -56,25 +58,24 @@ GLOBAL(__mulsf3x) TST rA3 - BREQ ___mulsf3x_ZERO - ___mulsf3_10: + BREQ 2f + TST rB3 - BREQ ___mulsf3x_ZERO + BREQ 2f - ___mulsf3x_00: SUBI rA3,0x7F ; exp(A) now signed char SUBI rB3,0x7F ; exp(B) now signed char ADD rA3,rB3 ; add two signed registers - BRVC ___mulsf3x_20 ; no signed overflow - BRMI ___mulsf3x_INF ; signed overflow : if now negative -> positive overflow - ___mulsf3x_ZERO: + BRVC 1f ; no signed overflow + BRMI 100f ; signed overflow : if now negative -> positive overflow +2: RJMP _U(__fp_zerox) - ___mulsf3x_20: +1: SUBI rA3,0x81 ; = ADI,0x7F CPI rA3,0xFF - BREQ ___mulsf3x_ZERO ; no (unsigned overflow) -> signed underflow + BREQ 2b ; no (unsigned overflow) -> signed underflow ; now multiply mantissa A[rA2:rA1:rA0] * B[rb5:rb4:rb3:rB2:rB1:rB0] ; result : [rr5:rr4:rr3:rr2:rr1:rr0] @@ -97,71 +98,71 @@ CLR rb3 LDI loop,8 ; loop counter - ___mulsf3x_100: +1: LSR rb4 - BRCC ___mulsf3x_101 + BRCC 2f ADD rr0,rB0 adc rr1,rB1 adc rr2,rB2 adc rr3,rb3 - ___mulsf3x_101: +2: ADD rB0,rB0 adc rB1,rB1 adc rB2,rB2 adc rb3,rb3 DEC loop - BRNE ___mulsf3x_100 ; + BRNE 1b LDI loop,8 ; loop counter MOV rb5,rA1 ; rb5 not yet needed CLR rr4 ; rb4 is allready clear LDI loop,8 ; loop counter - ___mulsf3x_200: +1: LSR rb5 - BRCC ___mulsf3x_201 + BRCC 2f ADD rr1,rB1 adc rr2,rB2 adc rr3,rb3 adc rr4,rb4 - ___mulsf3x_201: +2: ADD rB1,rB1 adc rB2,rB2 adc rb3,rb3 adc rb4,rb4 DEC loop - BRNE ___mulsf3x_200 ; + BRNE 1b MOV loop,rA2 ; loop no longer needed, check CLR rr5 ; rb5 is allready clear - ___mulsf3x_300: +1: LSR loop - BRCC ___mulsf3x_301 + BRCC 2f ADD rr2,rB2 adc rr3,rb3 adc rr4,rb4 adc rr5,rb5 - ___mulsf3x_301: +2: ADD rB2,rB2 adc rb3,rb3 adc rb4,rb4 adc rb5,rb5 TST loop - BRNE ___mulsf3x_300 ; + BRNE 1b ; multiplication done : result in rr5:rr4:rr3:rr2:rr1:rr0 ; = rA2:rA1:rA0:rAE:rr1:rr0 - ___mulsf3x_400: ; normalize 1.0 * 1.0 = 1.0 - ; 0x800000 * 0x800000 = 0x40 00 00 00 00 00 - ; 1.999999 * 1.999999 = 3.99999 ~ 4.0 - ; 0xFFFFFF * 0xFFFFFF = 0xFF FF FE 00 00 01 + ; normalize 1.0 * 1.0 = 1.0 + ; 0x800000 * 0x800000 = 0x40 00 00 00 00 00 + ; 1.999999 * 1.999999 = 3.99999 ~ 4.0 + ; 0xFFFFFF * 0xFFFFFF = 0xFF FF FE 00 00 01 TST rA2 - BRPL ___mulsf3x_405 ; if MSB erg is clr + BRPL 1f ; if MSB erg is clr INC rA3 ; - BRNE ___mulsf3x_420 - ___mulsf3x_INF: + BRNE 2f +100: RJMP _U(__fp_nanx) ; returns to ___mulsf3 or a high level function : rT1c ok - ___mulsf3x_405: +1: ADD rr0,rr0 adc rr1,rr1 adc rAE,rAE @@ -169,7 +170,7 @@ adc rA1,rA1 adc rA2,rA2 - ___mulsf3x_420: +2: OR rr0,rr1 ; rr0 = rT0 which holds the mantissae extension beyond rAE RET Index: libm/fplib/negsf2.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/negsf2.S,v retrieving revision 1.2 diff -u -r1.2 negsf2.S --- libm/fplib/negsf2.S 10 Nov 2004 21:04:46 -0000 1.2 +++ libm/fplib/negsf2.S 9 Jan 2005 21:52:50 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* negsf2.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -47,21 +49,8 @@ FUNCTION(__negsf2) GLOBAL(__negsf2) -#if 0 /* XXX why so complicated? Just flip the sign bit... -MM 2000-11-18 */ - ADD rA2,rA2 - adc rA3,rA3 - BREQ ___negsf2_100 - SBC rT0,rT0 ; if C = 1 (negative) -> rT0 = 0xFF = ~0 - ; if C = 0 (positive) -> rT0 = 0x00 = ~0xFF - COM rT0 - ROR rT0 - ___negsf2_100: ; zero, negate - ROR rA3 - ROR rA2 -#else ldi rTI0,0x80 eor rA3,rTI0 -#endif RET ENDFUNC Index: libm/fplib/pow.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/pow.S,v retrieving revision 1.4 diff -u -r1.4 pow.S --- libm/fplib/pow.S 10 Nov 2004 21:04:46 -0000 1.4 +++ libm/fplib/pow.S 9 Jan 2005 21:52:51 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* pow.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/sin.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/sin.S,v retrieving revision 1.3 diff -u -r1.3 sin.S --- libm/fplib/sin.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/sin.S 9 Jan 2005 21:52:51 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* sin.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -53,7 +55,7 @@ PUSH rA3 ANDI rA3,0x7F CPI rA3,0x39 - BRCS _sin_00 ; |A| < 0x38FFFFFF -> sin(A) = A + BRCS 1f ; |A| < 0x38FFFFFF -> sin(A) = A LDI rB3,0x40 LDI rB2,0xC9 @@ -67,7 +69,7 @@ LDI rB0,0xDB ; load -PI/2 RCALL _U(__addsf3) ; A - PI/2 RCALL _U(fp_cosinus) - _sin_00: +1: POP rB3 ANDI rB3,0x80 EOR rA3,rB3 ; invert sign, if Index: libm/fplib/sinh.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/sinh.S,v retrieving revision 1.3 diff -u -r1.3 sinh.S --- libm/fplib/sinh.S 7 Jan 2005 21:16:25 -0000 1.3 +++ libm/fplib/sinh.S 9 Jan 2005 21:52:51 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* sinh.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib Index: libm/fplib/sqrt.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/sqrt.S,v retrieving revision 1.3 diff -u -r1.3 sqrt.S --- libm/fplib/sqrt.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/sqrt.S 9 Jan 2005 21:52:51 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* sqrt.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -67,9 +69,9 @@ MOV rB2,rA2 ; needed later on TST rA3 - BREQ _sqrt_ZERO ; sqrt(0) = 0 + BREQ 100f ; sqrt(0) = 0 RCALL _U(__fp_split1) ; does not return on NaN - _sqrt_00: + MOV rTI0,rA3 SUBI rTI0,0x7F ASR rTI0 ; this is dExp! @@ -99,7 +101,7 @@ MOV rS2,rA2 MOV rS1,rA1 MOV rS0,rA0 ; Abak = A - _sqrt_10: +1: MOV rA0,rS0 ; MOV rA1,rS1 ; MOV rA2,rS2 ; @@ -132,7 +134,7 @@ CPC rS5,rB1 ; CPC rS6,rB2 CPC rS7,rB3 ; cmp B to Bbak - BRNE _sqrt_10 + BRNE 1b POP rS7 POP rS6 @@ -145,10 +147,10 @@ POP rT0 ADD rA3,rT0 ; - _sqrt_100: + CLR rT0 ; no rounding beyond rAE RJMP _U(__fp_merge) - _sqrt_ZERO: +100: RET ENDFUNC Index: libm/fplib/strtod.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/strtod.S,v retrieving revision 1.6 diff -u -r1.6 strtod.S --- libm/fplib/strtod.S 7 Jan 2005 21:16:25 -0000 1.6 +++ libm/fplib/strtod.S 9 Jan 2005 21:52:51 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* strtod.S is an addition to FPlib V 0.3.0 ported to avr-as for details see readme.strtod Index: libm/fplib/tan.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/tan.S,v retrieving revision 1.4 diff -u -r1.4 tan.S --- libm/fplib/tan.S 7 Jan 2005 21:16:25 -0000 1.4 +++ libm/fplib/tan.S 9 Jan 2005 21:52:52 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* tan.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -61,7 +63,7 @@ ANDI rSI0,0x80 ; assume inversion flag zero ANDI rA3,0x7F CPI rA3,0x39 - BRCS _tan_100 ; (tan(A < 0x39000000)=A) + BRCS 100f ; (tan(A < 0x39000000)=A) LDI rB3,0x40 LDI rB2,0x49 @@ -77,15 +79,15 @@ CPC rB1,rA1 CPC rB2,rA2 CPC rB3,rA3 ; B(=PI/2) - A - BREQ _tan_INF - BRCC _tan_10 + BREQ 101f + BRCC 1f LDI rB3,0x40 LDI rB2,0x49 ; load PI ORI rA3,0x80 ; A = -A RCALL _U(__addsf3) ; A = A+B = B + (-A) LDI rB3,0x80 EOR rSI0,rB3 - _tan_10: +1: LDI rB3,0x3F LDI rB2,0x49 LDI rB1,0x0F @@ -94,12 +96,12 @@ CPC rB1,rA1 CPC rB2,rA2 CPC rB3,rA3 ; B(=PI/4) - A - BRCC _tan_00 + BRCC 1f INC rSI0 ORI rA3,0x80 ; negate A LDI rB2,0xC9 ; P/4 -> PI/2 RCALL _U(__addsf3) ; PI/2 - A - _tan_00: +1: PUSH rA3 PUSH rA2 PUSH rA1 @@ -115,14 +117,14 @@ POP rB3 RCALL _U(__mulsf3) SBRS rSI0,0 - RJMP _tan_100 + RJMP 100f RCALL _U(__fp_inverse) - _tan_100: +100: SBRC rSI0,7 ORI rA3,0x80 POP rSI0 RET - _tan_INF: +101: POP rSI0 RJMP _U(__fp_nan) @@ -153,7 +155,7 @@ * 2nd byte : msb of mantissa with sign as bit 7 * 3rd & 4th byte : mantissa */ - table_tan: DCB 3 ; no of table entries - 1 (preload value) +table_tan: DCB 3 ; no of table entries - 1 (preload value) DCB 0x73, 0x05, 0x27, 0x60 ; h - first calculate denominator DCB 0x79, 0x48, 0xDE, 0x92 DCB 0x7D, 0x6D, 0xB0, 0xCA Index: libm/fplib/tanh.S =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/libm/fplib/tanh.S,v retrieving revision 1.3 diff -u -r1.3 tanh.S --- libm/fplib/tanh.S 10 Nov 2004 21:04:46 -0000 1.3 +++ libm/fplib/tanh.S 9 Jan 2005 21:52:52 -0000 @@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +/* $Id$ */ + /* tanh.S is part of FPlib V 0.3.0 ported to avr-as for details see readme.fplib @@ -68,7 +70,7 @@ CPC rA1,rB1 CPC rA2,rB2 CPC rA3,rB3 ; compare with 8.3177661895751953 = | ln(2^24)/2 | - BRCS _tanh_00 + BRCS 1f LDI rA3,0x3F LDI rA2,0x80 LDI rA1,0x00 @@ -76,7 +78,7 @@ BLD rA3,7 ; if x positivive _tanh(x) = 1 RET - _tanh_00: +1: BLD rA3,7 PUSH rA0 /* LDI rB3,1 */