From b0d2af20ae7f15545524c8ba813dcc14faefe524 Mon Sep 17 00:00:00 2001 From: TimQu Date: Sat, 28 May 2016 17:24:19 +0200 Subject: [PATCH] added check for existence of __builtin_popcountll (reverted from commit 30bcfcad0eb4041f954e4d893d5b0c3bd4f8d4f6 [formerly 65f94a6d6e9536398b4921953d00304af26514e5]) Former-commit-id: 6aaa503f580c3f460fe707e5a13d9282e5e0ba90 --- CMakeLists.txt | 4 ---- src/storage/BitVector.cpp | 16 ++++++---------- storm-config.h.in | 3 --- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42525ae36..f2621cf4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/resources/cmak include(ExternalProject) -include(CheckFunctionExists) ############################################################# ## ## CMake options of StoRM @@ -106,9 +105,6 @@ message(STATUS "Assuming extension for static libraries: ${STATIC_EXT}") ## Compiler specific settings and definitions ## ############################################################# - -CHECK_FUNCTION_EXISTS(__builtin_popcountll, STORM_HAS_BUILTIN_POPCOUNT) - # Path to the no-strict-aliasing target set(CONVERSIONHELPER_TARGET "${PROJECT_SOURCE_DIR}/src/utility/ConversionHelper.cpp") diff --git a/src/storage/BitVector.cpp b/src/storage/BitVector.cpp index a40c89a2d..a60b8c10c 100644 --- a/src/storage/BitVector.cpp +++ b/src/storage/BitVector.cpp @@ -549,13 +549,13 @@ namespace storm { // First, count all full buckets. uint_fast64_t bucket = index >> 6; for (uint_fast64_t i = 0; i < bucket; ++i) { - // Check how to determine the number of set bits in a bucket -#ifdef WINDOWS + // Check if we are using g++ or clang++ and, if so, use the built-in function +#if (defined (__GNUG__) || defined(__clang__)) + result += __builtin_popcountll(buckets[i]); +#elif defined WINDOWS #include // If the target machine does not support SSE4, this will fail. result += _mm_popcnt_u64(bucketVector[i]); -#elif defined STORM_HAS_BUILTIN_POPCOUNT - result += __builtin_popcountll(buckets[i]); #else uint_fast32_t cnt; uint_fast64_t bitset = buckets[i]; @@ -571,12 +571,8 @@ namespace storm { if (tmp != 0) { tmp = ~((1ll << (64 - (tmp & mod64mask))) - 1ll); tmp &= buckets[bucket]; - // Check how to determine the number of set bits in a bucket -#ifdef WINDOWS -#include - // If the target machine does not support SSE4, this will fail. - result += _mm_popcnt_u64(tmp); -#elif defined STORM_HAS_BUILTIN_POPCOUNT + // Check if we are using g++ or clang++ and, if so, use the built-in function +#if (defined (__GNUG__) || defined(__clang__)) result += __builtin_popcountll(tmp); #else uint_fast32_t cnt; diff --git a/storm-config.h.in b/storm-config.h.in index 539d75a55..1bc2eac7d 100644 --- a/storm-config.h.in +++ b/storm-config.h.in @@ -51,7 +51,4 @@ #cmakedefine STORM_LOG_DISABLE_DEBUG -// Check whether machine supports builtin_popcount -#cmakedefine STORM_HAS_BUILTIN_POPCOUNT - #endif // STORM_GENERATED_STORMCONFIG_H_