On 07/03/13 02:29, dw wrote: > Thanks to both Kai and Jacek whose suggestions made this patch much > better. > > This patch includes two parts. The first (and more important) deals > with how MSVC's intrinsics are used in mingw-w64: > > winnt.h: > > - In all cases (x86, x64, cygwin, not cygwin), remove include for > intrin.h and always include x86intrin.h. > - Always include (new file) intrin-impl.h, along with define to ensure > only winnt.h-related inline functions are created. > - Move all the implementations for the intrinsics I have been working > on from winnt.h to (new file) psdk_inc/intrin-impl.h. > - Temporarily (until these get migrated to intrin-impl.h) add > prototypes for __readgs* and __writegs* from intrin.h, needed since > intrin.h is no longer included. > > intrin.h: > - Add include for intrin-impl.h. > - Add comments describing how the MSVC intrinsics work in gcc. > - Changed all // to /* */ > - Changed various "#if !(__ia64__ || __x86_64)" to "#if > !(defined(__ia64__) || defined(__x86_64))" which was causing compiler > warnings with certain settings. > > intrin-impl.h: > - New file to hold all inline versions of functions related to MSVC's > intrinsics. > - Add copious comments to the top of the file describing the logic of > how this should work. > - Use __MINGW_INTRIN_INLINE instead of __CRT_INLINE for functions > > Other: > - Make the corresponding changes to the files in > mingw-w64-crt\intrincs\*.c to use the new approach in intrin-impl.h. > > The second part relates to __faststorefence, _ReadWriteBarrier et al: > > - The existing code for __faststorefence doesn't actually generate a > fence. Create intrinsic to use sfence which appears to be faster than > MS's trick on newer processors. > - MS's MemoryBarrier can't use __faststorefence if we aren't using > MS's trick. Change this to use mfence. > - Add definitions for _ReadWriteBarrier, _ReadBarrier, _WriteBarrier. > This is done with #define, since inline may not produce exactly the > same results. > - Add intrinsic for __int2c using __builtint from intrin-mac.h. > - The code for DbgRaiseAssertionFailure won't compile with > -masm=intel. Use __builtint from intrin-mac.h. > - Add __buildint to intrin-mac.h for DbgRaiseAssertionFailure & __int2c.
Looks good to me. Thanks, Jacek ------------------------------------------------------------------------------ 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
