From 447f5f69c9067663dce5bb33ccf3389c94c89078 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 8 Dec 2016 15:23:40 -0500 Subject: [PATCH] use AVX for DHT --- Identity.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Identity.cpp b/Identity.cpp index f39e9bd8..19c1a240 100644 --- a/Identity.cpp +++ b/Identity.cpp @@ -593,11 +593,25 @@ namespace data XORMetric operator^(const IdentHash& key1, const IdentHash& key2) { XORMetric m; +#if defined(__AVX__) // for AVX + __asm__ + ( + "vmovups %1, %%ymm0 \n" + "vmovups %2, %%ymm1 \n" + "vxorps %%ymm0, %%ymm1, %%ymm1 \n" + "vmovups %%ymm1, %0 \n" + : "=m"(*m.metric) + : "m"(*key1), "m"(*key2) + : "memory", "%xmm0", "%xmm1" // should be replaced by %ymm0/1 once supported by compiler + ); +#else const uint64_t * hash1 = key1.GetLL (), * hash2 = key2.GetLL (); m.metric_ll[0] = hash1[0] ^ hash2[0]; m.metric_ll[1] = hash1[1] ^ hash2[1]; m.metric_ll[2] = hash1[2] ^ hash2[2]; m.metric_ll[3] = hash1[3] ^ hash2[3]; +#endif + return m; } }