RFR: 8372978: [VectorAPI] Fix incorrect identity values in UMIN/UMAX reductions

Quan Anh Mai qamai at openjdk.org
Mon Dec 8 05:46:56 UTC 2025


On Mon, 8 Dec 2025 05:37:54 GMT, Eric Fang <erfang at openjdk.org> wrote:

>> test/jdk/jdk/incubator/vector/Byte128VectorTests.java line 4191:
>> 
>>> 4189:     }
>>> 4190: 
>>> 4191:     static byte UMINReduce(byte[] a, int idx) {
>> 
>> We should test the reduction operations in a better manner by using `a[idx]` as the starting value instead.
>
> Hi @merykitty thanks for the review, `a[idx]` is already the starting value for the reduction operation of this function, see line 4193. What do you mean by `a better manner` ?

No, the starting value is `-1`, this test depends on the fact that we choose the correct identity value for this particular operation as the starting value, which this issue is about. As a result, it would be better to write the test so that we do not depend on the identity value.

        byte res = a[idx];
        for (int i = idx + 1; i < (idx + SPECIES.length()); i++) {
            res = (byte) VectorMath.minUnsigned(res, a[i]);
        }

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28692#discussion_r2597119232


More information about the core-libs-dev mailing list