# HG changeset patch # User Gilles Duboscq # Date 1339587662 -7200 # Node ID 168a00aa1e9ecfb675ff09c6c165ce423ffcd105 # Parent 5ad40c8ba3ed9ef5504865b0b95385f141331fd0 Add static sub & div to IntegerArithmeticNode diff -r 5ad40c8ba3ed -r 168a00aa1e9e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jun 13 13:40:39 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jun 13 13:41:02 2012 +0200 @@ -59,4 +59,30 @@ throw ValueNodeUtil.shouldNotReachHere(); } } + + public static IntegerSubNode sub(ValueNode v1, ValueNode v2) { + assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); + Graph graph = v1.graph(); + switch(v1.kind()) { + case Int: + return graph.unique(new IntegerSubNode(Kind.Int, v1, v2)); + case Long: + return graph.unique(new IntegerSubNode(Kind.Long, v1, v2)); + default: + throw ValueNodeUtil.shouldNotReachHere(); + } + } + + public static IntegerDivNode div(ValueNode v1, ValueNode v2) { + assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); + Graph graph = v1.graph(); + switch(v1.kind()) { + case Int: + return graph.unique(new IntegerDivNode(Kind.Int, v1, v2)); + case Long: + return graph.unique(new IntegerDivNode(Kind.Long, v1, v2)); + default: + throw ValueNodeUtil.shouldNotReachHere(); + } + } }