Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!clyde.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!csus.edu!beach.csulb.edu!nic.csu.net!csun!kithrup!sef From: sef@kithrup.COM (Sean Eric Fagan) Newsgroups: comp.sys.next Subject: Re: 68040 Math: Emulation or library call or inline code ? Message-ID: <1991Feb18.181012.12483@kithrup.COM> Date: 18 Feb 91 18:10:12 GMT References: <1991Feb15.135340.2808@news.sara.nl> <1991Feb17.113656.5876@kithrup.COM> <1991Feb18.105109.2810@news.sara.nl> Organization: Kithrup Enterprises, Ltd. Lines: 41 In article <1991Feb18.105109.2810@news.sara.nl> toon@news.sara.nl writes: >Well, that depends on how this is implemented. I can imagine that in the >old ('030) case, sin(), cos(), tan() and friends translated to either a >single instruction library call, or a single instruction expanded inline >(although I don't know enough of the (gcc) compiler to know whether it >is _possible_ to translate library calls to inline code). /* file */ #ifdef __GNUC__ # ifdef __OPTIMIZE__ static __inline double sin(double x) { double temp; __asm ("fsin %0, %1" : "=F" (temp) : "f" (x)); return temp; } /* ... */ #endif __GNUC__ That's one way of doing it; I don't know the port of the 68k well enough to be terribly exact. When you do, in your code, foo = sin(bar); the code generated looks roughly like fsin foo, bar Or somesuch (probably moves both bar to an fp register, and uses one as the destination). THERE IS NO EASY WAY TO REPLACE THAT fsin WITHOUT RECOMPILING. IF RECOMPILE AND USE AN OPTIMIZED SUBROUTINE, THAT DOES *NOT* USE THE fsin INSTRUCTION, YOUR CODE WILL BE FASTER ON THE 68040. -- Sean Eric Fagan | "I made the universe, but please don't blame me for it; sef@kithrup.COM | I had a bellyache at the time." -----------------+ -- The Turtle (Stephen King, _It_) Any opinions expressed are my own, and generally unpopular with others.