Mercurial > hg > truffle
diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java @ 15349:7766f486f5d6
evaluate for BinaryOpLogicNodes
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 24 Apr 2014 10:44:12 +0200 |
parents | 882f4cb7cfcf |
children | d5b824a41530 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Thu Apr 24 10:44:12 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Thu Apr 24 10:44:12 2014 +0200 @@ -22,17 +22,20 @@ */ package com.oracle.graal.nodes.calc; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.meta.ProfilingInfo.*; import com.oracle.graal.compiler.common.calc.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.util.*; @NodeInfo(shortName = "==") public final class FloatEqualsNode extends CompareNode { /** * Constructs a new floating point equality comparison node. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ @@ -51,4 +54,18 @@ public boolean unorderedIsTrue() { return false; } + + @Override + public TriState evaluate(ConstantReflectionProvider constantReflection, ValueNode forX, ValueNode forY) { + if (forX.stamp() instanceof FloatStamp && forY.stamp() instanceof FloatStamp) { + FloatStamp xStamp = (FloatStamp) forX.stamp(); + FloatStamp yStamp = (FloatStamp) forY.stamp(); + if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY) && xStamp.isNonNaN() && yStamp.isNonNaN()) { + return TriState.TRUE; + } else if (xStamp.alwaysDistinct(yStamp)) { + return TriState.FALSE; + } + } + return super.evaluate(constantReflection, forX, forY); + } }