Date: Sat, 8 Oct 1994 09:37:13 -0700 (PDT) From: "Frederick W. Reimer" Subject: Re: 16/32 (was: djgpp and the 386SX) To: Kimberley Burchett Cc: DJGPP Mailing List On Sat, 8 Oct 1994, Kimberley Burchett wrote: > > On Fri, 7 Oct 1994, Frederick W. Reimer wrote: > > > On Thu, 6 Oct 1994 terra AT diku DOT dk wrote: > > > > > There is no execution time difference between 16-bit operations and > > > 32-bit operations for i[34]86. > > > > I'll have to assume that you also have the 386+ programmer's reference > > manual from Intel -- or at least have the instruction timings from some > > (supposedly) 32-bit compiler? Thanks for setting the facts striaght! > > Well, I do have a reference (HelpPC to be exact) and it says that there > is a difference 'tween 16 and 32 bits when it comes to multiplication. > For 16 bit MULs, the timing is 13-26 cycles. 32 bit MULs are 13-42 > cycles. The actual time depends (I'm pretty sure) on how many bits are > set in the numbers you're multiplying. > So, the conclusion is that 32 bits CAN be slower, but only if you're > multiplying something that really needs 32bits to be represented. The > thing is, if you tried to do the same multiplication using more than one > 16 bit MUL, it would take longer. Depending on how you look at it, 32 > bits is faster AND slower. :) > Kim > Well what we are talking about here is the way that compilers handle 32-bit values for programs that require them. Doesn't really matter what the C type is (int, short, or long), but that the 32-bit type, whatever it is, be implemented with a single entity in the compiled code. If you don't need a 32-bit value, use a short (in DJGPP) or an int (in most DOS compilers). The issue is that, when you NEED to use a 32-bit type, most DOS compilers break it into two parts and use 16-bit operations instead of true 32-bit compilers which use 32-bit operations on a single entity (whether it be memory or registers). So, the conclusion is that 32-bit compilers ARE faster than 16-bit compilers, because 16-bit compilers would need to perform multiple operations while the 32-bit compiler would only need to perform one operation for 32-bit types. Fred Reimer +-------------------------------------------------------------+ | The views expressed in the above are solely my own, and are | | not necessarily the views of my employer. Have a nice day! | | PGP2.6 public key available via `finger fwreimer AT crl DOT com` | +-------------------------------------------------------------+