When I tested the code for mulsf.c 1.7 I merged it manually from the CVS commit email and I seem to have missed a part. When I updated from CVS today I got that extra part and it broke mulsf.c.
The part that check for an input of zero was missed in my merge. The orriginal code was replace with this: tmp = a1; tmp &= a1>>16; tmp &= a2; tmp &= a2>>16; if(!tmp) return 0l; judging from what it replaced my guess is that it was to test if a1 or a2 are zero and if so return 0 (because 0*anything=0). The new code does not do this at all in fact if none of the 4 words share a common 1 (which is likely enough) and a1 and a2 are non-zero then you will get an incorrect result of 0. Attached are two solutions. One goes back to the original (.diff2) conditional and the other uses bit wise operators similar to the current (.diff1) solution. -Chris Takahashi diff1 --- msp430-libc-current/src/libm/mulsf.current.c 2003-08-05 09:43:16.0000 00000 -0700 +++ msp430-libc-current/src/libm/mulsf.c 2003-08-05 10:09:48.000000000 -0 700 @@ -64,14 +64,15 @@ register int sign; register int exp; register int tmp; - + register int tmp2; + /* if ( (a1 == 0) || (a2 == 0) ) return 0l; */ tmp = a1; - tmp &= a1>>16; - tmp &= a2; - tmp &= a2>>16; + tmp |= a1>>16; + tmp2 = a2; + tmp2 |= a2>>16; - if(!tmp) return 0l; + if(!(tmp&&tmp2)) return 0l; /* exp = EXP (fl1.l) - EXCESS + EXP (fl2.l); */ __asm__ __volatile__ ( diff2: --- msp430-libc-current/src/libm/mulsf.current.c 2003-08-05 09:43:16.0000 00000 -0700 +++ msp430-libc-current/src/libm/mulsf.old.c 2003-08-05 09:47:33.000000000 -0 700 @@ -65,13 +65,15 @@ register int exp; register int tmp; - - tmp = a1; - tmp &= a1>>16; - tmp &= a2; - tmp &= a2>>16; - - if(!tmp) return 0l; + if(!a1) + { + return 0l; + } + + if(!a2) + { + return 0l; + } /* exp = EXP (fl1.l) - EXCESS + EXP (fl2.l); */ __asm__ __volatile__ (
mulsf.diff1
Description: Binary data
mulsf.diff2
Description: Binary data