ALU/FPU test: Fixed MSVC x86 build

This commit is contained in:
tevador 2018-11-20 22:41:34 +01:00
parent f19995d4c5
commit 072130c774

View File

@ -20,14 +20,16 @@
#endif #endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define HAS_VALUE(X) X ## 0
#define EVAL_DEFINE(X) HAS_VALUE(X)
#include <intrin.h> #include <intrin.h>
#include <stdlib.h> #include <stdlib.h>
#define ror64 _rotr64 #define ror64 _rotr64
#define rol64 _rotl64 #define rol64 _rotl64
#ifdef __MACHINEARM64_X64 #if EVAL_DEFINE(__MACHINEARM64_X64(1))
#define umulhi64 __umulh #define umulhi64 __umulh
#endif #endif
#ifdef __MACHINEX64 #if EVAL_DEFINE(__MACHINEX64(1))
static inline uint64_t __imulhi64(int64_t a, int64_t b) { static inline uint64_t __imulhi64(int64_t a, int64_t b) {
int64_t hi; int64_t hi;
_mul128(a, b, &hi); _mul128(a, b, &hi);
@ -35,9 +37,6 @@
} }
#define imulhi64 __imulhi64 #define imulhi64 __imulhi64
#endif #endif
#ifdef __MACHINEX86_X64
#define sar64 __ll_rshift
#endif
#endif #endif
#ifndef ror64 #ifndef ror64
@ -60,11 +59,11 @@
return value >> shift; return value >> shift;
} }
struct usesArithmeticShift : std::integral_constant<bool, builtintShr64(-1LL, 1) == -1LL> { struct UsesArithmeticShift : std::integral_constant<bool, builtintShr64(-1LL, 1) == -1LL> {
}; };
static inline int64_t __sar64(int64_t a, int b) { static inline int64_t __sar64(int64_t a, int b) {
return usesArithmeticShift::value ? builtintShr64(a, b) : (a < 0 ? ~(~a >> b) : a >> b); return UsesArithmeticShift::value ? builtintShr64(a, b) : (a < 0 ? ~(~a >> b) : a >> b);
} }
#define sar64 __sar64 #define sar64 __sar64
#endif #endif