Mercurial > hg > truffle
comparison graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/ByteBitwiseOrTest.java @ 12582:a5a4a0bcd863
Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
Contributed-by: Vasanth Venkatachalam <Vasanth.Venkatachalam@amd.com>
author | twisti |
---|---|
date | Thu, 24 Oct 2013 19:21:43 -0700 |
parents | |
children | 64dcb92ee75a |
comparison
equal
deleted
inserted
replaced
12581:8fde330c11cd | 12582:a5a4a0bcd863 |
---|---|
1 /* | |
2 * Copyright (c) 2009, 2013, 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.compiler.hsail.test; | |
24 | |
25 import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; | |
26 | |
27 import org.junit.Test; | |
28 | |
29 /** | |
30 * | |
31 * Tests bitwise OR of two bytes. | |
32 */ | |
33 public class ByteBitwiseOrTest extends GraalKernelTester { | |
34 | |
35 static final int num = 20; | |
36 @Result protected int[] outArray1 = new int[num]; | |
37 | |
38 /** | |
39 * The static "kernel" method we will be testing. By convention the gid is the last parameter. | |
40 * | |
41 */ | |
42 public static void run(int[] out1, byte[] ina, byte[] inb, int gid) { | |
43 out1[gid] = (ina[gid] | inb[gid]); | |
44 } | |
45 | |
46 @Test | |
47 public void test() { | |
48 super.testGeneratedHsail(); | |
49 } | |
50 | |
51 void setupArrays(byte[] in, byte[] in2) { | |
52 for (int i = 0; i < num; i++) { | |
53 in[i] = (byte) (i * 2); | |
54 in2[i] = (byte) (i); | |
55 outArray1[i] = 0; | |
56 } | |
57 } | |
58 | |
59 @Override | |
60 public void runTest() { | |
61 byte[] inArray = new byte[num]; | |
62 byte[] inArray2 = new byte[num]; | |
63 setupArrays(inArray, inArray2); | |
64 | |
65 dispatchMethodKernel(num, outArray1, inArray, inArray2); | |
66 } | |
67 | |
68 } |