[net.bugs.4bsd] Bug in VAX assembler math library

donn (08/21/82)

A hard to find but nasty little bug exists in the 4.1 VAX assembler
math library (libnm.a).  The routine "asin" in asin.s uses r6 & r7 for
scratch and hence has an entry register mask of 0xc0.  Unfortunately
"asin" calls a routine in atan.s creatively named "satan" which uses r8
and r9.  The "atan" and "atan2" entries have the proper mask 0x3c0 but
"asin" loses because it calls "satan" with a "jsb" instruction rather
than calling "atan" with a "calls".  Programs which put register
variables in r8 and r9 and which also call "asin" tend to bite the
dust.  The simple fix is to make the entry mask for "asin" be 0x3c0.

Incidentally, what is the point of keeping the "libnm.a" routines out
of the "libm.a" math library if they have better performance than the C
routines?  Is "libnm.a" supported by Berkeley?  At the insistence of
our Fortran users, I have added the "libnm" routines to "libm" at our
site and I have not had any bad reports yet.  (Yes, we have Fortran
users, and yes, they are very demanding.  "Xf77" may soothe them a bit
if its speed increase compensates for the indigestion it causes "sdb".)

  Donn Seeley  UCSD Chemistry Dept. RRCF  ucbvax!sdcsvax!sdchema!donn