Mercurial > hg > truffle
changeset 19393:3917abffef82
Truffle: add more exact math graph builder plugins
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Mon, 16 Feb 2015 12:35:57 +0100 |
parents | c46d8322ef98 |
children | 47fcd91a38c5 07f2edacfd3f |
files | graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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);