PATCH: Add pause intrinsic

Basile Starynkevitch basile@starynkevitch.net
Wed May 25 19:53:00 GMT 2011


On Wed, 25 May 2011 11:26:51 +0100
Andrew Haley <aph@redhat.com> wrote:

> On 05/24/2011 07:28 PM, H.J. Lu wrote:
> 
> > This patch implements pause intrinsic suggested by Andi.  OK
> > for trunk?
> 
> What does "full memory barrier" here mean?
> 
> +@table @code
> +@item void __builtin_ia32_pause (void)
> +Generates the @code{pause} machine instruction with full memory barrier.
> +@end table
> 
> There a memory clobber, but no barrier instruction AFAICS.  The
> doc needs to explain it a bit better.

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")?

I find the above documentation too short and (being a non native
English speaker) I would prefer it to be much longer. I am not able to
suggest better phrasing (because I still did not entirely understood
what that builtin_ia32_pause is useful or needed).

And if there was a builtin_compiler_barrier () I would believe it can
have a lot of other uses. Any generated C code which wants some
introspection or some garbage collection write barrier might want it
too! [perhaps even I might find later such thing useful in C code
generated by MELT]

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



More information about the Gcc-patches mailing list