summaryrefslogtreecommitdiff
path: root/absl/numeric
diff options
context:
space:
mode:
authorGravatar Ben Niu <niuben003@gmail.com>2022-03-18 13:10:10 -0700
committerGravatar GitHub <noreply@github.com>2022-03-18 16:10:10 -0400
commit4c015dbb49fcfac25899f3ba7da4be665b5f9aab (patch)
tree3c914a0c7e696557705fdab1b79f5f441d82d27d /absl/numeric
parentc33f21f86a14216336b87d48e9b552a13985b2bc (diff)
Exclude unsupported x64 intrinsics from ARM64EC (#1135)
ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11. The ARM64EC does not support _umul128 and __rdtsc as x64 intrinsics, though it provides inline function implementations for them, by emulation. Since the code already has portable code paths without using the intrinsics, instead of using the emulated intrinsic implementations, we use the said portable code paths for ARM64EC.
Diffstat (limited to 'absl/numeric')
-rw-r--r--absl/numeric/int128.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h
index c7ad96be..7a899eec 100644
--- a/absl/numeric/int128.h
+++ b/absl/numeric/int128.h
@@ -44,7 +44,7 @@
// builtin type. We need to make sure not to define operator wchar_t()
// alongside operator unsigned short() in these instances.
#define ABSL_INTERNAL_WCHAR_T __wchar_t
-#if defined(_M_X64)
+#if defined(_M_X64) && !defined(_M_ARM64EC)
#include <intrin.h>
#pragma intrinsic(_umul128)
#endif // defined(_M_X64)
@@ -980,7 +980,7 @@ inline uint128 operator*(uint128 lhs, uint128 rhs) {
// can be used for uint128 storage.
return static_cast<unsigned __int128>(lhs) *
static_cast<unsigned __int128>(rhs);
-#elif defined(_MSC_VER) && defined(_M_X64)
+#elif defined(_MSC_VER) && defined(_M_X64) && !defined(_M_ARM64EC)
uint64_t carry;
uint64_t low = _umul128(Uint128Low64(lhs), Uint128Low64(rhs), &carry);
return MakeUint128(Uint128Low64(lhs) * Uint128High64(rhs) +