🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #3395

Re: Integer Multiply/Divide on Sparc

#3395
From: Steve Correll
Date: Tue, 16 Jan 1990 17:46
14 lines
1291 bytes
In article <2819@auspex.auspex.com>, guy@auspex.auspex.com (Guy Harris) writes:
> ...I can't speak for MIPS, but I wouldn't be surprised to hear that even
> though they had a multiply instruction since Day 1 they still did shifts
> and adds for multiplies by constants.

Right. (As of 2 years ago, anyway) the MIPSCo compilers compare the number of
cycles for hardware multiply against the cycles for the necessary series of
shifts and adds, and emit the cheaper alternative. They also shift and mask
(adjusting for the sign bit as needed) in lieu of div and rem by powers of 2.
This happens in the non-ASCII back end of the assembler, which the compilers
employ to create the object file, so compilers and humans alike can code "mul"
and let the assembler figure out the tradeoff.
-- 
...{sun,pyramid}!pacbell!key!sjc 				Steve Correll
Technical Details
Message-ID: <1379@key.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!apple!sun-barr!newstop!sun!amdahl!key!sjc
References: <8840005@hpfcso.HP.COM> <1249@otc.otca.oz> <2819@auspex.auspex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!apple!sun-barr!newstop!sun!amdahl!key!sjc
From: sjc@key.COM (Steve Correll)
Newsgroups: comp.arch
Subject: Re: Integer Multiply/Divide on Sparc
Message-ID: <1379@key.COM>
Date: 16 Jan 90 17:46:01 GMT
References: <8840005@hpfcso.HP.COM> <1249@otc.otca.oz> <2819@auspex.auspex.com>
Organization: Key Computer Labs, Fremont, CA
Lines: 14