auto-vectorize varbit bitwise operators
After adding -ftree-vectorize and moving the loop boundary computations to
outside the loops, popular compilers will auto-vectorize bit_and(),
bit_or(), bitxor(), and bitnot(). My testing indicates this produces some
nice speedups, but I haven't yet done anything scientific enough to share.
--
nathan
On 02/09/2026 21:57, Nathan Bossart wrote:
After adding -ftree-vectorize and moving the loop boundary computations to
outside the loops, popular compilers will auto-vectorize bit_and(),
bit_or(), bitxor(), and bitnot(). My testing indicates this produces some
nice speedups, but I haven't yet done anything scientific enough to share.
Dunno if these are particularly worth optimizing, but regardless of
performance, I think the loop code looks better with these changes anyway.
- Heikki
On Sep 3, 2026, at 02:57, Nathan Bossart <nathandbossart@gmail.com> wrote:
After adding -ftree-vectorize and moving the loop boundary computations to
outside the loops, popular compilers will auto-vectorize bit_and(),
bit_or(), bitxor(), and bitnot(). My testing indicates this produces some
nice speedups, but I haven't yet done anything scientific enough to share.--
nathan
<v1-0001-Auto-vectorize-the-varbit-bitwise-operators.patch>
I think this should improve performance on CPUs with SIMD support. It also improves code readability.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/