RFR: 8181633: Vectorization fails for some multiplication with constant cases
Yang Zhang
yang.zhang at linaro.org
Wed Jun 21 02:44:25 UTC 2017
Hi
In OpenJDK 9/10 hotspot c2, for the test case:
=================
public static void mulCInt( int[] a, int[] b, int[] c, int loop) {
for (int i = 0; i < loop; i++) {
int t0 = a[i] * 5;
int t1 = b[i] * 10;
c[i] = t0 + t1;
}
}
=================
This should be vectorized. At first, C2 optimizes such multiplications
to shift and add. Then vectorization is done. But vectorization fails
both on aarch64 and x86 platform.
This bug results from that the rules of matching two similar
independent nodes are not strict enough. So that I add more matching
rules. With this patch, both on x86 and aarch64, SIMD instructions can
be generated for above test case. And there is obvious performance
improvement (~30% in jmh).
Webrev:
http://cr.openjdk.java.net/~njian/8181633/webrev.00/
Bug:
https://bugs.openjdk.java.net/browse/JDK-8181633
Would you please help to review it?
Regards,
Yang
More information about the hotspot-compiler-dev
mailing list