Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!think.com!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin From: hrubin@pop.stat.purdue.edu (Herman Rubin) Newsgroups: comp.arch Subject: Re: Frequency of elementary functions (and other things) Summary: Speed of operations Message-ID: <12488@mentor.cc.purdue.edu> Date: 18 May 91 10:06:57 GMT References: <9105171235.AA20139@ucbvax.Berkeley.EDU> <104811@sgi.sgi.com> Sender: news@mentor.cc.purdue.edu Lines: 41 In article <104811@sgi.sgi.com>, bron@bronze.wpd.sgi.com (Bron Campbell Nelson) writes: > In article <9105171235.AA20139@ucbvax.Berkeley.EDU>, jbs@WATSON.IBM.COM writes: > > > > I agree that easier communication between the units would help > > in computing elementary functions. However the gains would not be > > spectacular (I guess 10% or so) and elementary functions themselves don't > > seem all that important (anybody have numbers on this?). > > In my experiance, even for floating point intensive scientific codes, > the only functions that really use any time are square root and > exponentiation. Square root will often account for between 5% and 15% of > the cpu time (shading to the high side), and exponentiation between 1% and > 5% (shading to the low side). (Exponentiation would be higher except that > the vast majority of exponents are "2", and many optimizers convert x**2 > into x*x.) If square root takes that much of the time, it must be a software square root. If the hardware has floating division, it should have the simple modification of this to get a square root, although I agree that too many of them do not, although the added hardware is extremely small. As for the other elementary functions, the only hardware algorithms, other than microcode, which I know would require a lot read-only memory. But much exponentiation in is to small integer powers, and here both integer and floating exponentiation should be optimized for fixed exponents (although I would be somewhat hesitant about allowing an optimizer to replace a function call) and I suspect that hardware for raising to non-negative integer powers without computing transcendental functions, even as microcode, would pay. The original thread, even cited, was the communication between integer and floating units. Even such simple things as multiplication by variable integers are very likely as common as exponentiation. Another situation is Boolean operations on both fixed-point and floating numbers; fixed point is not restricted to integers. Also, the availability of hardware operations leads to their increased use; on a machine with no communication between the units, a knowledgeable programmer would avoid the need by using some other algorithm, for example. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (Internet, bitnet) {purdue,pur-ee}!l.cc!hrubin(UUCP)