aboutsummaryrefslogtreecommitdiffstats
path: root/vppinfra
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-10-11 09:53:12 +0200
committerDave Barach <openvpp@barachs.net>2016-10-11 18:34:02 +0000
commit383740d102769721f2da64c4d6666025b0543836 (patch)
tree24830f990bdfd8939d67c262be6c326426517688 /vppinfra
parentdfa9c5bb9a6e9548267f3456724a5a1a7f342b06 (diff)
vppinfra: use crc32q instruction instead of xxhash in bihash_8_8
xxhash calculation takes 10 clock cycles on Haswell so it makes sense to use crc32q insutrction when available. Change-Id: Iab5e7d9c8ec0125626bbcd067e5dc30574c8febc Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vppinfra')
-rw-r--r--vppinfra/Makefile.am3
-rw-r--r--vppinfra/vppinfra/bihash_8_8.h8
2 files changed, 11 insertions, 0 deletions
diff --git a/vppinfra/Makefile.am b/vppinfra/Makefile.am
index 48a347e009f..d0a023e25d3 100644
--- a/vppinfra/Makefile.am
+++ b/vppinfra/Makefile.am
@@ -224,6 +224,9 @@ nobase_include_HEADERS = \
CLIB_CORE = \
vppinfra/asm_x86.c \
vppinfra/backtrace.c \
+ vppinfra/bihash_8_8.h \
+ vppinfra/bihash_24_8.h \
+ vppinfra/bihash_template.h \
vppinfra/cpu.c \
vppinfra/elf.c \
vppinfra/elog.c \
diff --git a/vppinfra/vppinfra/bihash_8_8.h b/vppinfra/vppinfra/bihash_8_8.h
index 9b5da5a2b89..4087d4dd568 100644
--- a/vppinfra/vppinfra/bihash_8_8.h
+++ b/vppinfra/vppinfra/bihash_8_8.h
@@ -25,6 +25,10 @@
#include <vppinfra/pool.h>
#include <vppinfra/xxhash.h>
+#if __SSE4_2__
+#include <x86intrin.h>
+#endif
+
/** 8 octet key, 8 octet key value pair */
typedef struct
{
@@ -49,7 +53,11 @@ clib_bihash_is_free_8_8 (clib_bihash_kv_8_8_t * v)
static inline u64
clib_bihash_hash_8_8 (clib_bihash_kv_8_8_t * v)
{
+#if __SSE4_2__
+ return _mm_crc32_u64 (v->key, 0);
+#else
return clib_xxhash (v->key);
+#endif
}
/** Format a clib_bihash_kv_8_8_t instance