mirror of https://github.com/xemu-project/xemu.git
buffer_is_zero: use vector optimizations if possible
performance gain on SSE2 is approx. 20-25%. altivec is not tested. performance for unsigned long arithmetic is unchanged. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
41a259bd2b
commit
56ded708ec
|
@ -215,6 +215,11 @@ bool buffer_is_zero(const void *buf, size_t len)
|
||||||
long d0, d1, d2, d3;
|
long d0, d1, d2, d3;
|
||||||
const long * const data = buf;
|
const long * const data = buf;
|
||||||
|
|
||||||
|
/* use vector optimized zero check if possible */
|
||||||
|
if (can_use_buffer_find_nonzero_offset(buf, len)) {
|
||||||
|
return buffer_find_nonzero_offset(buf, len) == len;
|
||||||
|
}
|
||||||
|
|
||||||
assert(len % (4 * sizeof(long)) == 0);
|
assert(len % (4 * sizeof(long)) == 0);
|
||||||
len /= sizeof(long);
|
len /= sizeof(long);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue