Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/Vec3ObjStreamTest.java @ 18148:aed00dc20923
Pass FrameMap to Backend.newCompilationResultBuilder().
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 21 Oct 2014 15:29:41 +0200 |
parents | d3fc35a43376 |
children |
rev | line source |
---|---|
13105
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 package com.oracle.graal.compiler.hsail.test; |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import org.junit.*; |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import com.oracle.graal.compiler.hsail.test.infra.*; |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 /** |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 * Tests codegen for a java 7 style object array stream kernel, no captures. |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 */ |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 public class Vec3ObjStreamTest extends GraalKernelTester { |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 static final int NUM = 20; |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 @Result public Vec3[] inArray = new Vec3[NUM]; |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 void setupArrays() { |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 for (int i = 0; i < NUM; i++) { |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 inArray[i] = new Vec3(i, i + 1, -1); |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 } |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 } |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 /** |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 * The "kernel" method we will be testing. For Array Stream, an object from the array will be |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 * the last parameter |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 */ |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 public void run(Vec3 vec3) { |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 vec3.z = vec3.x + vec3.y; |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 } |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 @Override |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 public void runTest() { |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 setupArrays(); |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 dispatchMethodKernel(inArray); |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 } |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 @Test |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 public void test() { |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 testGeneratedHsail(); |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 } |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 |
d3fc35a43376
HSAIL: addressed issues in JUnit tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 } |