Search in sources :

Example 1 with Neg

use of org.graalvm.compiler.core.common.type.ArithmeticOpTable.UnaryOp.Neg in project graal by oracle.

the class NegateNode method findSynonym.

protected static ValueNode findSynonym(ValueNode forValue, NodeView view) {
    ArithmeticOpTable.UnaryOp<Neg> negOp = ArithmeticOpTable.forStamp(forValue.stamp(view)).getNeg();
    ValueNode synonym = UnaryArithmeticNode.findSynonym(forValue, negOp);
    if (synonym != null) {
        return synonym;
    }
    if (forValue instanceof NegateNode) {
        return ((NegateNode) forValue).getValue();
    }
    if (forValue instanceof SubNode && !(forValue.stamp(view) instanceof FloatStamp)) {
        SubNode sub = (SubNode) forValue;
        return SubNode.create(sub.getY(), sub.getX(), view);
    }
    return null;
}
Also used : ArithmeticOpTable(org.graalvm.compiler.core.common.type.ArithmeticOpTable) Neg(org.graalvm.compiler.core.common.type.ArithmeticOpTable.UnaryOp.Neg) ValueNode(org.graalvm.compiler.nodes.ValueNode) FloatStamp(org.graalvm.compiler.core.common.type.FloatStamp)

Aggregations

ArithmeticOpTable (org.graalvm.compiler.core.common.type.ArithmeticOpTable)1 Neg (org.graalvm.compiler.core.common.type.ArithmeticOpTable.UnaryOp.Neg)1 FloatStamp (org.graalvm.compiler.core.common.type.FloatStamp)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1