This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: PATCH: Add pause intrinsic


On Thu, 26 May 2011 09:12:06 -0700
Andi Kleen <andi@firstfloor.org> wrote:

> Basile Starynkevitch <basile@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} ***


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