RFR: 8181633: Vectorization fails for some multiplication with constant cases
Vladimir Kozlov
vladimir.kozlov at oracle.com
Wed Jun 21 04:06:50 UTC 2017
Thank you, Yang
On 6/20/17 7:44 PM, Yang Zhang wrote:
> 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.
Do I understand correctly that the problem is we pack not similar nodes into the same set? Which cause later non-profitable result for such sets.
I am trying understand why additional restriction helps.
Did you try constants with 1 bit set (which converted to simple shift) or 3 bits set (which keep multipmultiplication)?
>
> 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).
What other performance tests you ran?
Thanks,
Vladimir
>
> 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