rdh) (07/31/90)
I had asked how to get the C compiler to generate code to use the MC68881 trig functions . . . OK, OK, it really was there in the manual (there's a big difference 'twixt R'ing the FM, and U'ing the FM: I actually did see the section on inlining [Floating Point Programmer's Guide: Appendix "G" -- Assembly- Level In-line Expansion], but just glanced at it as a "interesting if somewhat kinky way of implementing INLINE capability in a compiler for a language that doesn't support INLINE as a language construct. After all, I just wanted the compiler to use the MC68881 coprocessor, not write obtuse machine code...and it wasn't anywhere near all the other stuff in the manual on the MC68881 coprocessor and attendant switches... [An appendix, no less!] Probably the most, ah, authoritative response: f68881 means use the MC6888x fp chip for ordinary fp arithmetic (add, subtract, multiply, divide, ...) To use the MC6888x chips' implementation of transcendental functions, compile like so: cc -f68881 /usr/lib/f68881/libm.il myprog.c -lm The reason for this has to do with SVID compliance; in order to generate (the silly) MATHERR error notification, we can't use the MC6888x stuff directly, but instead need to go through software routines that can signal MATHERR. (If you use the inline templates, then in this minor way you lose SVID compliance. I'm not sure why anyone cares about SVID compliance - we the implementors certainly don't - it must have something to do with the phone company.) The new unbundled compilers have a switch for the inline library templates (-libmil) and the FPPG was rewritten as the Numerical Computation Guide (part number 800-3555-10). The NCG attempts to sketch how libm is implemented for the various fp architectures. and, of course, the usual pitch for GNU/gcc: You can get inline trig code by compiling with the inline maths lib /usr/lib/f68881/libm.il in the command line. It is better but not great. A much beter alternative is to use gcc and the math-68881.h header that does all the inline trig stuff, and avoids all register spills etc at the same time. Many MANY thanks to all who took the time and effort to respond: bobg@xn.ll.mit.edu uunet^icarus.eng.ohio-state.edu.eng.ohio-state.edu^kaul@sli (Rich Kaul) Brian Fitzgerald <uunet^mml0.meche.rpi.edu^fitz@sli> vanandel@ncar.ucar.edu Bruce Allen <uunet^csd4.csd.uwm.edu^ballen@sli> prl@iis.ethz.ch Skip (montanaro@crdgw1.ge.com) uunet^Eng.Sun.COM^khb@sli (chiba) mrm@eng.sun.com glenn@synaptics.com uunet^auspex.com^guy@sli (Guy Harris) Bill Dunlap <uunet^stat.washington.edu^bill@sli> jimc@math.ucla.edu uunet^Eng.Sun.COM^dgh@sli (David Hough) brent@dimsun.bcm.tmc.edu AKONSTAM@TRINITY.BITNET Gregory Bond <uunet^melba.bby.oz.au^gnb@sli> and any others whose mail may have been foiled by the network mail munching trolls...this group is *GREAT* !! -RDH