RFR: 8372978: [VectorAPI] Fix incorrect identity values in UMIN/UMAX reductions
Eric Fang
erfang at openjdk.org
Mon Dec 8 05:58:57 UTC 2025
On Mon, 8 Dec 2025 05:43:38 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> 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]);
> }
Okay, I got your point. I think this might be to maintain consistency with `UMINReduceMasked`; for the masked version, if no element is selected, it returns the identity value. I'm okay with both approaches, maybe let’s hear what @PaulSandoz thinks.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28692#discussion_r2597141410
More information about the core-libs-dev
mailing list