RFR: 8271515: Integration of JEP 417: Vector API (Third Incubator) [v3]
Sandhya Viswanathan
sviswanathan at openjdk.java.net
Tue Oct 19 20:45:35 UTC 2021
On Tue, 19 Oct 2021 19:51:54 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java line 603:
>>
>>> 601: if (opKind(op, VO_SPECIAL)) {
>>> 602: if (op == ZOMO) {
>>> 603: return blend(broadcast(-1), compare(NE, 0, m));
>>
>> This doesn't look correct. The lanes where mask is false should get the original lane value in this vector.
>
> That should work, since `compare(NE, 0, m) === compare(NE, 0).and(m)`, so when an `m` lane is unset the lane element of `this` vector will be selected.
>
> Running jshell against a build of PR:
>
> $ ~/Projects/jdk/jdk/build/macosx-x86_64-server-release/images/jdk/bin/jshell --add-modules jdk.incubator.vector
> | Welcome to JShell -- Version 18-internal
> | For an introduction type: /help intro
>
> jshell> import jdk.incubator.vector.*
>
> jshell> var s = IntVector.SPECIES_256;
> s ==> Species[int, 8, S_256_BIT]
>
> jshell> var v = IntVector.fromArray(s, new int[]{0, 1, 0, -2, 0, 3, 0, -4}, 0);
> v ==> [0, 1, 0, -2, 0, 3, 0, -4]
>
> jshell> var z = v.lanewise(VectorOperators.ZOMO);
> z ==> [0, -1, 0, -1, 0, -1, 0, -1]
>
> jshell> z = v.lanewise(VectorOperators.ZOMO, s.loadMask(new boolean[]{false, false, false, false, true, true, true, true}, 0));
> z ==> [0, 1, 0, -2, 0, -1, 0, -1]
>
> jshell>
Yes, you are correct. There is no problem here.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5873
More information about the core-libs-dev
mailing list