[PATCH] 8217561 : X86: Add floating-point Math.min/max intrinsics, approval request

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Feb 20 17:53:11 UTC 2019

On 2/20/19 9:39 AM, Andrew Haley wrote:
> On 2/19/19 3:16 PM, B. Blaser wrote:
>> So, I did some experiments and it seems that the most important
>> branch is the last one.
>> If data is well balanced like in the initial benchmark I posted,
>> branch prediction is poor and the intrinsic is 2x faster, in all
>> other cases it'd be better to avoid it:
> I tried this an it seems to work.
> This idea looks extremely promising. It's not perfect in that there
> are still datasets that confuse it, but it's surely an improvement
> over what we have today.
> Vladimir, what say you? This is a useful heuristic which avoids
> performance regressions caused by min/max in almost all cases. I say
> we want it.

Yes, this would be nice.

> NB: this heuristic is probably good for CMOV instructions too.

Agree, we had a lot of comments back when we implemented CMOV. There was big discussion what is better - short jump or 
cmove. It all depends on bench prediction as in this case.


More information about the hotspot-compiler-dev mailing list