diff --git a/src/util/bitutils.h b/src/util/bitutils.h index 6fdafa71..979a2c04 100644 --- a/src/util/bitutils.h +++ b/src/util/bitutils.h @@ -254,7 +254,7 @@ u32 compress32(u32 x, u32 m) { #if defined(__BMI2__) // BMI2 has a single instruction for this operation. return _pext_u32(x, m); -#endif +#else // Return zero quickly on trivial cases if ((x & m) == 0) { @@ -281,6 +281,7 @@ u32 compress32(u32 x, u32 m) { } return x; +#endif } static really_inline @@ -288,7 +289,7 @@ u64a compress64(u64a x, u64a m) { #if defined(ARCH_X86_64) && defined(__BMI2__) // BMI2 has a single instruction for this operation. return _pext_u64(x, m); -#endif +#else // Return zero quickly on trivial cases if ((x & m) == 0) { @@ -316,6 +317,7 @@ u64a compress64(u64a x, u64a m) { } return x; +#endif } static really_inline @@ -323,7 +325,7 @@ u32 expand32(u32 x, u32 m) { #if defined(__BMI2__) // BMI2 has a single instruction for this operation. return _pdep_u32(x, m); -#endif +#else // Return zero quickly on trivial cases if (!x || !m) { @@ -355,6 +357,7 @@ u32 expand32(u32 x, u32 m) { } return x & m0; // clear out extraneous bits +#endif } static really_inline @@ -362,7 +365,7 @@ u64a expand64(u64a x, u64a m) { #if defined(ARCH_X86_64) && defined(__BMI2__) // BMI2 has a single instruction for this operation. return _pdep_u64(x, m); -#endif +#else // Return zero quickly on trivial cases if (!x || !m) { @@ -395,6 +398,7 @@ u64a expand64(u64a x, u64a m) { } return x & m0; // clear out extraneous bits +#endif } diff --git a/src/util/shuffle.h b/src/util/shuffle.h index 847d07a0..ba85fb5d 100644 --- a/src/util/shuffle.h +++ b/src/util/shuffle.h @@ -51,7 +51,7 @@ u32 shuffleDynamic32(u32 x, u32 mask) { #if defined(HAVE_PEXT) // Intel BMI2 can do this operation in one instruction. return _pext_u32(x, mask); -#endif +#else u32 result = 0, num = 1; while (mask != 0) { @@ -63,6 +63,7 @@ u32 shuffleDynamic32(u32 x, u32 mask) { num <<= 1; } return result; +#endif } static really_inline @@ -70,7 +71,7 @@ u32 shuffleDynamic64(u64a x, u64a mask) { #if defined(HAVE_PEXT) && defined(ARCH_64_BIT) // Intel BMI2 can do this operation in one instruction. return _pext_u64(x, mask); -#endif +#else u32 result = 0, num = 1; while (mask != 0) { @@ -82,6 +83,7 @@ u32 shuffleDynamic64(u64a x, u64a mask) { num <<= 1; } return result; +#endif } #undef HAVE_PEXT