RFR: 8371187: [BigEndian Platforms] Vector lane reversal error

Martin Doerr mdoerr at openjdk.org
Wed Jan 14 10:13:21 UTC 2026


On Thu, 20 Nov 2025 12:05:36 GMT, Varada M <varadam at openjdk.org> wrote:

> This change fixes incorrect lane ordering in reinterpretation operations on big-endian platforms. When converting from wider to narrower lane types like Long to Int, Long to Short, big-endian systems produced reversed sub-lanes.
> The patch adds a maybeSwapOnConverted() and a generic normalizeSubLanesForSpecies() shuffle builder to correct the sub-lane order based on element sizes on big-endian
> 
> JBS: [JDK-8371187](https://bugs.openjdk.org/browse/JDK-8371187)

@psandoz: It would be good to have someone from the VectorAPI folks to review it.

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java line 3627:

> 3625:             VectorShuffle<Double> shuffle = normalizeSubLanesForSpecies(this.vspecies(), subLanesPerSrc);
> 3626:             return this.rearrange(shuffle);
> 3627:         }

I think the code could be refactored such that we don't need copies of the `subLanesPerSrc` computation.

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

PR Comment: https://git.openjdk.org/jdk/pull/28425#issuecomment-3748781569
PR Review Comment: https://git.openjdk.org/jdk/pull/28425#discussion_r2689795229


More information about the core-libs-dev mailing list