diff options
-rw-r--r-- | CMake/CheckCxxTarget.cmake | 7 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 3 |
3 files changed, 6 insertions, 8 deletions
diff --git a/CMake/CheckCxxTarget.cmake b/CMake/CheckCxxTarget.cmake index 373c0be4c..17c32bfac 100644 --- a/CMake/CheckCxxTarget.cmake +++ b/CMake/CheckCxxTarget.cmake @@ -25,11 +25,12 @@ # SOFTWARE. +include(CheckCXXSourceCompiles) function(check_cxx_target var target code) check_cxx_source_compiles( " - __attribute__((target(\"${target}\"))) static int foo() { ${code} return 1; } - __attribute__((target(\"default\"))) static int foo() { ${code} return 0; } - int main() { return foo(); } + __attribute__((target(\"${target}\"))) static int foo(int i) { return ${code}; } + __attribute__((target(\"default\"))) static int foo(int i) { return i; } + int main(int i, char **) { return foo(i); } " ${var}) endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index 9df96ee85..115041f54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,8 +198,8 @@ endif() # Check multiversioning include(CheckCxxTarget) -check_cxx_target(HAVE_FMV_SSE42_AND_CRC32 "sse4.2" "__builtin_ia32_crc32si(0, 1llu);") -check_cxx_target(HAVE_FMV_SSE42_AND_CRC32DI "sse4.2" "__builtin_ia32_crc32di(0, 1llu);") +check_cxx_target(HAVE_FMV_SSE42_AND_CRC32 "sse4.2" "__builtin_ia32_crc32si(0,i)|__builtin_ia32_crc32hi(0,i)|__builtin_ia32_crc32qi(0,i)") +check_cxx_target(HAVE_FMV_SSE42_AND_CRC32DI "sse4.2" "__builtin_ia32_crc32di(0,i)") # Configure some variables like package, version and architecture. set(PACKAGE ${PROJECT_NAME}) diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 02448a073..7eb5ab10b 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -214,8 +214,6 @@ map_id_t pkgCache::sHash(StringView Str) const return Hash % HeaderP->GetHashTableSize(); } -#if defined(HAVE_FMV_SSE42_AND_CRC32) - #ifdef HAVE_FMV_SSE42_AND_CRC32 __attribute__((target("sse4.2"))) static uint32_t hash32(uint32_t crc32, const unsigned char *input, size_t size) { @@ -253,7 +251,6 @@ __attribute__((target("sse4.2"))) static uint32_t hash32(uint32_t crc32, const u crc32 ^= 0xffffffffU; return crc32; } -#endif __attribute__((target("default"))) #endif |