22002
|
1 /*
|
|
2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
|
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 *
|
|
5 * This code is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License version 2 only, as
|
|
7 * published by the Free Software Foundation.
|
|
8 *
|
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
|
13 * accompanied this code).
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License version
|
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 *
|
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 * or visit www.oracle.com if you need additional information or have any
|
|
21 * questions.
|
|
22 */
|
|
23 package com.oracle.graal.lir.jtt;
|
|
24
|
22054
|
25 import jdk.internal.jvmci.meta.*;
|
|
26
|
22002
|
27 import org.junit.*;
|
|
28
|
|
29 import com.oracle.graal.lir.gen.*;
|
|
30
|
|
31 public class LIRTestTest extends LIRTest {
|
|
32 private static final LIRTestSpecification stackCopy = new LIRTestSpecification() {
|
|
33 @Override
|
|
34 public void generate(LIRGeneratorTool gen, Value a, Value b) {
|
|
35 setOutput("a", a);
|
|
36 setOutput("b", b);
|
|
37 setResult(a);
|
|
38 }
|
|
39 };
|
|
40
|
|
41 @SuppressWarnings("unused")
|
|
42 @LIRIntrinsic
|
|
43 public static int copyInt(LIRTestSpecification spec, int a, int b) {
|
|
44 return a;
|
|
45 }
|
|
46
|
|
47 public static int[] testGetOutput(int a, int b, int[] out) {
|
|
48 out[0] = copyInt(stackCopy, a, b);
|
|
49 out[1] = getOutput(stackCopy, "a", a);
|
|
50 out[2] = getOutput(stackCopy, "b", b);
|
|
51 return out;
|
|
52 }
|
|
53
|
|
54 @Test
|
|
55 public void runInt() throws Throwable {
|
|
56 runTest("testGetOutput", Integer.MIN_VALUE, 0, supply(() -> new int[3]));
|
|
57 runTest("testGetOutput", -1, Integer.MAX_VALUE, supply(() -> new int[3]));
|
|
58 runTest("testGetOutput", 0, 42, supply(() -> new int[3]));
|
|
59 runTest("testGetOutput", 1, -0xFFAA44, supply(() -> new int[3]));
|
|
60 runTest("testGetOutput", Integer.MAX_VALUE, -42, supply(() -> new int[3]));
|
|
61 }
|
|
62 }
|