RFR: 8318509: x86 count_positives intrinsic broken for -XX:AVX3Threshold=0 [v2]
Emanuel Peter
epeter at openjdk.org
Tue Oct 24 09:00:31 UTC 2023
On Mon, 23 Oct 2023 19:22:52 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> The AVX-512 implementation of count_positives is broken when there are negative values in the tail block, since the len register is repurposed to then re-read as-if it still contained the original value.
>>
>> Proposed fix is to restore len from the value in tmp1, which at this point holds the count of bytes in the tail.
>>
>> Existing TestCountPositives test is pretty exhaustive and just needs to be run explicitly with AVX3Threshold=0 enabled.
>
> Claes Redestad has updated the pull request incrementally with two additional commits since the last revision:
>
> - Remove redundant 0 + tail
> - Randomize array segment sizes and the amount of negatives. Add some tests that limit negatives to a tail.
test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java line 130:
> 128: int expected = countPositives(bytes, off, len);
> 129: if (calculated != expected) {
> 130: if (expected != len && ng >= 0 && calculated >= 0 && calculated < expected) {
Why does this happen? Why does `countPositives` not get the same result here?
(I see that this was here before)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16267#discussion_r1369835647
More information about the hotspot-compiler-dev
mailing list