diff --git a/compiler/optimizer/OMRSimplifierHandlers.cpp b/compiler/optimizer/OMRSimplifierHandlers.cpp index b53b85afa01..4518f171ffa 100644 --- a/compiler/optimizer/OMRSimplifierHandlers.cpp +++ b/compiler/optimizer/OMRSimplifierHandlers.cpp @@ -17762,10 +17762,24 @@ TR::Node *fmaxminSimplifier(TR::Node * node, TR::Block * block, TR::Simplifier * fmin = fmax = secondChild->getFloat(); else { - if (firstChild->getFloat() <= secondChild->getFloat()) + float first = firstChild->getFloat(); + float second = secondChild->getFloat(); + int nZeroBits = 0x80000000; + if (first <= second) { - fmin = firstChild->getFloat(); - fmax = secondChild->getFloat(); + if (first == second && first == 0) + { + int firstBits = *(int *)(&first); + int secondBits = *(int *)(&second); + int sign = firstBits & nZeroBits; + fmin = sign < 0 ? first : second; + fmax = sign < 0 ? second : first; + } + else + { + fmin = firstChild->getFloat(); + fmax = secondChild->getFloat(); + } } else { @@ -17797,10 +17811,24 @@ TR::Node *dmaxminSimplifier(TR::Node * node, TR::Block * block, TR::Simplifier * min = max = secondChild->getDouble(); else { - if (firstChild->getDouble() <= secondChild->getDouble()) + double first = firstChild->getDouble(); + double second = secondChild->getDouble(); + long nZeroBits = 0x8000000000000000L; + if (first <= second) { - min = firstChild->getDouble(); - max = secondChild->getDouble(); + if (first == second && first == 0) + { + long firstBits = *(long *)(&first); + long secondBits = *(long *)(&second); + long sign = firstBits & nZeroBits; + min = sign < 0 ? first : second; + max = sign < 0 ? second : first; + } + else + { + min = firstChild->getDouble(); + max = secondChild->getDouble(); + } } else {