On Thu, 22 Oct 2020 18:10:02 GMT, Martin Doerr <mdo...@openjdk.org> wrote:
>> src/hotspot/cpu/ppc/stubGenerator_ppc.cpp line 3820: >> >>> 3818: __ vcmpequb_(eq_special_case_char, input, >>> vec_special_case_char); >>> 3819: // >>> 3820: // There's a (63/64)^16 = 77.7% chance that there are no >>> special >> >> I think that assumes uniformly randomized data, is that a good assumption? >> Is it measurably faster to skip around the xxsel instead of doing it >> unconditionally? > > Thanks for this question. I also stumbled over it when reviewing. I guess a > branch which gets mispredicted in ~22% of the cases leads to a big > performance loss. (In addition, the branch target is not aligned.) Yes, it assumes uniformly random data, but also recall that the unencoded data bytes get shifted by 2, 4, 6 bits into the encoded bytes, which I'm guessing would tend to make the data somewhat more uniform, even if the source data has low entropy. That said, I didn't actually benchmark it. I will do that to make sure there is a gain, and if there isn't I will remove the conditional branch. ------------- PR: https://git.openjdk.java.net/jdk/pull/293