# HG changeset patch # User Josef Eisl # Date 1432835345 -7200 # Node ID b8416bf575088490f42732cf81385bc83d0b51e9 # Parent 05ecef0a6a243f593f52a58e1f90d985a214ab5e Add BC_iadd_const* unittests. diff -r 05ecef0a6a24 -r b8416bf57508 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const0.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const0.java Thu May 28 19:49:05 2015 +0200 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.jtt.bytecode; + +import org.junit.*; + +import com.oracle.graal.api.directives.*; +import com.oracle.graal.jtt.*; + +/* + */ +public class BC_iadd_const0 extends JTTTest { + + public static int test(int a, int b, boolean neg) { + int x = GraalDirectives.opaque(a); + if (!neg) { + return x + b; + } + return x - b; + } + + @Test + public void run0() throws Throwable { + runTest("test", 42, 1, false); + } + + @Test + public void run1() throws Throwable { + runTest("test", 42, -1, false); + } + + @Test + public void run2() throws Throwable { + runTest("test", 42, 1, true); + } + + @Test + public void run3() throws Throwable { + runTest("test", 42, -1, true); + } +} diff -r 05ecef0a6a24 -r b8416bf57508 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const1.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const1.java Thu May 28 19:49:05 2015 +0200 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.jtt.bytecode; + +import org.junit.*; + +import com.oracle.graal.api.directives.*; +import com.oracle.graal.jtt.*; + +/* + */ +public class BC_iadd_const1 extends JTTTest { + + public static int test(byte a, byte b, boolean neg) { + byte x = GraalDirectives.opaque(a); + if (!neg) { + return x + b; + } + return x - b; + } + + @Test + public void run0() throws Throwable { + runTest("test", (byte) 42, (byte) 1, false); + } + + @Test + public void run1() throws Throwable { + runTest("test", (byte) 42, (byte) -1, false); + } + + @Test + public void run2() throws Throwable { + runTest("test", (byte) 42, (byte) 1, true); + } + + @Test + public void run3() throws Throwable { + runTest("test", (byte) 42, (byte) -1, true); + } +} diff -r 05ecef0a6a24 -r b8416bf57508 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const2.java Thu May 28 19:49:05 2015 +0200 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.jtt.bytecode; + +import org.junit.*; + +import com.oracle.graal.api.directives.*; +import com.oracle.graal.jtt.*; + +/* + */ +public class BC_iadd_const2 extends JTTTest { + + public static int test(short a, short b, boolean neg) { + short x = GraalDirectives.opaque(a); + if (!neg) { + return x + b; + } + return x - b; + } + + @Test + public void run0() throws Throwable { + runTest("test", (short) 42, (short) 1, false); + } + + @Test + public void run1() throws Throwable { + runTest("test", (short) 42, (short) -1, false); + } + + @Test + public void run2() throws Throwable { + runTest("test", (short) 42, (short) 1, true); + } + + @Test + public void run3() throws Throwable { + runTest("test", (short) 42, (short) -1, true); + } +} diff -r 05ecef0a6a24 -r b8416bf57508 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const3.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_iadd_const3.java Thu May 28 19:49:05 2015 +0200 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.jtt.bytecode; + +import org.junit.*; + +import com.oracle.graal.api.directives.*; +import com.oracle.graal.jtt.*; + +/* + */ +public class BC_iadd_const3 extends JTTTest { + + public static long test(long a, long b, boolean neg) { + long x = GraalDirectives.opaque(a); + if (!neg) { + return x + b; + } + return x - b; + } + + @Test + public void run0() throws Throwable { + runTest("test", (long) 42, (long) 1, false); + } + + @Test + public void run1() throws Throwable { + runTest("test", (long) 42, (long) -1, false); + } + + @Test + public void run2() throws Throwable { + runTest("test", (long) 42, (long) 1, true); + } + + @Test + public void run3() throws Throwable { + runTest("test", (long) 42, (long) -1, true); + } +}