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

Paul Sandoz psandoz at openjdk.org
Fri Dec 19 22:05:24 UTC 2025


On Fri, 19 Dec 2025 09:50:26 GMT, Eric Fang <erfang at openjdk.org> wrote:

>> test/jdk/jdk/incubator/vector/templates/Kernel-Reduction-Masked-op-func.template line 12:
>> 
>>> 10:                 $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
>>> 11:                 r[i] = av.reduceLanes(VectorOperators.[[TEST]], vmask);
>>> 12:                 ra = [[TEST_OP]](ra, r[i]);
>> 
>> It's probably ok to merge the two cases, but to be conservative assign to a local variable rather than reading from the array e.g.,
>> 
>>   $type$ v = av.reduceLanes(VectorOperators.[[TEST]], vmask);
>>   r[i] = v;
>>   ra = [[TEST_OP]](ra, v);
>
> Hi @PaulSandoz . I've changed to using a temporary variable.
> 
> By the way, are you worried that the `read-after-write` optimization isn't implemented in some architectures?

Or for some reason does not happen. I find it best if for the hot loops we can keep the code as focused as possible.

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

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


More information about the core-libs-dev mailing list