On Wed, May 25, 2011 at 12:17 PM, Basile Starynkevitch <bas...@starynkevitch.net> wrote: > On Wed, 25 May 2011 11:26:51 +0100 > Andrew Haley <a...@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")? >
We may need builtin_compiler_barrier(); asm ("pause"); builtin_compiler_barrier(); -- H.J.