RFR(S) 8192846: Extend cmov vectorization to work for float

Lupusoru, Razvan A razvan.a.lupusoru at intel.com
Thu Nov 30 21:48:25 UTC 2017

Hi all,

This submission is to the issue noted in JDK-8192846  - namely that vectorized cmov for floats is not supported.

This patch rectifies the situation so that when scalar Cmov for float and double is generated (or forced generated by passing -XX:+UseCMoveUnconditionally), it stands a chance for Vectorization using existing functionality previously enabled for doubles. The following code pattern will get vectorized with patch above:
private void cmove_kernel_float(float[] in1, float[] in2, int length, float[] out) {
  for (int i = 0; i < length; i++) {
    out[i] = (in1[i] > in2[i]) ? in1[i] : in2[i];

Instructions generated for loop are:
  vmovdqu 0x10(%rcx,%r10,4),%ymm0
  vmovdqu 0x10(%rdx,%r10,4),%ymm1
  vcmpleps %ymm0,%ymm1,%ymm2
  vblendvps %ymm2,%ymm0,%ymm1,%ymm2
  vmovdqu %ymm2,0x10(%r9,%r10,4)

The patch is available for review here:

Jtreg testing with compiler tests has successfully passed. Thanks for review!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20171130/7842cbba/attachment.html>

More information about the hotspot-compiler-dev mailing list