RFR(M): 8212043: Add floating-point Math.min/max intrinsics
Pengfei Li (Arm Technology China)
Pengfei.Li at arm.com
Fri Oct 19 02:27:12 UTC 2018
I would like to enable intrinsics of floating-point Math.min/max methods on AArch64. Could anyone help review this change?
Below is the description of Math.max(double,double) in Java API doc. Behaviors of the other 3 methods are similar.
"Returns the greater of two double values. That is, the result is the argument closer to positive infinity. If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other negative zero, the result is positive zero." 
In AArch64 floating-point instruction set, the fmax instruction has exactly the same behavior to the API description above. So these min/max calculations can be done in one single instruction.
I also added a jtreg case in this change to test these special arguments, including +0.0, -0.0, +inf, -inf and NaN. I ran the full jtreg test and no new issues were found.
As I'm not familiar with other ISAs, intrinsics are enabled only on AArch64 in this change. I hope someone else can enable them on other platforms, if possible.
More information about the hotspot-compiler-dev