Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!brunix!jps From: jps@cs.brown.edu (John Shewchuk) Newsgroups: comp.arch Subject: Questions on SparcStation 1 performance Message-ID: <6008@brunix.UUCP> Date: 9 May 89 22:43:02 GMT Sender: news@brunix.UUCP Reply-To: jps@cs.brown.edu (John Shewchuk) Organization: Brown University Department of Computer Science Lines: 43 I want to do the following many times: x = f * y; Currently x and y are integers and f is floating point number. In an attempt to speed up a program I tried replacing this with x = (a * y)/b; where a and b are integers. After compiling a loop that has 100,000 iterations of the code described above I timed the two different versions. To my surprise I found that the floating point version returned quickly - it used about 1.6 seconds of user time - while the integer version took much longer- about 43 seconds. After looking at the code with adb it was noticed that the integer multiply and divide were calls to routines like .mul but were using the dynamic loading stubs. We relinked the code using -Bstatic and running time for the integer version went down to about 10 seconds. However this still much slower than the floating point version. What is going on here? Intuitively, an integer multiply followed by an integer divide should be faster than a convert int to float, floating multiply, and convert float to int but this does not seem to be the case. Any suggestions on a way to increase performance? Is it possible to inline the calls to the library routines? Do the new sparc chips have integer multiply and divide instructions? Thanks, John Shewchuk jps@cs.brown.edu John Shewchuk jps@cs.brown.edu