Newsgroups: comp.os.msdos.djgpp From: Elliott Oti Subject: Re: DJGPP, inline and GAS Sender: usenet AT phys DOT uu DOT nl (News system Tijgertje) Message-ID: In-Reply-To: <6n0mqf$37j$1@news.worldonline.nl> Date: Fri, 26 Jun 1998 23:35:01 GMT Content-Type: TEXT/PLAIN; charset=US-ASCII References: <6n0mqf$37j$1 AT news DOT worldonline DOT nl> Mime-Version: 1.0 Organization: Physics and Astronomy, University of Utrecht, The Netherlands Lines: 42 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Fri, 26 Jun 1998, d-range wrote: > Hi, > > How can I convert the following WATCOM-style pragma to an inlined asm > function under DJGPP? I tried for hours but I cannot get it to work ;-( > > #pragma aux FixMul= "imul ebx", > "shrd eax,edx,16", > parms [eax] [ebx] modify [edx] value > [eax]; > > I tried: > > inline Fixed FixMul(int x, int y) __asm__ ( "imull %%ebx" \ > > "shrdl 16,%%edx,%%eax" \ > : > "=a" : "a" (x), "b" (y): "%edx" ); > > but I think I'm doing something terribly wrong. the shrd opcode isn't even > recognized, and GCC (or GAS) gives a parse error before ':' Try inline long FixedMul(long x, long y) { long c; asm("imull %%ebx \n" "shrdl $16, %%edx, %%eax \n" "=a"(c) :"a"(x),"b"(y) :"a","b","d" ); return c; } Elliott Oti kamer 104, tel (030-253) 2516 (RvG) http://www.fys.ruu.nl/~oti