public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* asm memory barrier question
@ 2004-03-16 14:05 jhjk jhj
  2004-03-16 19:57 ` Falk Hueffner
  0 siblings, 1 reply; 2+ messages in thread
From: jhjk jhj @ 2004-03-16 14:05 UTC (permalink / raw)
  To: gcc

I understand that gcc-help might be a more suitable list to send this but I 
think this is a little advanced question and I would like to have an answer 
from a developer.

I want to do something like this:

(code)
asm_function_that_alters_general_purpose_registers_WITHOUT_restoring_them();
(other code)

I am quite sure that this will break things. (Right?)

But what about this?

(code)
asm_function-that_alters_general_purpose_registers_without_restoring_them();
asm volatile("" : : : "memory");
(other code)

The program will break?
I am not interested in portability, just gcc.
Thank you in advace for any answer and please CC me.

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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

* Re: asm memory barrier question
  2004-03-16 14:05 asm memory barrier question jhjk jhj
@ 2004-03-16 19:57 ` Falk Hueffner
  0 siblings, 0 replies; 2+ messages in thread
From: Falk Hueffner @ 2004-03-16 19:57 UTC (permalink / raw)
  To: jhjk jhj; +Cc: gcc

"jhjk jhj" <mmore_benq@hotmail.com> writes:

> (code)
> asm_function-that_alters_general_purpose_registers_without_restoring_them();
> asm volatile("" : : : "memory");
> (other code)
>
> The program will break?

Yes. If you want to alter general purpose registers without restoring
them, add them to the asm's clobber list.

-- 
	Falk

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

end of thread, other threads:[~2004-03-16 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-16 14:05 asm memory barrier question jhjk jhj
2004-03-16 19:57 ` Falk Hueffner

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).