C2 SuperWord: generalize PopulateIndex patterns with constant vector

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 25
    • Component/s: 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, ....

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

              Created:
              Updated: