-
Enhancement
-
Resolution: Unresolved
-
P4
-
25
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, ....
One example we found here:
https://github.com/openjdk/jdk/pull/22856 /
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, ....
- relates to
-
JDK-8346664 C2: Optimize mask check with constant offset
-
- Resolved
-