Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!rutgers!att!pacbell.com!ucsd!chiton!cdl From: cdl@chiton.ucsd.edu (Carl Lowenstein) Newsgroups: comp.sys.next Subject: Re: 68040 Math / Why so much system time? Message-ID: <712@chiton.ucsd.edu> Date: 17 Feb 91 20:00:19 GMT References: <1991Feb14.160749.19048@batcomputer.tn.cornell.edu> <290@rosie.NeXT.COM> <1991Feb15.135340.2808@news.sara.nl> <1991Feb17.113656.5876@kithrup.COM> Reply-To: cdl@chiton (Carl Lowenstein) Organization: MPL of SIO at UCSD Lines: 44 In article <1991Feb17.113656.5876@kithrup.COM> sef@kithrup.COM (Sean Eric Fagan) writes: >In article <1991Feb15.135340.2808@news.sara.nl> toon@news.sara.nl writes: >>Sorts of. Is trapping these instructions really faster than implementing >>sin(), cos(), tan() and friends as run time library subroutines to the >>(Objective-) C(++) compiler ? I would doubt it. > >Very good! Perhaps you noticed the comment in this thread, a while ago, >about 68040 fp-intensive programs being faster *when recompiled*? > >Or aren't you aware that there is no easy way to replace a single >instruction, e.g., fsin? I don't understand what point you are making here. If there does exist a math library that uses only fp instructions that are native to the 68040, then recompiling (or at least relinking) should make fp-intensive programs run faster. But the word from Morris Meyer at NeXT is that they didn't do it this way, chosing to trap the un-implemented instructions and interpret them in the kernel. This does make it possible to run 68030/68882 programs without relinking. Conversely, it makes it possible to develop fp programs on a 68040 system and have them work on the 68030/68882 with no changes. My proposal for a compromise solution is a math library that contains two versions of the affected transcendental routines, one which is a stub to call the 68882 hardware, and one using 68040 instructions. The 68882 version can be the default. If this traps as an un-implemented instruction, the kernel trap handler can change a software switch so that all subsequent calls to the routine get the 68040 version. At the moment, I am not sufficiently fluent in 68040 to do this, but I have seen very similar things done for PDP-11 floating point. -- carl lowenstein marine physical lab u.c. san diego {decvax|ucbvax} !ucsd!mpl!cdl cdl@mpl.ucsd.edu clowenstein@ucsd.edu