From 1492b8cf7d0f86f608333a946169812c8cffa693 Mon Sep 17 00:00:00 2001 From: Manish Godse <61718172+mangod9@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:43:56 -0700 Subject: [PATCH 1/2] disable optimizations for PopCount avoid using an optimization which might fail on non-SSE4 cpus. --- src/coreclr/jit/utils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/coreclr/jit/utils.cpp b/src/coreclr/jit/utils.cpp index aed8cda7c24df9..a608f861ed0d91 100644 --- a/src/coreclr/jit/utils.cpp +++ b/src/coreclr/jit/utils.cpp @@ -3436,6 +3436,11 @@ uint32_t BitOperations::Log2(uint64_t value) // Return Value: // The population count (number of bits set) of value // +#if defined(_MSC_VER) +// Disable optimizations for PopCount to avoid the compiler from generating intrinsics +// not supported on all platforms. +#pragma optimize("", off) +#endif // _MSC_VER uint32_t BitOperations::PopCount(uint32_t value) { #if defined(_MSC_VER) @@ -3488,6 +3493,9 @@ uint32_t BitOperations::PopCount(uint64_t value) return static_cast(result); #endif } +#if defined(_MSC_VER) +#pragma optimize("", on) +#endif // _MSC_VER //------------------------------------------------------------------------ // BitOperations::ReverseBits: Reverses the bits in an integer value From eadc004b28676e555a734c9555ed7858a9767d1d Mon Sep 17 00:00:00 2001 From: Manish Godse <61718172+mangod9@users.noreply.github.com> Date: Fri, 15 Mar 2024 08:24:33 -0700 Subject: [PATCH 2/2] remove whitespace for jit-format --- src/coreclr/jit/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/utils.cpp b/src/coreclr/jit/utils.cpp index a608f861ed0d91..9e706fd884e56b 100644 --- a/src/coreclr/jit/utils.cpp +++ b/src/coreclr/jit/utils.cpp @@ -3438,7 +3438,7 @@ uint32_t BitOperations::Log2(uint64_t value) // #if defined(_MSC_VER) // Disable optimizations for PopCount to avoid the compiler from generating intrinsics -// not supported on all platforms. +// not supported on all platforms. #pragma optimize("", off) #endif // _MSC_VER uint32_t BitOperations::PopCount(uint32_t value)