[vectorIntrinsics+mask] RFR: 8264563: Add masked vector intrinsics for binary/store operations [v8]
Xiaohong Gong
xgong at openjdk.java.net
Thu Apr 29 04:16:00 UTC 2021
On Wed, 28 Apr 2021 17:14:38 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> Xiaohong Gong has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Separate lanewiseTemplate for masked and non-masked operations
>
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template line 4247:
>
>> 4245: <M extends VectorMask<$Boxtype$>>
>> 4246: void intoArray0Template(Class<M> maskClass, $type$[] a, int offset, M m) {
>> 4247: $Type$Species vsp = vspecies();
>
> Need `m.check(maskClass, this)`?
I think there is no similar issue with masked binary operations if missing this check here. There is implicit null check and type cast check for `m` before it calls `intoArray0`:
void intoArray(byte[] a, int offset,
VectorMask<Byte> m) {
if (m.allTrue()) {
intoArray(a, offset);
} else {
ByteSpecies vsp = vspecies();
checkMaskFromIndexSize(offset, vsp, m, 1, a.length);
intoArray0(a, offset, m);
}
}
The type cast exception will be thrown out inside `checkMaskFromIndexSize(offset, vsp, m, 1, a.length);` if the species are not matched. And we can see there is `m.allTrue()` at the begining of `intoArray`.
Anyway, adding this check is also ok for me. I can add it if adding the check looks better for you.
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/57
More information about the panama-dev
mailing list