RFR: 8307795: AArch64: Optimize VectorMask.truecount() on Neon
Andrew Haley
aph at openjdk.org
Mon May 15 11:01:44 UTC 2023
On Mon, 15 May 2023 10:04:22 GMT, Chang Peng <duke at openjdk.org> wrote:
> > This looks like it might be removed by loop opts. I think you might need a blackhole somewhere.
>
> `m` will be updated in every iteration of this loop, so `m` is not a loop-invariants actually. I can see the assembly code of this loop by using JMH perfasm.
Isn't it? Looks to me like all it does is flip `m` each time. Whether or not this code is optimized today isn't relevant.
So it's the same as
for (int i = 0; i < LENGTH/2; i++) {
res += m.trueCount();
}
m = m.not();
for (int i = 0; i < LENGTH/2; i++) {
res += m.trueCount();
}
... which is trivially optimizable, no?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13974#discussion_r1193674595
More information about the core-libs-dev
mailing list