From: brennan AT mack DOT rt66 DOT com (Brennan "The Rev. Bas" Underwood) Newsgroups: comp.os.msdos.djgpp Subject: Re: Inline Asm? Date: 6 Jan 1997 17:12:46 -0700 Organization: Rasterfari Lines: 38 Message-ID: <5as4du$jd6@mack.rt66.com> References: <19961231 DOT 204032 DOT 5015 DOT 0 DOT chambersb AT juno DOT com> NNTP-Posting-Host: mack.rt66.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <19961231 DOT 204032 DOT 5015 DOT 0 DOT chambersb AT juno DOT com>, Benjamin D Chambers wrote: >Well, I spent some time stepping through my program with GDB, and found >that the following lines caused problems: > >cmpl $0, %%edx (This is, of course, in the c file) >jne 0 > >Now, to me, this means that if edx is not zero, jump to the label 0 >(which was defined earlier) and, if edx is zero, keep executing as >normal. However, when I stepped through this with GDB, I found that no >matter what value edx held, the loop fell through (that is, no jump was >performed). Am I doing something wrong here? Again, thanx in advance... Tell you what, just use jnz as below... (JNZ = jump if not zero) > asm("0: \n > movb $1, (,%%eax,1) \n > incl %%eax \n > decl %%edx \n jnz 0b \n > " > : // No Output > : "d" (size), > "a" (data) > : "memory", "%cc" > ); Also, the decl and jnz will pair into 1 cycle on the Pentium. And, I put a 'b' on the '0', to make 0 into a local label in case of loop unrolling. Brennan -- brennan AT rt66 DOT com | "Developing for Windows is not fun." -- John Carmack Riomhchlaraitheoir| Rasterfarian | -O