Skip to content

Commit

Permalink
if_likely() hurts GCC performance
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jun 20, 2024
1 parent 4a44eda commit e6c3dbd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/popcnt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ inline uint64_t popcnt64(uint64_t x)
{
// On my AMD EPYC 7642 CPU using GCC 12 this runtime
// check incurs an overall overhead of about 1%.
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
{
__asm__("popcnt %1, %0" : "=r"(x) : "r"(x));
return x;
Expand All @@ -78,7 +78,7 @@ namespace {

inline uint64_t popcnt64(uint64_t x)
{
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
{
uint32_t x0 = uint32_t(x);
uint32_t x1 = uint32_t(x >> 32);
Expand Down Expand Up @@ -135,7 +135,7 @@ inline uint64_t popcnt64(uint64_t x)
#if defined(HAS_POPCNT)
return __popcnt64(x);
#elif defined(ENABLE_CPUID_POPCNT)
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
return __popcnt64(x);
else
return popcnt64_bitwise(x);
Expand All @@ -160,7 +160,7 @@ inline uint64_t popcnt64(uint64_t x)
return __popcnt(uint32_t(x)) +
__popcnt(uint32_t(x >> 32));
#elif defined(ENABLE_CPUID_POPCNT)
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
return __popcnt(uint32_t(x)) +
__popcnt(uint32_t(x >> 32));
else
Expand Down

0 comments on commit e6c3dbd

Please sign in to comment.