https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62109

--- Comment #4 from David <gccbugzilla at limegreensocks dot com> ---
(In reply to Mikael Pettersson from comment #3)
> Do you have a test case which fails without your patch?

I do not.  But this is a "by definition" thing.

This instruction is intended to emulate the Windows InterlockedCompareExchange
instruction (see the comments above the code).  And all Windows Interlocked*
instructions perform an implicit compiler barrier.  After all, it does no good
for the 'lock' prefix to prevent the processor from re-ordering instructions if
the compiler does it while building the code.  Moving loads or stores past this
statement makes a mess of thread synchronization.

That said, this instruction was only intended to be used on Win95 (neither NT
nor Win98 need it).  Not exactly a common platform these days.  But it's
possible someone is still using this, or will copy this asm block for their own
use, so it should still be correct.

Reply via email to