Author: tkreuzer Date: Tue Nov 25 09:08:34 2014 New Revision: 65480
URL: http://svn.reactos.org/svn/reactos?rev=65480&view=rev Log: [PSDK] When I wrote "the compiler can optimize this better" I was obviously referring to a sane compiler like MSVC. Optimize (U)Int32x32To64 on x86 GCC builds by using __emul(u), since the native math results in horribly inefficient code doing 3 multiplications and some shifts.
Modified: trunk/reactos/include/psdk/ntdef.h trunk/reactos/include/psdk/winnt.h trunk/reactos/include/xdk/ntbasedef.h
Modified: trunk/reactos/include/psdk/ntdef.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntdef.h?rev=65... ============================================================================== --- trunk/reactos/include/psdk/ntdef.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ntdef.h [iso-8859-1] Tue Nov 25 09:08:34 2014 @@ -828,10 +828,15 @@ #define MAXULONG 0xffffffff #define MAXLONGLONG (0x7fffffffffffffffLL)
-/* Multiplication and Shift Operations. Note: we don't use inline - asm functions, the compiler can optimize this better. */ -#define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b))) -#define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b)) +/* 32 to 64 bit multiplication. GCC is really bad at optimizing the native math */ +#if defined(_M_IX86) && defined(__GNUC__) && \ + !defined(MIDL_PASS)&& !defined(RC_INVOKED) && !defined(_M_CEE_PURE) + #define Int32x32To64(a,b) __emul(a,b) + #define UInt32x32To64(a,b) __emulu(a,b) +#else + #define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b))) + #define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b)) +#endif
#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE) /* Use native math */
Modified: trunk/reactos/include/psdk/winnt.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=65... ============================================================================== --- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Tue Nov 25 09:08:34 2014 @@ -761,10 +761,15 @@ #define MAXDWORD 0xffffffff #define MAXLONGLONG (0x7fffffffffffffffLL)
-/* Multiplication and Shift Operations. Note: we don't use inline - asm functions, the compiler can optimize this better. */ -#define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b))) -#define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b)) +/* 32 to 64 bit multiplication. GCC is really bad at optimizing the native math */ +#if defined(_M_IX86) && defined(__GNUC__) && \ + !defined(MIDL_PASS)&& !defined(RC_INVOKED) && !defined(_M_CEE_PURE) + #define Int32x32To64(a,b) __emul(a,b) + #define UInt32x32To64(a,b) __emulu(a,b) +#else + #define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b))) + #define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b)) +#endif
#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE) /* Use native math */ @@ -1709,10 +1714,6 @@ #define THREAD_BASE_PRIORITY_MAX 2 #define THREAD_BASE_PRIORITY_MIN (-2) #define THREAD_BASE_PRIORITY_IDLE (-15) - -#define PROCESS_SET_LIMITED_INFORMATION 0x2000 -#define THREAD_RESUME 0x1000 - /* * To prevent gcc compiler warnings, bracket these defines when initialising * a SID_IDENTIFIER_AUTHORITY, eg.
Modified: trunk/reactos/include/xdk/ntbasedef.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/ntbasedef.h?rev... ============================================================================== --- trunk/reactos/include/xdk/ntbasedef.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/ntbasedef.h [iso-8859-1] Tue Nov 25 09:08:34 2014 @@ -747,10 +747,15 @@ $endif(_WINNT_) #define MAXLONGLONG (0x7fffffffffffffffLL)
-/* Multiplication and Shift Operations. Note: we don't use inline - asm functions, the compiler can optimize this better. */ -#define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b))) -#define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b)) +/* 32 to 64 bit multiplication. GCC is really bad at optimizing the native math */ +#if defined(_M_IX86) && defined(__GNUC__) && \ + !defined(MIDL_PASS)&& !defined(RC_INVOKED) && !defined(_M_CEE_PURE) + #define Int32x32To64(a,b) __emul(a,b) + #define UInt32x32To64(a,b) __emulu(a,b) +#else + #define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b))) + #define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b)) +#endif
#if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE) /* Use native math */