diff mbox series

[ovs-dev,v1,1/1] hash: Enable hash_bytes128 optimization for aarch64.

Message ID 1551260646-36452-1-git-send-email-Yanqin.Wei@arm.com
State Accepted
Commit d74c920219e3df88a9f535d7e3d2df279463a048
Headers show
Series [ovs-dev,v1,1/1] hash: Enable hash_bytes128 optimization for aarch64. | expand

Commit Message

Yanqin Wei Feb. 27, 2019, 9:44 a.m. UTC
"hash_bytes128" has two versions for 64 bits and 32 bits system. This
should be common optimization for their respective platforms. But 64 bits
version was only enabled in x86-64. This patch enable it for aarch64
platform.
Micro benchmarking test was run in two kinds of arm platform. It was
observed that 50% performance improvement in thunderX2 and 40% improvement
in TaiShan(Cortex-A72).

Signed-off-by: Yanqin Wei <Yanqin.Wei@arm.com>
---
 lib/hash.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ben Pfaff Feb. 27, 2019, 6:26 p.m. UTC | #1
On Wed, Feb 27, 2019 at 05:44:06PM +0800, Yanqin Wei wrote:
> "hash_bytes128" has two versions for 64 bits and 32 bits system. This
> should be common optimization for their respective platforms. But 64 bits
> version was only enabled in x86-64. This patch enable it for aarch64
> platform.
> Micro benchmarking test was run in two kinds of arm platform. It was
> observed that 50% performance improvement in thunderX2 and 40% improvement
> in TaiShan(Cortex-A72).
> 
> Signed-off-by: Yanqin Wei <Yanqin.Wei@arm.com>

Thanks, applied to master.

(Maybe we should just enable it for all 64-bit systems with something
like #if UINTPTR_MAX >= UINT64_MAX.)
diff mbox series

Patch

diff --git a/lib/hash.c b/lib/hash.c
index c64f25e..06f8339 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -72,7 +72,7 @@  hash_words64__(const uint64_t p[], size_t n_words, uint32_t basis)
     return hash_words64_inline(p, n_words, basis);
 }
 
-#if !(defined(__x86_64__))
+#if !(defined(__x86_64__)) && !(defined(__aarch64__))
 void
 hash_bytes128(const void *p_, size_t len, uint32_t basis, ovs_u128 *out)
 {
@@ -233,7 +233,7 @@  hash_bytes128(const void *p_, size_t len, uint32_t basis, ovs_u128 *out)
     out->u32[3] = h4;
 }
 
-#else /* __x86_64__ */
+#else /* __x86_64__ or __aarch64__*/
 
 static inline uint64_t
 hash_rot64(uint64_t x, int8_t r)
@@ -361,4 +361,4 @@  hash_bytes128(const void *p_, size_t len, uint32_t basis, ovs_u128 *out)
     out->u64.lo = h1;
     out->u64.hi = h2;
 }
-#endif /* __x86_64__ */
+#endif /* __x86_64__ or __aarch64__*/