[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 58/58] cutils: Add generic prefetch
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 58/58] cutils: Add generic prefetch |
Date: |
Tue, 13 Sep 2016 19:16:29 +0200 |
From: Richard Henderson <address@hidden>
There's no real knowledge of the cacheline size,
just prefetching one loop ahead.
Signed-off-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/bufferiszero.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/util/bufferiszero.c b/util/bufferiszero.c
index bafd3d1..abe65f9 100644
--- a/util/bufferiszero.c
+++ b/util/bufferiszero.c
@@ -38,6 +38,8 @@ static bool NAME(const void *buf, size_t len)
\
do { \
const VECTYPE *p = buf; \
VECTYPE t; \
+ __builtin_prefetch(buf + SIZE); \
+ barrier(); \
if (SIZE == sizeof(VECTYPE) * 4) { \
t = (p[0] | p[1]) | (p[2] | p[3]); \
} else if (SIZE == sizeof(VECTYPE) * 8) { \
@@ -219,6 +221,9 @@ bool buffer_is_zero(const void *buf, size_t len)
return true;
}
+ /* Fetch the beginning of the buffer while we select the accelerator. */
+ __builtin_prefetch(buf);
+
/* Use an optimized zero check if possible. Note that this also
includes a check for an unrolled loop over 64-bit integers. */
return select_accel_fn(buf, len);
--
1.8.3.1
- [Qemu-devel] [PULL 44/58] atomics: Remove redundant barrier()'s, (continued)
- [Qemu-devel] [PULL 44/58] atomics: Remove redundant barrier()'s, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 46/58] checkpatch: Fix whitespace checks for documentation code blocks, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 47/58] optionrom: do not rely on compiler's bswap optimization, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 51/58] cutils: Remove SPLAT macro, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 54/58] cutils: Remove aarch64 buffer zero checking, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 49/58] ppc: do not redefine CPUPPCState, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 53/58] cutils: Rearrange buffer_is_zero acceleration, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 50/58] cutils: Move buffer_is_zero and subroutines to a new file, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 52/58] cutils: Export only buffer_is_zero, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 56/58] cutils: Add test for buffer_is_zero, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 58/58] cutils: Add generic prefetch,
Paolo Bonzini <=
- [Qemu-devel] [PULL 55/58] cutils: Remove ppc buffer zero checking, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 57/58] cutils: Add SSE4 version, Paolo Bonzini, 2016/09/13
- Re: [Qemu-devel] [PULL 00/58] First round of misc patches for QEMU 2.8, Peter Maydell, 2016/09/13