www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/13/19:18:22

From: "Michael Beck" <beck AT dgroup DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: SHIFTS vs MUL's
Date: 13 Feb 1997 18:23:02 GMT
Organization: DResearch
Lines: 19
Message-ID: <01bc19da$f15ab5b0$8942ddc2@franc>
References: <19970210 DOT 173501 DOT 4967 DOT 2 DOT chambersb AT juno DOT com>
NNTP-Posting-Host: master.dgroup.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Benjamin D Chambers <chambersb AT juno DOT com> wrote in article
<19970210 DOT 173501 DOT 4967 DOT 2 DOT chambersb AT juno DOT com>...
> Well, some of you may recall that a while ago I was challenged to PROVE
> (with code) that shifts are faster than MUL's for equivelant arithmetic. 
> Actually, I couldn't QUITE do this - based on the minimum execution time
> of 13 cycles for a mul (on a 486, sorry Pentium folks) I couldn't find
> ANY number in the range 1-65536 that would take even this long.  If
> someone think's they've found one, let me know and I'll take a look.

That's a interesting question. First do you time the execution time? On
P5's you
can take the TSC, but 486? Then, have you coded your test code in ASM or C.
If C, the
compiler may generate shifts and lea instruction instead of muls if he
knows the values
at compile time.

-- 
Michael Beck                        beck AT dgroup DOT de

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019