# HG changeset patch # User Andreas Woess # Date 1424086557 -3600 # Node ID 3917abffef8207948781de2b8dc4520597e5e675 # Parent c46d8322ef9850f02d154ab4ea183fe409125fc7 Truffle: add more exact math graph builder plugins diff -r c46d8322ef98 -r 3917abffef82 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Mon Feb 16 11:51:42 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Mon Feb 16 12:35:57 2015 +0100 @@ -78,6 +78,36 @@ return true; } }); + r.register2("addExact", Long.TYPE, Long.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode x, ValueNode y) { + builder.push(Kind.Long, builder.append(new IntegerAddExactNode(x, y))); + return true; + } + }); + r.register2("subtractExact", Integer.TYPE, Integer.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode x, ValueNode y) { + builder.push(Kind.Int.getStackKind(), builder.append(new IntegerSubExactNode(x, y))); + return true; + } + }); + r.register2("subtractExact", Long.TYPE, Long.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode x, ValueNode y) { + builder.push(Kind.Long, builder.append(new IntegerSubExactNode(x, y))); + return true; + } + }); + r.register2("multiplyExact", Integer.TYPE, Integer.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode x, ValueNode y) { + builder.push(Kind.Int.getStackKind(), builder.append(new IntegerMulExactNode(x, y))); + return true; + } + }); + r.register2("multiplyExact", Long.TYPE, Long.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode x, ValueNode y) { + builder.push(Kind.Long, builder.append(new IntegerMulExactNode(x, y))); + return true; + } + }); // CompilerDirectives.class r = new Registration(plugins, metaAccess, CompilerDirectives.class);