This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Optimization bug on i386, stack fiddling


Bernd Schmidt <bernds@balti.cygnus.co.uk> writes:
> Try
> asm ("all the pushes
>       call foo
>       all the pops");
> 
> or, even better, leave the saving of registers to the compiler:
> 
> asm ("call foo" : : : "eax", "ebx", "ecx", ...);

foo() really takes two arguments (foo(p, t)), so I tried the following

    asm ("addl $-8, %%esp\n\t"
         "pushl %1\n\t"
         "pushl %0\n\t"
         "call foo\n\t"
         "addl $8, %%esp"
         :
         : "r" (p), "r" (t)
         : "ebx", "ecx", "esi", "edi");

gcc wouldn't let me put "eax" and "edx" in the list, and it doesn't
generate code to save ecx.  I don't know if this is a problem yet;
foo() is really rather nasty.

However, it works for my single test-case, so I'll try to give it the
entire regression test suite tour tomorrow.

Thanks!
-- 
Lars Balker Rasmussen, Software Engineer, Mjolner Informatics ApS
lbr@mjolner.dk

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]