[BigEndian Platforms] Vector lane reversal error

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P3
    • None
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • ppc, s390x
    • linux, aix

      On big-endian systems (tested on s390x, and PPC-BE), reinterpretation operations yield incorrect results.

      Test program:

      // compile: javac --add-modules jdk.incubator.vector Reproducer.java
      // run: java --add-modules jdk.incubator.vector Reproducer

      import jdk.incubator.vector.*;

      public class Reproducer {
          public static void main(String[] args) {
              LongVector v1 = LongVector.fromArray(LongVector.SPECIES_128,
                  new long[]{(2L << 32) | 1L, (4L << 32) | 3L}, 0);
              // v1 = {0x0000000200000001, 0x0000000400000003}

              IntVector result = v1.reinterpretAsInts();
              // Expected result: [1, 2, 3, 4]
              // Actual result on big-endian platforms: [2, 1, 4, 3]

              System.out.println(result);
          }
      }


      Source: https://github.com/andreaTP/s390x-vector-bug-reproducer
      OpenJ9 Discussion: https://github.com/eclipse-openj9/openj9/issues/22821

            Assignee:
            Varada M
            Reporter:
            Amit Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: