remove Windows/ICC support

This commit is contained in:
Konstantinos Margaritis
2021-07-30 12:49:38 +03:00
parent 752d6cf997
commit cf4b95fff2
41 changed files with 94 additions and 892 deletions

View File

@@ -38,36 +38,38 @@
static really_inline
u32 popcount32(u32 x) {
#if defined(HAVE_POPCOUNT_INSTR)
// Single-instruction builtin.
return _mm_popcnt_u32(x);
#else
// Fast branch-free version from bit-twiddling hacks as older Intel
// processors do not have a POPCNT instruction.
x -= (x >> 1) & 0x55555555;
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
#endif
return __builtin_popcount(x);
// #if defined(HAVE_POPCOUNT_INSTR)
// // Single-instruction builtin.
// return _mm_popcnt_u32(x);
// #else
// // Fast branch-free version from bit-twiddling hacks as older Intel
// // processors do not have a POPCNT instruction.
// x -= (x >> 1) & 0x55555555;
// x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
// return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
// #endif
}
static really_inline
u32 popcount64(u64a x) {
#if defined(ARCH_X86_64)
# if defined(HAVE_POPCOUNT_INSTR)
// Single-instruction builtin.
return (u32)_mm_popcnt_u64(x);
# else
// Fast branch-free version from bit-twiddling hacks as older Intel
// processors do not have a POPCNT instruction.
x -= (x >> 1) & 0x5555555555555555;
x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);
x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f;
return (x * 0x0101010101010101) >> 56;
# endif
#else
// Synthesise from two 32-bit cases.
return popcount32(x >> 32) + popcount32(x);
#endif
return __builtin_popcountll(x);
// #if defined(ARCH_X86_64)
// # if defined(HAVE_POPCOUNT_INSTR)
// // Single-instruction builtin.
// return (u32)_mm_popcnt_u64(x);
// # else
// // Fast branch-free version from bit-twiddling hacks as older Intel
// // processors do not have a POPCNT instruction.
// x -= (x >> 1) & 0x5555555555555555;
// x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);
// x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f;
// return (x * 0x0101010101010101) >> 56;
// # endif
// #else
// // Synthesise from two 32-bit cases.
// return popcount32(x >> 32) + popcount32(x);
// #endif
}
#endif /* UTIL_POPCOUNT_H_ */