On Wed, 25 May 2011 12:31:17 -0700
"H.J. Lu" <hjl.to...@gmail.com> wrote:

> On Wed, May 25, 2011 at 12:17 PM, Basile Starynkevitch
> <bas...@starynkevitch.net> wrote:
> > 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")?
> >
> 
> We may need
> 
>  builtin_compiler_barrier();
>  asm ("pause");
> builtin_compiler_barrier();

I don't understand why the second builtin_compiler_barrier() after the
asm ("pause") would be needed? Could you please explain why should we
need it? My feeling was that after the first builtin_compiler_barrier
() and hence after the asm ("pause") no register would contain valid
data, and the compiler would have to reload from memory everything. So
why do you think the second is needed???

Or perhaps I misunderstood completely all the issues!


-- 
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} ***

Reply via email to