[SATLUG] comparison of processors (OT)
Jeremy Mann
jeremymann at gmail.com
Mon Aug 1 10:04:43 CDT 2005
The question was actually asked by an intern here in my office. I
figured somebody on this list would have an answer. He has since wrote
a program to figure out the timing. Thanks again.
On 7/30/05, Travis H. <solinym at gmail.com> wrote:
> > >> Back in the i386 days, multiplication took a variable amount of time,
> > >> depending on the number of leading zeroes in the binary representation
> > >> of multiplier. Oddly, this was asymmetric; multiplying 2 by 100 took
> > >> more time than multiplying 100 by 2.
> > >
> > > OT: that's because 2 * 100 involves actual multiplication. 100 * 2 is
> > > just a single bit shift operation (as long as it doesn't overflow the
> > > variable).
> > (responding to myself) This assumes these are both values of variables.
> > If they are static (or at least the 2 is), the compiler should reorder
> > the 2*100 into 100*2 (as long as they are both int's) and bit shift.
>
> It has nothing to do with bit shifting; 2 and 100 are arbitrary, and I
> could have used 17 and 101 instead. Compilers don't even enter into
> the picture, as I'm talking about the chip's instruction set.
> --
> http://www.lightconsulting.com/~travis/
> GPG fingerprint: 50A1 15C5 A9DE 23B9 ED98 C93E 38E9 204A 94C2 641B
> _______________________________________________
> SATLUG mailing list
> SATLUG at satlug.org
> http://alamo.satlug.org/mailman/listinfo/satlug
>
--
Jeremy
More information about the SATLUG
mailing list