On Thu, 12 May 2022 01:56:25 GMT, Xiaohong Gong <xg...@openjdk.org> wrote:

>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template
>>  line 4086:
>> 
>>> 4084:         } else {
>>> 4085:             $Type$Species vsp = vspecies();
>>> 4086:             if (offset < 0 || offset > (a.length - vsp.length())) {
>> 
>> Can we use `VectorIntrinsics.checkFromIndexSize`? e.g. 
>> 
>> if (!VectorIntrinsics.checkFromIndexSize(offset, vsp.length(), a.length)) { 
>> ...
>
> Thanks for the review @PaulSandoz ! For the 
> `VectorIntrinsics.checkFromIndexSize`, I'm afraid it's not suitable to be 
> used here because the `outOfBounds` exception will be thrown if the offset is 
> not inside of the valid array boundary. And  for the masked operations, this 
> is not needed since we only need to check the masked lanes. Please correct me 
> if I didn't understand correctly. Thanks!

Silly me! i commented too quickly, `checkFromIndexSize` cannot be used. My 
intent was that we could use a method rather than repeating the expression in 
numerous places (including masked loads IIRC).

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

PR: https://git.openjdk.java.net/jdk/pull/8620

Reply via email to