Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/IntLongConvertTest.java @ 10730:f1904749e4fe
re-enabled new lowering of checkcast with addition of a null-check guard where the profile has nullSeen=FALSE
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 12 Jul 2013 22:52:05 +0200 |
parents | 4ef92b67aeae |
children | a5a4a0bcd863 |
rev | line source |
---|---|
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
4ef92b67aeae
added HSAIL backend and 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 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4ef92b67aeae
added HSAIL backend and 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 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 package com.oracle.graal.compiler.hsail.test; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import java.util.*; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import org.junit.*; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 /** |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 * Tests integer to long conversion. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 */ |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 public class IntLongConvertTest extends GraalKernelTester { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 static final int size = 128; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 static final int[] inputInt = new int[size]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 static final long[] inputLong = new long[size]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 @Result static final int[] outputInt = new int[size]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 @Result static final long[] outputLong = new long[size]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 static int[] seedInt = new int[size]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 for (int i = 0; i < seedInt.length; i++) { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 seedInt[i] = (int) Math.random(); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 static long[] seedLong = new long[size]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 for (int i = 0; i < seedLong.length; i++) { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 seedLong[i] = (long) Math.random(); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 public static void run(int[] inInt, long[] inLong, int[] outInt, long[] outLong, int gid) { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 outInt[gid] = (int) inLong[gid]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 outLong[gid] = inInt[gid]; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 @Override |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 public void runTest() { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 System.arraycopy(seedLong, 0, inputLong, 0, seedLong.length); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 Arrays.fill(outputLong, 0); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 System.arraycopy(seedInt, 0, inputInt, 0, seedInt.length); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 Arrays.fill(outputInt, 0); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 dispatchMethodKernel(64, inputInt, inputLong, outputInt, outputLong); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 @Test |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 public void test() { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 testGeneratedHsail(); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 } |