Permalink
Browse files

Dropped the intrinsics dependency and replaced popcnt with plain asm …

…code. Also POPCNT_CAPABILITY is not by default On.
  • Loading branch information...
1 parent 1a84874 commit 43483b3ddef03236029cd3baa6923cd91b09cf81 @val-antonescu val-antonescu committed Jan 14, 2014
Showing with 5 additions and 6 deletions.
  1. +2 −2 Makefile
  2. +3 −1 ebwt.h
  3. +0 −3 processor_support.h
View
@@ -67,9 +67,9 @@ else
PTHREAD_LIB = -lpthread
endif
-POPCNT_CAPABILITY ?= 0
+POPCNT_CAPABILITY ?= 1
ifeq (1, $(POPCNT_CAPABILITY))
- EXTRA_FLAGS += -DPOPCNT_CAPABILITY -msse4.2
+ EXTRA_FLAGS += -DPOPCNT_CAPABILITY
ifeq (1,$(MACOS))
INC += -I third_party/macos
endif
View
4 ebwt.h
@@ -1905,7 +1905,9 @@ inline static int pop64(uint64_t x) {
#ifdef POPCNT_CAPABILITY
struct USE_POPCNT_INSTRUCTION {
inline static int pop64(uint64_t x) {
- return _mm_popcnt_u64(x);
+ int64_t count;
+ asm ("popcntq %[x],%[count]\n": [count] "=&r" (count): [x] "r" (x));
+ return count;
}
};
#endif
View
@@ -12,15 +12,12 @@
#if defined(__INTEL_COMPILER)
# define USING_INTEL_COMPILER
-# include <immintrin.h>
#elif defined(__GNUC__)
# define USING_GCC_COMPILER
-# include <smmintrin.h>
# include <cpuid.h>
#elif defined(_MSC_VER)
// __MSC_VER defined by Microsoft compiler
#define USING MSC_COMPILER
-# include <intrin.h>
#endif
struct regs_t {unsigned int EAX, EBX, ECX, EDX;};

0 comments on commit 43483b3

Please sign in to comment.