public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* List of possible clobber registers for x86
@ 2003-01-17 18:14 Tamas Nagy
  2003-01-17 18:19 ` Andrew Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Tamas Nagy @ 2003-01-17 18:14 UTC (permalink / raw)
  To: gcc

Dear GCC-developers,

Thanks for this great product and your efforts.  

When using inline assembly, I realized I do not know exactly what registers can be listed as clobbered registers in x86 platforms.

I have an inline assembly routines, which basicly modifies the following registers
"eax, ebx, ecx, edx, esi, edi" and the memory.

The code runs perfectly without optimization (-O0). 

If I enable optimization (-O1..-O3), the code fails.. I assume this is due to the uncorrect list of clobbered registers.

I tried to pass all the mentioned, but only eax and ebx were accepted and the rest caused a compilation error: ~ "register not found in GENERAL_REGS" ...

So here is my real question, what is exactly this message and which registers should be listed as clobbers?

Many thanks,
Tamas 
______________________________________________________________________________
Sie haben mehr zu sagen als in eine SMS passt? Mit WEB.DE FreeMail ist
das jetzt kein Problem mehr! http://freemail.web.de/features/?mc=021182

^ permalink raw reply	[flat|nested] 3+ messages in thread

* List of possible clobber registers for x86
  2003-01-17 18:14 List of possible clobber registers for x86 Tamas Nagy
@ 2003-01-17 18:19 ` Andrew Haley
  2003-01-18 17:03   ` Tamas Nagy
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Haley @ 2003-01-17 18:19 UTC (permalink / raw)
  To: Tamas Nagy; +Cc: gcc

Tamas Nagy writes:
 > Dear GCC-developers,
 > 
 > Thanks for this great product and your efforts.  
 > 
 > When using inline assembly, I realized I do not know exactly what registers can be listed as clobbered registers in x86 platforms.
 > 
 > I have an inline assembly routines, which basicly modifies the following registers
 > "eax, ebx, ecx, edx, esi, edi" and the memory.

Gcc isn't magical, so it needs some registers to work with.  You've
clobbered almost all of them, so gcc can't do its job.

Two things to try:

1.  Save and restore a couple of the registers (with push, pop) and
    take them out of the clobber list.

2.  Rather than using specific named registers, let gcc do register
    allocation.  It can do a better job that way.

Andrew.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: List of possible clobber registers for x86
  2003-01-17 18:19 ` Andrew Haley
@ 2003-01-18 17:03   ` Tamas Nagy
  0 siblings, 0 replies; 3+ messages in thread
From: Tamas Nagy @ 2003-01-18 17:03 UTC (permalink / raw)
  To: 'Andrew Haley', gcc

1.)
This small assembly routines performs an intensive calculation operation
(>25% of total app time), runs several hundred millions time... This
simply means I want to avoid any performance penalty caused by
saving/restoring the registers...
Which registers are used by GCC and should be saved/restored?

2.) Interesting approach. Could you point me to a sample code which uses
this technique?

+1: Why e.g. ECX is not belonging to GENERAL_REGS, and cannot be listed
within clobber registers?

Thanks,
Tamas


> -----Original Message-----
> From: aph@cambridge.redhat.com 
> [mailto:aph@cambridge.redhat.com] On Behalf Of Andrew Haley
> Sent: Friday, January 17, 2003 2:02 PM
> To: Tamas Nagy
> Cc: gcc@gcc.gnu.org
> Subject: List of possible clobber registers for x86
> 
> 
> Tamas Nagy writes:
>  > Dear GCC-developers,
>  > 
>  > Thanks for this great product and your efforts.  
>  > 
>  > When using inline assembly, I realized I do not know 
> exactly what registers can be listed as clobbered registers 
> in x86 platforms.  > 
>  > I have an inline assembly routines, which basicly modifies 
> the following registers  > "eax, ebx, ecx, edx, esi, edi" and 
> the memory.
> 
> Gcc isn't magical, so it needs some registers to work with.  
> You've clobbered almost all of them, so gcc can't do its job.
> 
> Two things to try:
> 
> 1.  Save and restore a couple of the registers (with push, pop) and
>     take them out of the clobber list.
> 
> 2.  Rather than using specific named registers, let gcc do register
>     allocation.  It can do a better job that way.
> 
> Andrew.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-18  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-17 18:14 List of possible clobber registers for x86 Tamas Nagy
2003-01-17 18:19 ` Andrew Haley
2003-01-18 17:03   ` Tamas Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).