From: leathm AT solwarra (Leath Muller) Message-Id: <199609190031.KAA02429@gbrmpa.gov.au> Subject: Re: Quick inline asm question... To: moisemih AT ift DOT ulaval DOT ca (Mihai Moise) Date: Thu, 19 Sep 1996 10:31:17 +1000 (EST) Cc: djgpp AT delorie DOT com Reply-To: leathm AT gbrmpa DOT gov DOT au In-Reply-To: <32401FF0.41C67EA6@ift.ulaval.ca> from "Mihai Moise" at Sep 18, 96 12:14:40 pm Content-Type: text > > Well, in as much as I understand 16 vs 32-bit assembly, the 'e*x' > > registers > > are simply 32-bit extended versions of the '*x' registers. So, %%ax is > > in > > actuality the lower 16 bits of %%eax. What you are trying to do is add > > the register to itself, which I doubt will work. > Actually, adding a register to itself just might work. But intel > provides no opcodes to mix 16-bit and 32-bit registers in an > instruction. Besides, even if such opcodes existed, the resulting > algorithm would not be portable. You can add a register to itself...its a great way to do a quick multiply. (x 2). As for adding a 16 bit register to a 32bit one, what you could do is make sure the top 16 bits of a 32 bit register are zeroed, and perform an addl. using another register ie: xorl %%ebx, %%ebx // 1 cycle movw %%ax, %%bx // 2 cycles addl %%ebx, %%eax // 1 cycle Leathal.