From e6c3dbd2ef3704804912190773e1b87472be5487 Mon Sep 17 00:00:00 2001 From: Kim Walisch Date: Thu, 20 Jun 2024 19:19:36 +0200 Subject: [PATCH] if_likely() hurts GCC performance --- include/popcnt.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/popcnt.hpp b/include/popcnt.hpp index 4d9704c6..5d7749bb 100644 --- a/include/popcnt.hpp +++ b/include/popcnt.hpp @@ -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; @@ -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); @@ -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); @@ -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