ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/02/13:15:23

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Lines: 43
X-Admin: news AT aol DOT com
From: sterten AT aol DOT com (Sterten)
Newsgroups: comp.os.msdos.djgpp
Date: 02 Apr 2002 18:13:11 GMT
Organization: AOL http://www.aol.com
Subject: help with inline AT&T assembly
Message-ID: <20020402131311.21631.00001396@mb-fa.aol.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I wanted to convert my inner loop to assembly ,
it did compile but it doesn't do what the C-routine does.
I'm new to AT&T syntax , where is the mistake ?



C:
----------------------------------------------
       j=0;
label1:j+=A[q+row];
       row=D[row];
       if(j<min && row!=x) goto label1;
-----------------------------------------------



assembly:
______________________________________________
__asm__ __volatile__ ("
        pushal
        xorl %%eax,%%eax
        movl %%ebx,%1
        movl %%ecx,%2
        movl %%edx,%3
        addl %%ecx,%4
        movl %%edi,%5
        movl %%ebp,%6
label1: 
        addl %%eax,(%%ecx,%%edx,1)
        movl %%edx,(%%edi,%%edx,1)
        cmpl %%eax,%%ebp
        jae label2
        cmp %%edx,%%ebx
        jne label1
label2: 
        movl %0,%%eax
        popal
        "
        :"=g"(j)
        :"g"(x),"g"(q),"g"(row),"g"(A),"g"(D),"g"(min)
         );

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019