[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC][PATCH 4/9] buffer_is_zero: use vector optimizations i
From: |
Peter Lieven |
Subject: |
[Qemu-devel] [RFC][PATCH 4/9] buffer_is_zero: use vector optimizations if possible |
Date: |
Tue, 12 Mar 2013 16:50:31 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 |
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 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/util/cutils.c b/util/cutils.c
index a09d8e8..23f0cd6 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -186,6 +186,11 @@ bool buffer_is_zero(const void *buf, size_t len)
* latency.
*/
+ if (((uintptr_t) buf) % sizeof(VECTYPE) == 0
+ && len % 8*sizeof(VECTYPE) == 0) {
+ return buffer_find_nonzero_offset(buf, len)==len;
+ }
+
size_t i;
long d0, d1, d2, d3;
const long * const data = buf;
--
1.7.9.5
- [Qemu-devel] [RFC][PATCH 4/9] buffer_is_zero: use vector optimizations if possible,
Peter Lieven <=