mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
Improve platform detection, in particular MSVC ARM64
This commit is contained in:
parent
907ffde577
commit
3feb1479c9
3 changed files with 13 additions and 7 deletions
|
@ -48,7 +48,7 @@ Revision History:
|
|||
// clear to the compiler what instructions should be used. E.g., for sqrt(), the Windows compiler selects
|
||||
// the x87 FPU, even when /arch:SSE2 is on.
|
||||
// Luckily, these are kind of standardized, at least for Windows/Linux/macOS.
|
||||
#ifdef __clang__
|
||||
#if defined(__clang__) || defined(_M_ARM) && defined(_M_ARM64)
|
||||
#undef USE_INTRINSICS
|
||||
#endif
|
||||
|
||||
|
@ -276,7 +276,7 @@ void hwf_manager::round_to_integral(mpf_rounding_mode rm, hwf const & x, hwf & o
|
|||
|
||||
// According to the Intel Architecture manual, the x87-instruction FRNDINT is the
|
||||
// same in 32-bit and 64-bit mode. The _mm_round_* intrinsics are SSE4 extensions.
|
||||
#ifdef _WINDOWS
|
||||
#if defined(_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
|
||||
#if defined( __MINGW32__ ) && ( defined( __GNUG__ ) || defined( __clang__ ) )
|
||||
o.value = nearbyint(x.value);
|
||||
#else
|
||||
|
|
|
@ -46,18 +46,17 @@ Revision History:
|
|||
#define LEHMER_GCD
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#if defined(_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
|
||||
// This is needed for _tzcnt_u32 and friends.
|
||||
#include <immintrin.h>
|
||||
#define _trailing_zeros32(X) _tzcnt_u32(X)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define _trailing_zeros32(X) __builtin_ctz(X)
|
||||
#else
|
||||
#define _trailing_zeros32(X) _tzcnt_u32(X)
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__) || defined(_WIN64)
|
||||
#if (defined(__LP64__) || defined(_WIN64)) && !defined(_M_ARM) && !defined(_M_ARM64)
|
||||
#if defined(__GNUC__)
|
||||
#define _trailing_zeros64(X) __builtin_ctzll(X)
|
||||
#else
|
||||
|
@ -69,6 +68,11 @@ inline uint64_t _trailing_zeros64(uint64_t x) {
|
|||
for (; 0 == (x & 1) && r < 64; ++r, x >>= 1);
|
||||
return r;
|
||||
}
|
||||
inline uint32_t _trailing_zeros32(uint32_t x) {
|
||||
uint32_t r = 0;
|
||||
for (; 0 == (x & 1) && r < 32; ++r, x >>= 1);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue