On Fri, 19 Dec 2025 09:50:26 GMT, Eric Fang <[email protected]> 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

Reply via email to