On Tue, 20 Jan 2026 18:20:41 GMT, Martin Doerr <[email protected]> wrote:
>> Varada M has refreshed the contents of this pull request, and previous
>> commits have been removed. The incremental views will show differences
>> compared to the previous content of the PR. The pull request contains two
>> new commits since the last revision:
>>
>> - 8371187: [BigEndian Platforms] Vector lane reversal error
>> - fix for vector alignment issue on big-endian
>
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java
> line 185:
>
>> 183: // NOTE: This assumes that convert0('X')
>> 184: // respects REGISTER_ENDIAN order.
>> 185: return convert0('X',
>> vspecies().withLanes(laneType)).maybeSwapOnConverted(java.nio.ByteOrder.nativeOrder(),
>> vspecies());
>
> Would `swapIfNeeded` be a better name?
> I think we could determine the ByteOrder where it is used. Then, we don't
> have to pass it any more.
I agree, looks more clean. I have renamed and made the suggested changes
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java
> line 217:
>
>> 215: int sBytes = srcSpecies.elementSize();
>> 216: int tBytes = vspecies().elementSize();
>> 217: if (sBytes == tBytes || (sBytes % tBytes) != 0) {
>
> What do we do if it's not divisible? Should we better throw an exception?
I have tried adding the exception but many tests failed!
what I understood is asVectorRawTemplate is called in many cases which
eventually calls swapIfNeeded and exception is thrown for the widening cases.
When we reinterpret smaller elements into larger ones we don't need to swap
elements so we could opt out.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28425#discussion_r2715485291
PR Review Comment: https://git.openjdk.org/jdk/pull/28425#discussion_r2715486090