So, I have finished the changes I had in mind for this. I have tried to be clear about how I intend things to work (IOW, there's lots of comments). Changing headers/includes without breaking something elsewhere can be challenging, but I'm pretty sure I've got this right. On the plus side, if something's wrong, it shows up as a compile/link error, so it's easy to spot.

The patch is attached. Note that there is an updated makefile.am, so you'll need to re-gen the related .in file. Here's what it includes:

-----------------------------------------------------------------------
- Move all the implementations for the intrinsics I have been working on from winnt.h to (new file) psdk_inc/intrin-impl.h. - Use __MINGW_INTRIN_INLINE instead of __CRT_INLINE for functions in psdk_inc/intrin-impl.h.
- Add comments to intrin.h describing how the MSVC intrinsics work in gcc.
- Add include for intrin-impl.h to intrin.h, protected by #ifdef.
- Since winnt.h sometimes includes intrin.h, only declare the prototypes for intrinsics (the ones that winnt.h has always declared) if intrin.h isn't being included.
- Use the same cygwin logic in winnt.h for both x86 and x64.
- Make the corresponding changes to the files in mingw-w64-crt\intrincs to use the new approach in intrin-impl.h.

It also includes the work from https://sourceforge.net/mailarchive/message.php?msg_id=31051013:

1) The existing code for __faststorefence doesn't actually generate a fence. It just generates a barrier. This patch maps __faststorefence to _mm_sfence (instead of doing MS's trick with "lock or"). sfence appears to be faster than MS's "fast" approach on modern processors.

2) MS's MemoryBarrier (which is supposed to be a full compiler barrier + processor fence) maps to __faststorefence. This works for MS because their __faststorefence trick ends up generating a full fence + full barrier. Since our __faststorefence now uses sfence, this patch adjusts MemoryBarrier to use _mm_mfence().

3) While there is a prototype for _ReadWriteBarrier in winnt.h, there is no implementation. Since _ReadWriteBarrier is -only- a compiler directive (rather like #pragma), there is no way to place it in a library. As a result, this patch implements it with a #define in both winnt.h & intrin.h.

4) Gcc doesn't actually support _ReadBarrier() and _WriteBarrier. This patch defines them as being mapped to _ReadWriteBarrier() with a #define in both winnt.h & intrin.h.

5) While there is a prototype for __int2c in winnt.h and intrin.h, there is no implementation. Since MS docs say this is only available as an intrinsic (what gcc calls builtin), this patch defines it with a macro in both winnt.h and intrin.h. (Update: This is now done as an inline routine + lib version)

6) The code for DbgRaiseAssertionFailure won't compile with -masm=intel. Use __builtint from intrin-mac.h.

7) Add __buildint to intrin-mac.h for DbgRaiseAssertionFailure & __int2c.

8) On x86, if SSE2 is available, use _mm_pause for YieldProcessor and _mm_mfence for MemoryBarrier. If SSE2 is not available, build the appropriate asm ("rep nop" for pause and "xchg" for MemoryBarrier).
-----------------------------------------------------------------------

If I were to change one thing, it would probably be to remove the #ifdef around the intrin-impl.h include in intrin.h. Why? When I tried to write the comment about when you might want to use __INTRINSIC_LIBRARY_ONLY, I couldn't come up with a single case. Adding complexity with no corresponding benefit is something I try to avoid.

And while I'd *like* to change the definition for _ReadWriteBarrier from:

#define _ReadWriteBarrier() __asm__ __volatile__ ("" ::: "memory")

to

extern __inline__ __attribute__((__always_inline__,__gnu_inline__))
void _ReadWriteBarrier()
{
   __asm__ __volatile__ ("" ::: "memory");
}

I can't completely convince myself they are -exactly- the same. Using an empty asm block is a tricky thing. For example, since there is no actual asm output, you cannot put this in a library and expect it to work. What's more, simply by virtue of the fact that you are calling a routine, you can implicitly get some of the effects of the memory barrier. But just because sometimes it looks like it might be working isn't the same as it being right.

dw
Index: mingw-w64-crt/intrincs/__faststorefence.c
===================================================================
--- mingw-w64-crt/intrincs/__faststorefence.c   (revision 0)
+++ mingw-w64-crt/intrincs/__faststorefence.c   (working copy)
@@ -0,0 +1,4 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___faststorefence // Causes code generation in 
intrin-impl.h
+
+#include <intrin.h>
Index: mingw-w64-crt/intrincs/__int2c.c
===================================================================
--- mingw-w64-crt/intrincs/__int2c.c    (revision 0)
+++ mingw-w64-crt/intrincs/__int2c.c    (working copy)
@@ -0,0 +1,4 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___int2c // Causes code generation in intrin-impl.h
+
+#include <intrin.h>
Index: mingw-w64-crt/intrincs/__stosb.c
===================================================================
--- mingw-w64-crt/intrincs/__stosb.c    (revision 5915)
+++ mingw-w64-crt/intrincs/__stosb.c    (working copy)
@@ -1,4 +1,4 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___stosb // Causes code generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
-
-__buildstos(__stosb, unsigned char)
Index: mingw-w64-crt/intrincs/__stosd.c
===================================================================
--- mingw-w64-crt/intrincs/__stosd.c    (revision 5915)
+++ mingw-w64-crt/intrincs/__stosd.c    (working copy)
@@ -1,4 +1,4 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___stosd // Causes code generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
-
-__buildstos(__stosd, unsigned __LONG32)
Index: mingw-w64-crt/intrincs/__stosq.c
===================================================================
--- mingw-w64-crt/intrincs/__stosq.c    (revision 5915)
+++ mingw-w64-crt/intrincs/__stosq.c    (working copy)
@@ -1,4 +1,4 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___stosq // Causes code generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
-
-__buildstos(__stosq, unsigned __int64)
Index: mingw-w64-crt/intrincs/__stosw.c
===================================================================
--- mingw-w64-crt/intrincs/__stosw.c    (revision 5915)
+++ mingw-w64-crt/intrincs/__stosw.c    (working copy)
@@ -1,4 +1,4 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___stosw // Causes code generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
-
-__buildstos(__stosw, unsigned short)
Index: mingw-w64-crt/intrincs/bittestci.c
===================================================================
--- mingw-w64-crt/intrincs/bittestci.c  (revision 5915)
+++ mingw-w64-crt/intrincs/bittestci.c  (working copy)
@@ -1,6 +1,6 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__interlockedbittestandcomplement // Causes code 
generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildbittesti(_interlockedbittestandcomplement, __LONG32, "lock btc", "I", 
/* unused param */)
-
 unsigned char InterlockedBitTestAndComplement(__LONG32 volatile *, __LONG32) 
__attribute__((alias("_interlockedbittestandcomplement")));
Index: mingw-w64-crt/intrincs/bittestci64.c
===================================================================
--- mingw-w64-crt/intrincs/bittestci64.c        (revision 5915)
+++ mingw-w64-crt/intrincs/bittestci64.c        (working copy)
@@ -1,6 +1,6 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__interlockedbittestandcomplement64 // Causes code 
generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildbittesti(_interlockedbittestandcomplement64, __int64, "lock btc", "J", 
/* unused param */)
-
 unsigned char InterlockedBitTestAndComplement64(__int64 volatile *, __int64) 
__attribute__((alias("_interlockedbittestandcomplement64")));
Index: mingw-w64-crt/intrincs/bittestri.c
===================================================================
--- mingw-w64-crt/intrincs/bittestri.c  (revision 5915)
+++ mingw-w64-crt/intrincs/bittestri.c  (working copy)
@@ -1,6 +1,6 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__interlockedbittestandreset // Causes code 
generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildbittesti(_interlockedbittestandreset, __LONG32, "lock btr", "I", /* 
unused param */)
-
 unsigned char InterlockedBitTestAndReset(__LONG32 volatile *, __LONG32) 
__attribute__((alias("_interlockedbittestandreset")));
Index: mingw-w64-crt/intrincs/bittestri64.c
===================================================================
--- mingw-w64-crt/intrincs/bittestri64.c        (revision 5915)
+++ mingw-w64-crt/intrincs/bittestri64.c        (working copy)
@@ -1,6 +1,6 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__interlockedbittestandreset64 // Causes code 
generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildbittesti(_interlockedbittestandreset64, __int64, "lock btr", "J", /* 
unused param */)
-
 unsigned char InterlockedBitTestAndReset64(__int64 volatile *, __int64) 
__attribute__((alias("_interlockedbittestandreset64")));
Index: mingw-w64-crt/intrincs/bittestsi.c
===================================================================
--- mingw-w64-crt/intrincs/bittestsi.c  (revision 5915)
+++ mingw-w64-crt/intrincs/bittestsi.c  (working copy)
@@ -1,6 +1,6 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__interlockedbittestandset // Causes code 
generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildbittesti(_interlockedbittestandset, __LONG32, "lock bts", "I", /* 
unused param */)
-
 unsigned char InterlockedBitTestAndSet(__LONG32 volatile *, __LONG32) 
__attribute__((alias("_interlockedbittestandset")));
Index: mingw-w64-crt/intrincs/bittestsi64.c
===================================================================
--- mingw-w64-crt/intrincs/bittestsi64.c        (revision 5915)
+++ mingw-w64-crt/intrincs/bittestsi64.c        (working copy)
@@ -1,6 +1,6 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__interlockedbittestandset64 // Causes code 
generation in intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildbittesti(_interlockedbittestandset64, __int64, "lock bts", "J", /* 
unused param */)
-
 unsigned char InterlockedBitTestAndSet64(__int64 volatile *, __int64) 
__attribute__((alias("_interlockedbittestandset64")));
Index: mingw-w64-crt/intrincs/ilockand.c
===================================================================
--- mingw-w64-crt/intrincs/ilockand.c   (revision 5915)
+++ mingw-w64-crt/intrincs/ilockand.c   (working copy)
@@ -1,7 +1,7 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__InterlockedAnd // Causes code generation in 
intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildlogicali(_InterlockedAnd, __LONG32, and)
-
 __LONG32 InterlockedAnd(__LONG32 volatile *, __LONG32) 
__attribute__((alias("_InterlockedAnd")));
 
Index: mingw-w64-crt/intrincs/ilockand64.c
===================================================================
--- mingw-w64-crt/intrincs/ilockand64.c (revision 5915)
+++ mingw-w64-crt/intrincs/ilockand64.c (working copy)
@@ -1,8 +1,9 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__InterlockedAnd64 // Causes code generation in 
intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
 #ifdef _WIN64
-__buildlogicali(_InterlockedAnd64, __int64, and)
 #else
 __int64 __stdcall InterlockedCompareExchange64(__int64 volatile *Destination,
   __int64 Exchange, __int64 Comperand);
Index: mingw-w64-crt/intrincs/ilockor.c
===================================================================
--- mingw-w64-crt/intrincs/ilockor.c    (revision 5915)
+++ mingw-w64-crt/intrincs/ilockor.c    (working copy)
@@ -1,7 +1,7 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__InterlockedOr // Causes code generation in 
intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildlogicali(_InterlockedOr, __LONG32, or)
-
 __LONG32 InterlockedOr(__LONG32 volatile *, __LONG32) 
__attribute__((alias("_InterlockedOr")));
 
Index: mingw-w64-crt/intrincs/ilockor64.c
===================================================================
--- mingw-w64-crt/intrincs/ilockor64.c  (revision 5915)
+++ mingw-w64-crt/intrincs/ilockor64.c  (working copy)
@@ -1,8 +1,9 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__InterlockedOr64 // Causes code generation in 
intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
 #ifdef _WIN64
-__buildlogicali(_InterlockedOr64, __int64, or)
 #else
 __int64 __stdcall InterlockedCompareExchange64(__int64 volatile *Destination,
   __int64 Exchange, __int64 Comperand);
Index: mingw-w64-crt/intrincs/ilockxor.c
===================================================================
--- mingw-w64-crt/intrincs/ilockxor.c   (revision 5915)
+++ mingw-w64-crt/intrincs/ilockxor.c   (working copy)
@@ -1,7 +1,7 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__InterlockedXor // Causes code generation in 
intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
-__buildlogicali(_InterlockedXor, __LONG32, xor)
-
 __LONG32 InterlockedXor(__LONG32 volatile *, __LONG32) 
__attribute__((alias("_InterlockedXor")));
 
Index: mingw-w64-crt/intrincs/ilockxor64.c
===================================================================
--- mingw-w64-crt/intrincs/ilockxor64.c (revision 5915)
+++ mingw-w64-crt/intrincs/ilockxor64.c (working copy)
@@ -1,8 +1,9 @@
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__InterlockedXor64 // Causes code generation in 
intrin-impl.h
+
 #include <intrin.h>
-#include <psdk_inc/intrin-mac.h>
 
 #ifdef _WIN64
-__buildlogicali(_InterlockedXor64, __int64, xor)
 #else
 __int64 __stdcall InterlockedCompareExchange64(__int64 volatile *Destination,
   __int64 Exchange, __int64 Comperand);
Index: mingw-w64-crt/Makefile.am
===================================================================
--- mingw-w64-crt/Makefile.am   (revision 5915)
+++ mingw-w64-crt/Makefile.am   (working copy)
@@ -271,7 +271,7 @@
   intrincs/outbytestring.c  intrincs/outdword.c       
intrincs/outdwordstring.c  intrincs/outword.c       intrincs/outwordstring.c  \
   intrincs/rdtsc.c          intrincs/readcr0.c        intrincs/readcr2.c       
  intrincs/readcr3.c       intrincs/readcr4.c        \
   intrincs/readcr8.c        intrincs/readmsr.c        intrincs/writecr0.c      
  intrincs/writecr2.c      intrincs/writecr3.c       \
-  intrincs/writecr4.c       intrincs/writecr8.c       intrincs/writemsr.c      
  intrincs/RtlSecureZeroMemory.c
+  intrincs/writecr4.c       intrincs/writecr8.c       intrincs/writemsr.c      
  intrincs/__int2c.c       intrincs/RtlSecureZeroMemory.c
 
 # these only go into the 64 bit version:
 src_intrincs64=\
@@ -281,7 +281,7 @@
   intrincs/readgsqword.c  intrincs/writegsbyte.c  intrincs/writegsword.c  
intrincs/writegsdword.c    \
   intrincs/writegsqword.c intrincs/mul128ex.c     intrincs/umul128ex.c    
intrincs/_mul128.c         \
   intrincs/_umul128.c     intrincs/__movsq.c      intrincs/__stosq.c      
intrincs/__shiftright128.c \
-  intrincs/bittestci64.c  intrincs/__shiftleft128.c
+  intrincs/bittestci64.c  intrincs/__faststorefence.c    
intrincs/__shiftleft128.c
 
 # these only go into the 32 bit version:
 src_intrincs32=\
Index: mingw-w64-headers/crt/intrin.h
===================================================================
--- mingw-w64-headers/crt/intrin.h      (revision 5915)
+++ mingw-w64-headers/crt/intrin.h      (working copy)
@@ -3,6 +3,32 @@
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
+
+/* The purpose of this file is to provide support for MSVC's intrinsics (what 
gcc calls
+   Builtins) in gcc.  In MSVC, there are several features for intrinsics:
+
+   - Intrinsics can either be implemented inline (via the compiler), or 
implemented as functions.
+   - You can specify which approach you prefer either globally (via compile 
switch /Oi) or
+     on a function by function basis via pragmas.
+   - Before you can use any of the intrinsics, they must be declared via a 
prototype.  For
+     whatever reason, MS has decided to put all the intrinsics in one file 
(intrin.h) AND
+     to put copies of some of these prototypes in various platform sdk headers.
+
+   In gcc, this is implemented as follows:
+
+   - The inline implementations for the intrinsics are located in 
intrin-impl.h.  This file
+     is included by intrin.h.  To get the inline versions, you must include 
intrin.h.
+   - If, for some reason, you don't want to use inline versions, define 
__INTRINSIC_LIBRARY_ONLY
+     before including intrin.h.  This will disable the inline versions and the 
functions will
+     be resolved from the library.
+   - Platform include files that include their own copies of the prototypes 
but DON'T include
+     intrin.h will resolve the symbols via the library.  This may result in 
slightly poorer
+     performance, since the functions will usually be invoked via call.
+
+   If you wish to implement intrinsic functions that are defined in intrin.h 
but are not
+   yet implemented in mingw, see the comments at the top of intrin-impl.h.
+*/
+
 #ifndef __INTRIN_H_
 #define __INTRIN_H_
 #ifndef RC_INVOKED
@@ -436,7 +462,7 @@
     __MACHINEIA64(__MINGW_EXTENSION void __ptri(__int64,__int64))
     __MACHINEIA64(void *_rdteb(void))
     __MACHINESA(int _ReadStatusReg(int))
-    __MACHINECE(void _ReadWriteBarrier(void))
+    //__MACHINECE(void _ReadWriteBarrier(void))
     __MACHINEIA64(__MINGW_EXTENSION void _ReleaseSpinLock(unsigned __int64 *))
     __MACHINEI(void *_ReturnAddress(void))
     __MACHINEIA64(void *_ReturnAddress(void))
@@ -496,7 +522,7 @@
     __MACHINECE(int __cdecl wcsncmp(const wchar_t *,const wchar_t *,size_t))
     __MACHINECE(wchar_t *__cdecl wcsncpy(wchar_t * __restrict__ ,const wchar_t 
* __restrict__ ,size_t))
     __MACHINECE(wchar_t *__cdecl _wcsset(wchar_t *,wchar_t))
-    __MACHINECE(void _WriteBarrier(void))
+    //__MACHINECE(void _WriteBarrier(void))
     __MACHINESA(void _WriteStatusReg(int,int,int))
     __MACHINEI(void *_AddressOfReturnAddress(void))
     __MACHINEIA64(void __yield(void))
@@ -961,10 +987,10 @@
     __MACHINEX86X(__m128 _mm_moveldup_ps(__m128))
     __MACHINEX86X(void _mm_mwait(unsigned int,unsigned int))
 #endif
-    __MACHINEI(void _WriteBarrier(void))
-    __MACHINEI(void _ReadWriteBarrier(void))
-    __MACHINEIA64(void _WriteBarrier(void))
-    __MACHINEIA64(void _ReadWriteBarrier(void))
+    //__MACHINEI(void _WriteBarrier(void))
+    //__MACHINEI(void _ReadWriteBarrier(void))
+    //__MACHINEIA64(void _WriteBarrier(void))
+    //__MACHINEIA64(void _ReadWriteBarrier(void))
     __MACHINEX64(void __faststorefence(void))
     __MACHINEX64(__MINGW_EXTENSION __int64 __mulh(__int64,__int64))
     __MACHINEX64(__MINGW_EXTENSION unsigned __int64 __umulh(unsigned 
__int64,unsigned __int64))
@@ -1078,7 +1104,7 @@
     __MACHINEW64(__MINGW_EXTENSION unsigned __int64 _umul128(unsigned __int64 
multiplier,unsigned __int64 multiplicand,unsigned __int64 *highproduct))
     __MACHINEW64(__MINGW_EXTENSION __int64 _mul128(__int64 multiplier,__int64 
multiplicand,__int64 *highproduct))
     __MACHINEI(void __int2c(void))
-    __MACHINEIW64(void _ReadBarrier(void))
+    //__MACHINEIW64(void _ReadBarrier(void))
     __MACHINEIW64(unsigned char _rotr8(unsigned char value,unsigned char 
shift))
     __MACHINEIW64(unsigned short _rotr16(unsigned short value,unsigned char 
shift))
     __MACHINEIW64(unsigned char _rotl8(unsigned char value,unsigned char 
shift))
@@ -1612,6 +1638,19 @@
 #define __REG_IA64_DbD7 8583
 #endif
 
+/* The Barrier functions can never be in the library.  Since gcc only
+supports ReadWriteBarrier, map all 3 to do the same. */
+#define _ReadWriteBarrier() __asm__ __volatile__ ("" ::: "memory")
+#define _ReadBarrier _ReadWriteBarrier
+#define _WriteBarrier _ReadWriteBarrier
+
+/* Under certain circumstances, it may be desirable to NOT use the
+always_inline versions of the intrinsics.  To only use the library
+versions, define __INTRINSIC_LIBRARY_ONLY */
+#ifndef __INTRINSIC_LIBRARY_ONLY
+#include <psdk_inc/intrin-impl.h>
+#endif
+
 #if defined(_NO_PREFETCHW)
 #if defined(__x86_64)
 
Index: mingw-w64-headers/include/psdk_inc/intrin-impl.h
===================================================================
--- mingw-w64-headers/include/psdk_inc/intrin-impl.h    (revision 0)
+++ mingw-w64-headers/include/psdk_inc/intrin-impl.h    (working copy)
@@ -0,0 +1,185 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+/* To use the implementations in this file, you would normally just #include 
<intrin.h>
+   This will define inlines for all intrinsics.  If you wish to disable all 
inline versions
+   of the intrinsics and use the library versions, define 
__INTRINSIC_LIBRARY_ONLY before 
+   including intrin.h.  See also the comments at the top of intrin.h.
+*/
+
+/* To add an implementation for a new intrinsic to this file, first make sure 
the prototype exists in intrin.h.
+   intrin.h should ONLY contain definitions for MSVC's intrinsic functions.  
Then use this outline when adding 
+   definitions to this file:
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndSet)   // Checks to see if needed
+
+__INTRINSICS_USEINLINE
+<code goes here>
+
+#endif // __INTRINSIC_PROLOG
+*/
+
+/* All intrinsics should be implemented both as inlines in this file, and 
included in the library.
+   If you have followed the instructions above to define the inline version, 
create the appropriate .c file
+   in mingw-w64-crt/intrincs, add it to the appropriate make file, and put 
this code in it:
+
+   #define __INTRINSIC_ONLYSPECIAL
+   #define __INTRINSIC_SPECIAL_InterlockedBitTestAndSet   // Causes code 
generation in intrin-impl.h
+
+   #include <intrin.h>
+*/
+
+#ifndef _INTRIN_IMPL_
+#define _INTRIN_IMPL_
+
+#include <psdk_inc/intrin-mac.h>
+
+/* The logic for this macro is:
+   (if we are not just defining special OR (we are defining special AND this 
is one of the ones we are defining))
+*/
+#define __INTRINSIC_PROLOG(name) (!defined (__INTRINSIC_ONLYSPECIAL)) || 
(defined (__INTRINSIC_ONLYSPECIAL) && defined(__INTRINSIC_SPECIAL_ ## name))
+
+#ifdef __INTRINSIC_ONLYSPECIAL
+#define __INTRINSICS_USEINLINE
+#else
+#define __INTRINSICS_USEINLINE __MINGW_INTRIN_INLINE
+#endif
+
+#ifdef __x86_64__
+
+#if __INTRINSIC_PROLOG(__faststorefence)
+__INTRINSICS_USEINLINE
+void __faststorefence(void) {
+    _mm_sfence();
+}
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(__stosq)
+__INTRINSICS_USEINLINE 
+__buildstos(__stosq, unsigned __int64)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandset64)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandset64, __int64, "lock bts", "J", /* 
unused param */)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandreset64)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandreset64, __int64, "lock btr", "J", /* 
unused param */)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandcomplement64)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandcomplement64, __int64, "lock btc", "J", 
/* unused param */)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndSet64)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndSet64, __int64, "lock bts", "J", volatile)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndReset64)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndReset64, __int64, "lock btr", "J", 
volatile)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement64)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndComplement64, __int64, "lock btc", "J", 
volatile)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_InterlockedAnd64)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedAnd64, __int64, and)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_InterlockedOr64)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedOr64, __int64, or)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_InterlockedXor64)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedXor64, __int64, xor)
+#endif // __INTRINSIC_PROLOG
+
+#endif // __x86_64__
+
+/* ***************************************************** */
+
+#if defined(__x86_64__) || defined(_X86_)
+
+#if __INTRINSIC_PROLOG(__int2c)
+__INTRINSICS_USEINLINE 
+void __int2c(void) {
+    __buildint(0x2c);
+}
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(__stosb)
+__INTRINSICS_USEINLINE 
+__buildstos(__stosb, unsigned char)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(__stosw)
+__INTRINSICS_USEINLINE 
+__buildstos(__stosw, unsigned short)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(__stosd)
+__INTRINSICS_USEINLINE 
+__buildstos(__stosd, unsigned __LONG32)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandset)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandset, __LONG32, "lock bts", "I", /* 
unused param */)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandreset)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandreset, __LONG32, "lock btr", "I", /* 
unused param */)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_interlockedbittestandcomplement)
+__INTRINSICS_USEINLINE 
+__buildbittesti(_interlockedbittestandcomplement, __LONG32, "lock btc", "I", 
/* unused param */)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndSet)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndSet, __LONG32, "lock bts", "I", volatile)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndReset)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndReset, __LONG32, "lock btr", "I", 
volatile)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement)
+__INTRINSICS_USEINLINE 
+__buildbittesti(InterlockedBitTestAndComplement, __LONG32, "lock btc", "I", 
volatile)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_InterlockedAnd)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedAnd, __LONG32, and)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_InterlockedOr)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedOr, __LONG32, or)
+#endif // __INTRINSIC_PROLOG
+
+#if __INTRINSIC_PROLOG(_InterlockedXor)
+__INTRINSICS_USEINLINE 
+__buildlogicali(_InterlockedXor, __LONG32, xor)
+#endif // __INTRINSIC_PROLOG
+
+#endif // defined(__x86_64__) || (defined(_X86_)
+
+#endif // _INTRIN_IMPL_
Index: mingw-w64-headers/include/psdk_inc/intrin-mac.h
===================================================================
--- mingw-w64-headers/include/psdk_inc/intrin-mac.h     (revision 5915)
+++ mingw-w64-headers/include/psdk_inc/intrin-mac.h     (working copy)
@@ -54,4 +54,22 @@
    return old; \
 }
 
+/* This macro is used by YieldProcessor when compiling x86 w/o SSE2.
+It generates the same opcodes as _mm_pause.  */
+#define __buildpause() __asm__ __volatile__("rep nop")
+
+/* This macro is used by DbgRaiseAssertionFailure and __int2c
+
+Parameters: (IntNum)
+IntNum: Interrupt number in hex */
+#define __buildint(a) __asm__ __volatile__("int {$}" #a :)
+
+/* This macro is used by MemoryBarrier when compiling x86 w/o SSE2. 
+Note that on i386, xchg performs an implicit lock. */
+#define __buildmemorybarrier() \
+{ \
+unsigned char Barrier; \
+__asm__ __volatile__("xchg{b %%| }al, %0" :"=m" (Barrier) : /* no inputs */ : 
"eax", "memory"); \
+}
+
 #endif /* _INTRIN_MAC_ */
Index: mingw-w64-headers/include/winnt.h
===================================================================
--- mingw-w64-headers/include/winnt.h   (revision 5915)
+++ mingw-w64-headers/include/winnt.h   (working copy)
@@ -18,7 +18,6 @@
 #define ANYSIZE_ARRAY 1
 
 #include <specstrings.h>
-#include <psdk_inc/intrin-mac.h>
 
 #if defined(__x86_64) && \
   !(defined(_X86_) || defined(__i386__) || defined(_IA64_))
@@ -1166,6 +1165,74 @@
   typedef ULONG_PTR KSPIN_LOCK;
   typedef KSPIN_LOCK *PKSPIN_LOCK;
 
+/* Don't include intrin.h on Cygwin.  It pulls in unneeded stuff. */
+#ifdef __CYGWIN__
+# if defined(__cplusplus)
+extern "C" {
+# endif
+# include <x86intrin.h>
+# if defined(__cplusplus)
+}
+# endif
+
+/* These definitions are duplicated from intrin.h.  This is done
+to be compatible with MS's winnt.h which also does this.  To avoid
+unnecessary duplication, they are only defined here if intrin.h is 
+not included.
+
+Unless intrin.h is included elsewhere, any usage of these functions 
+will be resolved from the library rather than performed inline.  See the 
+comments at the top of intrin.h for more details. */
+
+# if defined(__cplusplus)
+extern "C" {
+# endif
+
+#define _ReadWriteBarrier() __asm__ __volatile__ ("" ::: "memory")
+#define _ReadBarrier _ReadWriteBarrier
+#define _WriteBarrier _ReadWriteBarrier
+
+void __int2c(void);
+void __stosb(unsigned char *, unsigned char, size_t);
+void __stosw(unsigned short *, unsigned short, size_t);
+void __stosd(unsigned __LONG32 *, unsigned __LONG32, size_t);
+
+unsigned char _interlockedbittestandset(__LONG32 *a, __LONG32 b);
+unsigned char _interlockedbittestandreset(__LONG32 *a, __LONG32 b);
+unsigned char _interlockedbittestandcomplement(__LONG32 *a, __LONG32 b);
+
+unsigned char InterlockedBitTestAndSet(volatile __LONG32 *a, __LONG32 b);
+unsigned char InterlockedBitTestAndReset(volatile __LONG32 *a, __LONG32 b);
+unsigned char InterlockedBitTestAndComplement(volatile __LONG32 *a, __LONG32 
b);
+
+__LONG32 _InterlockedAnd(__LONG32 volatile *, __LONG32);
+__LONG32 _InterlockedOr(__LONG32 volatile *, __LONG32);
+__LONG32 _InterlockedXor(__LONG32 volatile *, __LONG32);
+
+#ifdef __x86_64
+void __faststorefence(void);
+__MINGW_EXTENSION void __stosq(unsigned __int64 *, unsigned __int64, size_t);
+
+__MINGW_EXTENSION unsigned char InterlockedBitTestAndSet64(volatile __int64 
*a, __int64 b);
+__MINGW_EXTENSION unsigned char InterlockedBitTestAndReset64(volatile __int64 
*a, __int64 b);
+__MINGW_EXTENSION unsigned char InterlockedBitTestAndComplement64(volatile 
__int64 *a, __int64 b);
+
+__MINGW_EXTENSION unsigned char _interlockedbittestandset64(__int64 *a, 
__int64 b);
+__MINGW_EXTENSION unsigned char _interlockedbittestandreset64(__int64 *a, 
__int64 b);
+__MINGW_EXTENSION unsigned char _interlockedbittestandcomplement64(__int64 *a, 
__int64 b);
+
+__MINGW_EXTENSION __int64 _InterlockedAnd64(__int64 volatile *, __int64);
+__MINGW_EXTENSION __int64 _InterlockedOr64(__int64 volatile *, __int64);
+__MINGW_EXTENSION __int64 _InterlockedXor64(__int64 volatile *, __int64);
+#endif
+
+# if defined(__cplusplus)
+}
+# endif
+#else /* !__CYGWIN__ */
+# include <intrin.h>
+#endif /* __CYGWIN__ */
+
 #ifdef _AMD64_
 
 #if defined(__x86_64) && !defined(RC_INVOKED)
@@ -1205,22 +1272,10 @@
 
     BOOLEAN _bittestandset(LONG *Base,LONG Offset);
     BOOLEAN _bittestandreset(LONG *Base,LONG Offset);
-    BOOLEAN _interlockedbittestandset(__LONG32 *Base,LONG Offset);
-    BOOLEAN _interlockedbittestandreset(__LONG32 *Base,LONG Offset);
-    BOOLEAN _interlockedbittestandcomplement(__LONG32 *Base,LONG Bit);
-    BOOLEAN InterlockedBitTestAndSet(volatile __LONG32 *Base,LONG Offset);
-    BOOLEAN InterlockedBitTestAndReset(volatile __LONG32 *Base,LONG Offset);
-    BOOLEAN InterlockedBitTestAndComplement(volatile __LONG32 *Base,LONG Bit);
     BOOLEAN _bittest64(LONG64 const *Base,LONG64 Offset);
     BOOLEAN _bittestandcomplement64(LONG64 *Base,LONG64 Offset);
     BOOLEAN _bittestandset64(LONG64 *Base,LONG64 Offset);
     BOOLEAN _bittestandreset64(LONG64 *Base,LONG64 Offset);
-    BOOLEAN InterlockedBitTestAndSet64(volatile LONG64 *Base,LONG64 Offset);
-    BOOLEAN InterlockedBitTestAndReset64(volatile LONG64 *Base,LONG64 Offset);
-    BOOLEAN InterlockedBitTestAndComplement64(volatile LONG64 *Base,LONG64 
Bit);
-    BOOLEAN _interlockedbittestandset64(LONG64 *Base,LONG64 Offset);
-    BOOLEAN _interlockedbittestandreset64(LONG64 *Base,LONG64 Offset);
-    BOOLEAN _interlockedbittestandcomplement64(LONG64 *Base,LONG64 Bit);
 #ifndef __CRT__NO_INLINE
     __CRT_INLINE BOOLEAN _bittestandset(LONG *Base,LONG Offset) {
       int old = 0;
@@ -1236,14 +1291,6 @@
        :"Ir" (Offset) : "memory");
       return (BOOLEAN) (old!=0);
     }
-    __CRT_INLINE __buildbittesti(_interlockedbittestandset, __LONG32, "lock 
bts", "I", /* unused param */)
-    __CRT_INLINE __buildbittesti(_interlockedbittestandreset, __LONG32, "lock 
btr", "I", /* unused param */)
-    __CRT_INLINE __buildbittesti(_interlockedbittestandcomplement, __LONG32, 
"lock btc", "I", /* unused param */)
-
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndSet, __LONG32, "lock 
bts", "I", volatile)
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndReset, __LONG32, "lock 
btr", "I", volatile)
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndComplement, __LONG32, 
"lock btc", "I", volatile)
-
     __CRT_INLINE BOOLEAN _bittest64(LONG64 const *Base,LONG64 Offset) {
       int old = 0;
       __asm__ __volatile__("btq %2,%1\n\tsbbl %0,%0 "
@@ -1272,14 +1319,6 @@
        :"Ir" (Offset) : "memory");
       return (BOOLEAN) (old!=0);
     }
-    __CRT_INLINE __buildbittesti(_interlockedbittestandset64, LONG64, "lock 
bts", "J", /* unused param */)
-    __CRT_INLINE __buildbittesti(_interlockedbittestandreset64, LONG64, "lock 
btr", "J", /* unused param */)
-    __CRT_INLINE __buildbittesti(_interlockedbittestandcomplement64, LONG64, 
"lock btc", "J", /* unused param */)
-
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndSet64, LONG64, "lock 
bts", "J", volatile)
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndReset64, LONG64, "lock 
btr", "J", volatile)
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndComplement64, LONG64, 
"lock btc", "J", volatile)
-
 #endif /* !__CRT__NO_INLINE */
 
 #define BitScanForward _BitScanForward
@@ -1366,15 +1405,9 @@
     SHORT InterlockedIncrement16(SHORT volatile *Addend);
     SHORT InterlockedDecrement16(SHORT volatile *Addend);
     SHORT InterlockedCompareExchange16(SHORT volatile *Destination,SHORT 
ExChange,SHORT Comperand);
-    LONG InterlockedAnd(LONG volatile *Destination,LONG Value);
-    LONG InterlockedOr(LONG volatile *Destination,LONG Value);
-    LONG InterlockedXor(LONG volatile *Destination,LONG Value);
     LONG InterlockedIncrement(LONG volatile *Addend);
     LONG InterlockedDecrement(LONG volatile *Addend);
     LONG InterlockedExchange(LONG volatile *Target,LONG Value);
-    LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value);
-    LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value);
-    LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value);
 
 #ifndef __CRT__NO_INLINE
     __CRT_INLINE SHORT InterlockedIncrement16(SHORT volatile *Addend) {
@@ -1401,14 +1434,6 @@
        : "memory");
       return prev;
     }
-
-    __CRT_INLINE __buildlogicali(InterlockedAnd, LONG, and)
-    __CRT_INLINE __buildlogicali(InterlockedOr, LONG, or)
-    __CRT_INLINE __buildlogicali(InterlockedXor, LONG, xor)
-
-    __CRT_INLINE __buildlogicali(InterlockedAnd64, LONG64, and)
-    __CRT_INLINE __buildlogicali(InterlockedOr64, LONG64, or)
-    __CRT_INLINE __buildlogicali(InterlockedXor64, LONG64, xor)
 #endif /* !__CRT__NO_INLINE */
 
     LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value);
@@ -1479,34 +1504,13 @@
 
 #define CacheLineFlush(Address) _mm_clflush(Address)
 
-    VOID _ReadWriteBarrier(VOID);
-
-/* Don't include intrin.h on Cygwin.  It pulls in unneeded stuff. */
-#ifdef __CYGWIN__
-# if defined(__cplusplus)
-extern "C" {
-# endif
-# include <x86intrin.h>
-# if defined(__cplusplus)
-}
-# endif
-#else /* !__CYGWIN__ */
-# include <intrin.h>
-#endif /* __CYGWIN__ */
-
 #define FastFence __faststorefence
 #define LoadFence _mm_lfence
 #define MemoryFence _mm_mfence
 #define StoreFence _mm_sfence
 
-#ifdef __MINGW_INTRIN_INLINE
-    __MINGW_INTRIN_INLINE void __faststorefence(void) {
-      __asm__ __volatile__ ("" ::: "memory");
-    }
-#endif
-
 #define YieldProcessor _mm_pause
-#define MemoryBarrier __faststorefence
+#define MemoryBarrier _mm_mfence
 #define PreFetchCacheLine(l,a) _mm_prefetch((CHAR CONST *) a,l)
 #define PrefetchForWrite(p) _m_prefetchw(p)
 #define ReadForWriteAccess(p) (_m_prefetchw(p),*(p))
@@ -1519,8 +1523,6 @@
 #define ReadMxCsr _mm_getcsr
 #define WriteMxCsr _mm_setcsr
 
-    VOID __int2c(VOID);
-
 #define DbgRaiseAssertionFailure() __int2c()
 #define GetCallersEflags() __getcallerseflags()
 
@@ -1536,16 +1538,6 @@
     VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count);
     VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count);
     VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count);
-    VOID __stosb(PBYTE Destination,BYTE Value,SIZE_T Count);
-    VOID __stosw(PWORD Destination,WORD Value,SIZE_T Count);
-    VOID __stosd(PDWORD Destination,DWORD Value,SIZE_T Count);
-    VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count);
-#ifndef __CRT__NO_INLINE
-__CRT_INLINE __buildstos(__stosb, BYTE)
-__CRT_INLINE __buildstos(__stosw, WORD)
-__CRT_INLINE __buildstos(__stosd, DWORD)
-__CRT_INLINE __buildstos(__stosq, DWORD64)
-#endif /* __CRT__NO_INLINE */
 
 #define MultiplyHigh __mulh
 #define UnsignedMultiplyHigh __umulh
@@ -1803,23 +1795,6 @@
 #define InterlockedIncrementAcquire InterlockedIncrement
 #define InterlockedIncrementRelease InterlockedIncrement
 
-    BOOLEAN _interlockedbittestandset(LONG *Base,LONG Bit);
-    BOOLEAN _interlockedbittestandreset(LONG *Base,LONG Bit);
-    BOOLEAN _interlockedbittestandcomplement(LONG *Base,LONG Bit);
-
-    BOOLEAN InterlockedBitTestAndSet(volatile LONG *Base,LONG Bit);
-    BOOLEAN InterlockedBitTestAndReset(volatile LONG *Base,LONG Bit);
-    BOOLEAN InterlockedBitTestAndComplement(volatile LONG *Base,LONG Bit);
-#ifndef __CRT__NO_INLINE
-    __CRT_INLINE __buildbittesti(_interlockedbittestandset, LONG, "lock bts", 
"I", /* unused param */)
-    __CRT_INLINE __buildbittesti(_interlockedbittestandreset, LONG, "lock 
btr", "I", /* unused param */)
-    __CRT_INLINE __buildbittesti(_interlockedbittestandcomplement, LONG, "lock 
btc", "I", /* unused param */)
-
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndSet, LONG, "lock bts", 
"I", volatile)
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndReset, LONG, "lock btr", 
"I", volatile)
-    __CRT_INLINE __buildbittesti(InterlockedBitTestAndComplement, LONG, "lock 
btc", "I", volatile)
-#endif /* !__CRT__NO_INLINE */
-
 #ifdef _PREFIX_
     BYTE __readfsbyte(DWORD Offset);
     WORD __readfsword(DWORD Offset);
@@ -1836,8 +1811,20 @@
 
 #if defined(__i386__) && !defined(__x86_64)
 
-#define YieldProcessor() __asm__ __volatile__("rep; nop");
+#ifndef _INTRIN_MAC_
+#include <psdk_inc/intrin-mac.h>
+#endif
 
+#ifdef __SSE2__
+#define YieldProcessor _mm_pause
+#define MemoryBarrier _mm_mfence
+#else
+#define YieldProcessor __buildpause()
+VOID MemoryBarrier(VOID);
+__CRT_INLINE VOID MemoryBarrier(VOID)
+__buildmemorybarrier()
+#endif
+
 #define PreFetchCacheLine(l,a)
 #define ReadForWriteAccess(p) (*(p))
 
@@ -1848,24 +1835,16 @@
   struct _TEB *NtCurrentTeb(void);
   PVOID GetCurrentFiber(void);
   PVOID GetFiberData(void);
-  VOID MemoryBarrier(VOID);
 
 #ifdef __CRT__NO_INLINE
-# define DbgRaiseAssertionFailure() __asm__ __volatile__("int $0x2c");
+#define DbgRaiseAssertionFailure() __buildint(0x2c)
 #else
   VOID DbgRaiseAssertionFailure(void);
   __CRT_INLINE VOID DbgRaiseAssertionFailure(void) {
-    __asm__ __volatile__("int $0x2c");
+    __buildint(0x2c);
   }
 #endif
 
-  __CRT_INLINE VOID MemoryBarrier(VOID)
-  {
-    LONG Barrier = 0;
-    __asm__ __volatile__("xchgl %%eax,%0 "
-      :"=r" (Barrier));
-  }
-
   __CRT_INLINE struct _TEB *NtCurrentTeb(void)
   {
     struct _TEB *ret;
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to