So, having heard nothing back on this topic, I've decided to just try it and see how it looks.
Below are the proposed contents of the new file intrin-impl.h, which gets included at the bottom of intrin.h. It's still a little rough, but it should be enough to decide if I'm heading in the right direction. My plan (pending feedback) is to see about migrating the rest of my most recent patch attempt (__faststorefence et al) to using this approach. Nothing tests ideas like using them. -------------------------------------------------------------------------------------------- /* To use the implementations in this file, you would normally just #include <intrin.h> This will define inlines for all intrinsics. */ /* To implement the library versions of the functions in this file, add code like this to the appropriate c file in mingw-w64-crt\intrincs: #define __INTRINSIC_ONLYSPECIAL #define __INTRINSIC_SPECIAL___stosb // Specify the function to implement #include <intrin.h> */ /* To add an implementation for a new intrinsic to this file, first make sure the definition exists in intrin.h. The assumption is that intrin.h will ONLY contain definitions for MSVC's intrinsic functions. Next, use this outline when adding definitions to this file: #if __INTRINSIC_PROLOG(__faststorefence) // Checks to see if needed __INTRINSICS_USEINLINE // Optional. May be omitted (for example when using #define) <code goes here> #endif // __INTRINSIC_PROLOG */ #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 #endif // __x86_64__ #if __INTRINSIC_PROLOG(__int2c) __INTRINSICS_USEINLINE void __int2c(void) { __buildint(0x2c); } #endif // __INTRINSIC_PROLOG #endif // _INTRIN_IMPL_ ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public