Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/BooleanBitwiseOrTestTT.java @ 18408:2c3666f44855
Truffle: initial commit of object API implementation
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Tue, 18 Nov 2014 23:19:43 +0100 |
parents | 64dcb92ee75a |
children |
rev | line source |
---|---|
12582
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
1 /* |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
4 * |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
8 * |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
13 * accompanied this code). |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
14 * |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
18 * |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
21 * questions. |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
22 */ |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
23 package com.oracle.graal.compiler.hsail.test; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
24 |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12582
diff
changeset
|
25 import org.junit.*; |
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12582
diff
changeset
|
26 |
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12582
diff
changeset
|
27 import com.oracle.graal.compiler.hsail.test.infra.*; |
12582
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
28 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
29 /** |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
30 * |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
31 * Tests bitwise OR of two booleans. Both inputs are true. |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
32 */ |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
33 public class BooleanBitwiseOrTestTT extends GraalKernelTester { |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
34 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
35 static final int num = 20; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
36 @Result protected boolean[] outArray = new boolean[num]; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
37 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
38 /** |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
39 * The static "kernel" method we will be testing. By convention the gid is the last parameter. |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
40 * |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
41 */ |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
42 public static void run(boolean[] out, boolean[] ina, boolean[] inb, int gid) { |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
43 out[gid] = (ina[gid] | inb[gid]); |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
44 } |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
45 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
46 @Test |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
47 public void test() { |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
48 super.testGeneratedHsail(); |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
49 } |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
50 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
51 void setupArrays(boolean[] in, boolean[] in2) { |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
52 for (int i = 0; i < num; i++) { |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
53 in[i] = true; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
54 in2[i] = true; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
55 outArray[i] = false; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
56 } |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
57 } |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
58 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
59 @Override |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
60 public void runTest() { |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
61 boolean[] inArray = new boolean[num]; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
62 boolean[] inArray2 = new boolean[num]; |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
63 setupArrays(inArray, inArray2); |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
64 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
65 dispatchMethodKernel(num, outArray, inArray, inArray2); |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
66 } |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
67 |
a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents:
diff
changeset
|
68 } |