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

[vectorapi] FIRST_NONZERO reduction operation throws IllegalArgumentExcept on zero vectors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • None
    • core-libs
    • b10
    • Verified

      FIRST_NONZERO reduction operation is implemented as

          this.lane(thisNZ.firstTrue());

      VectorMask.firstTrue() returns vector length on all false masks, this leads to Vector.lane(int) throws IllegalArgumentException. The implementation should returns 0 in this occasion instead since FIRST_NONZERO is described as a != 0 ? a : b, which will be 0 if both a and b are 0.

      In addition FIRST_NONZERO reduction with a mask throws UnsupportedOperationException, since the there is no support to obtain the reduce identity vector.

            psandoz Paul Sandoz
            qamai Quan Anh Mai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: