Re: [PATCH v3 2/6] util/bufferiszero: introduce an inline wrapper

2024-02-08 Thread Richard Henderson
On 2/6/24 21:13, Alexander Monakov wrote: Thank you. I agree we shouldn't penalize non-x86 hosts here, but to be honest I'd really like to keep this optimization because so many places in Qemu invoke buffer_is_zero with a constant length, allowing the compiler to optimize out the length test. H

Re: [PATCH v3 2/6] util/bufferiszero: introduce an inline wrapper

2024-02-06 Thread Alexander Monakov
On Wed, 7 Feb 2024, Richard Henderson wrote: > On 2/7/24 06:48, Alexander Monakov wrote: > > Make buffer_is_zero a 'static inline' function that tests up to three > > bytes from the buffer before handing off to an unrolled loop. This > > eliminates call overhead for most non-zero buffers, and al

Re: [PATCH v3 2/6] util/bufferiszero: introduce an inline wrapper

2024-02-06 Thread Richard Henderson
On 2/7/24 06:48, Alexander Monakov wrote: Make buffer_is_zero a 'static inline' function that tests up to three bytes from the buffer before handing off to an unrolled loop. This eliminates call overhead for most non-zero buffers, and allows to optimize out length checks when it is known at compi

[PATCH v3 2/6] util/bufferiszero: introduce an inline wrapper

2024-02-06 Thread Alexander Monakov
Make buffer_is_zero a 'static inline' function that tests up to three bytes from the buffer before handing off to an unrolled loop. This eliminates call overhead for most non-zero buffers, and allows to optimize out length checks when it is known at compile time (which is often the case in Qemu).