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

[vectorapi] Optimize the implementation of lanewise FIRST_NONZERO

    XMLWordPrintable

Details

    • b12

    Description

      Vector API binary op "FIRST_NONZERO" represents the vector operation of "a!=0?a:b", which can be implemented with existing APIs like "compare + blend". The current implementation is more complex especially for the floating point type vectors. The main idea of the implementation is:
      ```
      1) mask = a.compare(0, ne);
      2) b = b.blend(0, mask);
      3) result = a | b;
      ```
      And for the floating point types, it needs the type conversions between the floating point type to the relative integral type, since the final "OR" is only valid for bitwise integral types.

      A simpler implementation is:
      ```
      1) mask = a.compare(0, ne);
      2) result = a.blend(b, mask);
      ```
      This could save the final "OR" and then the type conversions between FP and integral types.

      Attachments

        Issue Links

          Activity

            People

              xgong Xiaohong Gong (Inactive)
              xgong Xiaohong Gong (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: