RFR: 8338023: Support two vector selectFrom API [v13]
Paul Sandoz
psandoz at openjdk.org
Mon Sep 30 21:30:42 UTC 2024
On Sat, 28 Sep 2024 17:37:10 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:
>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Handling NPOT vector length for AArch64 SVE with vector sizes varying b/w 128 and 2048 bits at 128 bit increments.
>
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java line 551:
>
>> 549: return ((ByteVector)src1).vectorFactory(res);
>> 550: }
>> 551:
>
> This could instead be:
> src1.rearrange(this.lanewise(VectorOperators.AND, 2 * VLENGTH - 1).toShuffle(), src2);
> Or even simplified to:
> src1.rearrange(this.toShuffle(), src2);
I think you have to do the masking before conversion - `vec.lanewise(VectorOperators.AND, 2 * VLENGTH - 1).toShuffle()` is not the same as `vec.toShuffle()` for all inputs.
jshell> IntVector indexes = IntVector.fromArray(IntVector.SPECIES_256, new int[] {0, 1, 8, 9, 16, 17, 24, 25}, 0);
indexes ==> [0, 1, 8, 9, 16, 17, 24, 25]
jshell> indexes.lanewise(VectorOperators.AND, indexes.length() * 2 - 1)
$19 ==> [0, 1, 8, 9, 0, 1, 8, 9]
jshell> indexes.lanewise(VectorOperators.AND, indexes.length() * 2 - 1).toShuffle()
$20 ==> Shuffle[0, 1, -8, -7, 0, 1, -8, -7]
jshell> indexes.toShuffle()
$21 ==> Shuffle[0, 1, -8, -7, -8, -7, -8, -7]
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20508#discussion_r1781753872
More information about the core-libs-dev
mailing list