Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8274533

[Vector API] Incorrect computation by VectorMask.toLong operation after JDK-8273949

XMLWordPrintable

    • x86
    • generic

      Reproducer:

      ```
      public class VectorMaskToLong {
          static final VectorSpecies<Integer> SPECIES = IntVector.SPECIES_128;
          static long maskFromToLongInt128VectorTest(long inputLong) {
              var vmask = VectorMask.fromLong(SPECIES, inputLong);
              return vmask.toLong();
          }

          static long expected(long inputLong) {
              return inputLong & (((1L << (SPECIES.length() - 1)) << 1) - 1);
          }

          public static void main(String[] args) {
              for (int i = 0; i < 100000; i++) {
                  long res = maskFromToLongInt128VectorTest(-1);
                  long exp = expected(-1);
                  if (res != exp) {
                      System.err.println("Failure: res = " + res + " exp = " + exp);
                      System.exit(-1);
                  }
              }
          }
      }
      ```

            jiefu Jie Fu
            jiefu Jie Fu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: