Skip to content

Commit aee4957

Browse files
authored
disable optimizations for PopCount (#99796)
* disable optimizations for PopCount avoid using an optimization which might fail on non-SSE4 cpus. * remove whitespace for jit-format
1 parent ad4c7c3 commit aee4957

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/coreclr/jit/utils.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3436,6 +3436,11 @@ uint32_t BitOperations::Log2(uint64_t value)
34363436
// Return Value:
34373437
// The population count (number of bits set) of value
34383438
//
3439+
#if defined(_MSC_VER)
3440+
// Disable optimizations for PopCount to avoid the compiler from generating intrinsics
3441+
// not supported on all platforms.
3442+
#pragma optimize("", off)
3443+
#endif // _MSC_VER
34393444
uint32_t BitOperations::PopCount(uint32_t value)
34403445
{
34413446
#if defined(_MSC_VER)
@@ -3488,6 +3493,9 @@ uint32_t BitOperations::PopCount(uint64_t value)
34883493
return static_cast<uint32_t>(result);
34893494
#endif
34903495
}
3496+
#if defined(_MSC_VER)
3497+
#pragma optimize("", on)
3498+
#endif // _MSC_VER
34913499

34923500
//------------------------------------------------------------------------
34933501
// BitOperations::ReverseBits: Reverses the bits in an integer value

0 commit comments

Comments
 (0)