Intrinsics for Math.min and max
Vladimir Kozlov
vladimir.kozlov at oracle.com
Wed Apr 2 17:46:13 UTC 2014
I created RFE and added this discussion into comments:
https://bugs.openjdk.java.net/browse/JDK-8039104
Regards,
Vladimir
On 4/2/14 7:22 AM, Andrew Haley wrote:
> On 04/02/2014 02:03 PM, Vitaly Davidovich wrote:
>> You mean substantial unrolling occurs with certain probabilities?
>
> It seems to. My experiment was to make the branch totally unpredictable,
> in which case the intrinsic is no better than the user-defined
> Math.max.
>
>> I think that's where the cmov really hurts (for predictable
>> branches) as the cpu will be slowed down by dependency chains.
>>
>> As I mentioned in my other reply, it's hard to build a software
>> model of a branch prediction unit as they're not simple probability
>> counters but look at branch patterns. I think best hotspot can do
>> here is just record highly likely/unlikely code paths, but leave the
>> gray area alone (i.e. prefer jumps).
>
> As far as I can see from x86, there aren't really any cases where the
> intrinsic is useful. In some cases HotSpot generates cmov with user-
> defined Math.max, depending on probability. Simply deleting the
> intrinsic would be no bad thing, judging from these results.
>
> Andrew.
>
More information about the hotspot-compiler-dev
mailing list