openj9
openj9 copied to clipboard
WIP: Z: Enable inlining of floating point max/min calls
This draft PR adds the following as recognized methods:
java_lang_Math_max_F
java_lang_Math_min_F
java_lang_Math_max_D
java_lang_Math_min_D
, and adds a SupportsInline flag to the code generator for enabling the inlining of floating point min and max on Z. This flag
is set in Z code generator initialization if the TR_disableInlineMathMax/MathMin environment variable is not set. If the flag is set, Math.max/min call nodes are transformed to a functionally equivalent tree that uses fmax/fmin/dmax/dmin.
Math.max/min call nodes are transformed to a functionally equivalent tree that uses fmax/fmin/dmax/dmin
One oddity about java.lang.Math.{max|min}({double|float}) is in the treatment of negative zero:
Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.
Do the OMR fmax/fmin/dmax/dmin meet that requirement?
Thanks @hzongaro for pointing this out. OMR evaluators would not meet the requirement. @sarwat12 Please reevaluate/update the generated instructions and make sure that it adheres to the Java SPEC