www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/02/07:42:17

From: nikki AT gameboutique DOT co (nikki)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: SHIFTS vs MULS
Date: 2 Feb 1997 11:51:58 GMT
Organization: GameBoutique Ltd.
Lines: 22
Message-ID: <5d1v4u$lkd@flex.uunet.pipex.com>
References: <19970201 DOT 205029 DOT 4943 DOT 0 DOT chambersb AT juno DOT com>
<32F48236 DOT 7F2C AT cs DOT com>
NNTP-Posting-Host: www.gameboutique.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>> This sounds a little fishy to me, especially considering the code sizes
>> of the two programs are (when stripped) roughly equivalent.  Is there any
>> reason that Gcc might skip the mul's in the shift&add one as an
>> optimization?  (ie looking ahead and seeing the value isn't used so not
>> doing the calculation, or something?)

if you compile with the -S switch you could look at the code and make sure
it's producing what you want it to :)

just for the record, you can get a shift down to one cycle on a pentium
by using the shrl $value,%%register version. however it only pairs in the u
pipe, so a few of these will cause problems. mul and imul are really awful
taking a minimum of 9 cycles and not pairable at all. so your shifts should
win by a factor of about 9 here.

regards,
nik


-- 
Graham Tootell           
nikki AT gameboutique DOT com  

- Raw text -


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