[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCHv2 3/9] buffer_is_zero: use vector optimizations if p
From: |
Peter Lieven |
Subject: |
[Qemu-devel] [PATCHv2 3/9] buffer_is_zero: use vector optimizations if possible |
Date: |
Fri, 15 Mar 2013 16:50:12 +0100 |
performance gain on SSE2 is approx. 20-25%. altivec
is not tested. performance for unsigned long arithmetic
is unchanged.
Signed-off-by: Peter Lieven <address@hidden>
---
util/cutils.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/cutils.c b/util/cutils.c
index 857dd7d..00d98fb 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -190,6 +190,13 @@ size_t buffer_find_nonzero_offset(const void *buf, size_t
len)
*/
bool buffer_is_zero(const void *buf, size_t len)
{
+ /* use vector optimized zero check if possible */
+ if (((uintptr_t) buf) % sizeof(VECTYPE) == 0
+ && len % (BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR
+ * sizeof(VECTYPE)) == 0) {
+ return buffer_find_nonzero_offset(buf, len)==len;
+ }
+
/*
* Use long as the biggest available internal data type that fits into the
* CPU register and unroll the loop to smooth out the effect of memory
--
1.7.9.5
[Qemu-devel] [PATCHv2 7/9] migration: do not sent zero pages in bulk stage, Peter Lieven, 2013/03/15