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

C2 SuperWord: generalize PopulateIndex patterns with constant vector

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 25
    • hotspot

      There are many cases where we would benefit from a constant vector.

      One example we found here:
      https://github.com/openjdk/jdk/pull/22856 / JDK-8346664

              for (int i = 0; i < count; i++) {
                  dst[i] = src[i] * (i & 7);
              }

      Because

          // Does not vectorize: due to sum-under-mask optimization.
          // (i+0) & 7, (i+1) & 7 ... (i+8) & 7 .... -> PopulateIndex
          // becomes
          // (i+0) & 7, (i+1) & 7 ... (i+0) & 7 .... -> pattern broken

      We could just introduce some constants vector, and add this instead of the iota_indices.

      That would allow us to generalize it to any i+c0, i+c1, i+c2, ....

            epeter Emanuel Peter
            epeter Emanuel Peter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: