JDK-8349128 : C2 SuperWord: generalize PopulateIndex patterns with constant vector
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-01-31
  • Updated: 2025-01-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
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, ....
Comments
I assigned this to myself so I would not loose track of it. But feel free to contact me if you want to work on this!
31-01-2025