Mercurial > hg > graal-compiler
changeset 15572:01bce59c2749
test for integer stamp join
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Fri, 09 May 2014 15:52:56 +0200 |
parents | 9a5b5a5b2246 |
children | 5696af217fe2 |
files | graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java |
diffstat | 2 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Fri May 09 14:45:48 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Fri May 09 15:52:56 2014 +0200 @@ -25,6 +25,7 @@ import java.io.*; import com.oracle.graal.phases.common.cfs.FlowSensitiveReductionPhase; + import org.junit.*; import com.oracle.graal.api.code.*; @@ -181,6 +182,19 @@ return ((InputStream) o).available(); } + @Test + public void test7() { + test("test7Snippet", "referenceSnippet7"); + } + + public static int test7Snippet(int x) { + return ((x & 0xff) << 10) == ((x & 0x1f) + 1) ? 0 : x; + } + + public static int referenceSnippet7(int x) { + return x; + } + private void test(String snippet, String referenceSnippet) { StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph");
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java Fri May 09 14:45:48 2014 +0200 +++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java Fri May 09 15:52:56 2014 +0200 @@ -293,4 +293,10 @@ testZeroExtendShort(-1, 1, 0, 0xFFFF); testZeroExtendShort(Short.MIN_VALUE, Short.MAX_VALUE, 0, 0xFFFF); } + + @Test + public void testIllegalJoin() { + assertFalse(new IntegerStamp(32, 0, 0xff00, 0, 0xff00).join(new IntegerStamp(32, 1, 0xff, 0x00, 0xff)).isLegal()); + assertFalse(new IntegerStamp(32, 0x100, 0xff00, 0, 0xff00).join(new IntegerStamp(32, 0, 0xff, 0x00, 0xff)).isLegal()); + } }