PATCH: Add pause intrinsic

Andrew Haley aph@redhat.com
Thu May 26 09:35:00 GMT 2011


On 25/05/11 20:17, Basile Starynkevitch wrote:
> 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

No.  It clobbers all of _memory_, which doesn't involve auto variables.
I don't understand why __builtin_ia32_pause needs to have a barrier either.

> - definitely a
> task for a compiler); second, to "pause" the processor (which might
> also mean to flush or invalidate some data caches).

No, it doesn't.  I posted exactly what pause does in an earlier mail.

Andrew.



More information about the Gcc-patches mailing list