On Thu, 26 May 2011 09:12:06 -0700 Andi Kleen <a...@firstfloor.org> wrote:
> Basile Starynkevitch <bas...@starynkevitch.net> writes: > > > > Perhaps the doc might explain why is it necessary to have a builtin for > > two independent roles: first, the full compiler memory barrier (which > > probably means to spill all the registers on the stack - definitely a > > task for a compiler); second, to "pause" the processor (which might > > also mean to flush or invalidate some data caches). In particular, I > > would naively imagine that we might have a more generic builtin for the > > compiler memory barrier (which probably could be independent of the > > particular ia32 target), and in that case which can't we just implement > > the pause ia32 builtin as builtin_compiler_barrier(); asm ("pause")? > > Because a pause() which can be freely moved around is pretty much > useless. Think about it. And a memory barrier is the standard > way to prevent moving around in relation to other code. I thought that there is a syntax, perhaps volatile asm("pause"), which forbids the compiler to move an asm statement? Or is the "memory" thing? (I am not very used to GCC asm). Still, is there a way to ask GCC to spill all data from registers to memory, and to require GCC to consider all registers crappy and to reload them when needed? I would imagine that such a feature is useful, and most importantly, that it should not be specific to ia32! Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***