diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-04-01 15:57:04 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-04-01 15:57:04 -0400 |
commit | 078cb46916b55c254abe1a966a2413410a5f6174 (patch) | |
tree | 5545acf57678da6bfe500c2beb269eae0a62892d | |
parent | 3dba8672ab807915a1cac0f46a7e44793a86521a (diff) | |
download | mongo-078cb46916b55c254abe1a966a2413410a5f6174.tar.gz |
Use the existence of the <x86intrin.h> #include file to configure the
x86 vector instructions. Some old versions of gcc don't have it, but I
believe they're old enough that we don't care.
-rw-r--r-- | build_posix/configure.ac.in | 1 | ||||
-rw-r--r-- | build_win/wiredtiger_config.h | 3 | ||||
-rw-r--r-- | src/include/btree_cmp.i | 18 |
3 files changed, 8 insertions, 14 deletions
diff --git a/build_posix/configure.ac.in b/build_posix/configure.ac.in index 090464066c9..83db9a46aba 100644 --- a/build_posix/configure.ac.in +++ b/build_posix/configure.ac.in @@ -73,6 +73,7 @@ AM_TYPES AC_PROG_INSTALL +AC_CHECK_HEADERS([x86intrin.h]) AC_CHECK_LIB(pthread, pthread_create) AC_CHECK_LIB(dl, dlopen) AC_CHECK_LIB(rt, sched_yield) diff --git a/build_win/wiredtiger_config.h b/build_win/wiredtiger_config.h index dece37576f0..80dc11d7671 100644 --- a/build_win/wiredtiger_config.h +++ b/build_win/wiredtiger_config.h @@ -121,6 +121,9 @@ /* Enable verbose message configuration. */ /* #undef HAVE_VERBOSE */ +/* Define to 1 if you have the <x86intrin.h> header file. */ +#define HAVE_X86INTRIN_H 1 + /* Spinlock type from mutex.h. */ #define SPINLOCK_TYPE SPINLOCK_MSVC diff --git a/src/include/btree_cmp.i b/src/include/btree_cmp.i index dbe58558077..89d84e13556 100644 --- a/src/include/btree_cmp.i +++ b/src/include/btree_cmp.i @@ -6,18 +6,8 @@ * See the file LICENSE for redistribution information. */ -#if defined(_MSC_VER) -#include <intrin.h> -#define HAVE_VECTOR_INSTR -#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) -/* - * Don't include <x86intrin.h>, older versions of gcc don't have it. - */ -#include <emmintrin.h> -#define HAVE_VECTOR_INSTR -#endif - -#ifdef HAVE_VECTOR_INSTR +#ifdef HAVE_X86INTRIN_H +#include <x86intrin.h> /* 16B alignment */ #define WT_ALIGNED_16(p) (((uintptr_t)(p) & 0x0f) == 0) #define WT_VECTOR_SIZE 16 /* chunk size */ @@ -48,7 +38,7 @@ __wt_lex_compare(const WT_ITEM *user_item, const WT_ITEM *tree_item) userp = user_item->data; treep = tree_item->data; -#ifdef HAVE_VECTOR_INSTR +#ifdef HAVE_X86INTRIN_H /* Use vector instructions if we'll execute at least 2 of them. */ if (len >= WT_VECTOR_SIZE * 2) { __m128i res_eq, u, t; @@ -133,7 +123,7 @@ __wt_lex_compare_skip( userp = (uint8_t *)user_item->data + *matchp; treep = (uint8_t *)tree_item->data + *matchp; -#ifdef HAVE_VECTOR_INSTR +#ifdef HAVE_X86INTRIN_H /* Use vector instructions if we'll execute at least 2 of them. */ if (len >= WT_VECTOR_SIZE * 2) { __m128i res_eq, u, t; |