Mercurial > hg > truffle
comparison graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/IntLookupSwitchTest.java @ 14906:f3a5036cc13c
javadoc fixes
javadoc has become stricter in jdk8
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Mon, 31 Mar 2014 20:51:09 +0200 |
parents | f705fc04faa5 |
children | 64dcb92ee75a |
comparison
equal
deleted
inserted
replaced
14905:b7afc71535d3 | 14906:f3a5036cc13c |
---|---|
27 import com.oracle.graal.compiler.hsail.test.infra.*; | 27 import com.oracle.graal.compiler.hsail.test.infra.*; |
28 | 28 |
29 /** | 29 /** |
30 * Tests a switch statement with integer keys. This test exercises the LOOKUPSWITCH Java bytecode | 30 * Tests a switch statement with integer keys. This test exercises the LOOKUPSWITCH Java bytecode |
31 * instruction. | 31 * instruction. |
32 * | 32 * |
33 * The HSAIL code generated for this example is a series of cascading compare and branch | 33 * The HSAIL code generated for this example is a series of cascading compare and branch |
34 * instructions for each case of the switch. | 34 * instructions for each case of the switch. |
35 * | 35 * |
36 * These HSAIL instructions have the following form: | 36 * These HSAIL instructions have the following form: |
37 * | 37 * |
38 * | 38 * |
39 * //Check whether the key matches the key constant of the case. Store the result of the compare (0 | 39 * //Check whether the key matches the key constant of the case. Store the result of the compare (0 |
40 * or 1) in the control register c0. | 40 * or 1) in the control register c0. |
41 * | 41 * |
42 * cmp_eq $c0 <source register>, <key constant for case statement> | 42 * cmp_eq $c0 <source register>, <key constant for case statement> |
43 * | 43 * |
44 * //Branch to the corresponding label of that case if there's a match. | 44 * //Branch to the corresponding label of that case if there's a match. |
45 * | 45 * |
46 * cbr $c0 <branch target for that case> | 46 * cbr $c0 <branch target for that case> |
47 */ | 47 */ |
48 public class IntLookupSwitchTest extends GraalKernelTester { | 48 public class IntLookupSwitchTest extends GraalKernelTester { |
49 | 49 |
50 static final int num = 20; | 50 static final int num = 20; |
51 // Output array storing the results of the operations. | 51 // Output array storing the results of the operations. |
52 @Result protected int[] outArray = new int[num]; | 52 @Result protected int[] outArray = new int[num]; |
53 | 53 |
54 /** | 54 /** |
55 * The static "kernel" method we will be testing. This method writes to an output array based on | 55 * The static "kernel" method we will be testing. This method writes to an output array based on |
56 * switching on an element of an input array. By convention the gid is the last parameter. | 56 * switching on an element of an input array. By convention the gid is the last parameter. |
57 * | 57 * |
58 * Note: Because the key constants used in the cases of the switch are sparsely distributed, the | 58 * Note: Because the key constants used in the cases of the switch are sparsely distributed, the |
59 * Java source compiler compiles this example into the LOOKUPSWITCH bytecode instruction. So | 59 * Java source compiler compiles this example into the LOOKUPSWITCH bytecode instruction. So |
60 * this is really a test to see whether the HSAIL backend is appropriately handling the | 60 * this is really a test to see whether the HSAIL backend is appropriately handling the |
61 * LOOKUPSWITCH bytecode. | 61 * LOOKUPSWITCH bytecode. |
62 * | 62 * |
63 * @param out the output array | 63 * @param out the output array |
64 * @param ina the input array | 64 * @param ina the input array |
65 * @param gid the parameter used to index into the input and output arrays | 65 * @param gid the parameter used to index into the input and output arrays |
66 */ | 66 */ |
67 public static void run(int[] out, int[] ina, int gid) { | 67 public static void run(int[] out, int[] ina, int gid) { |
100 super.testGeneratedHsail(); | 100 super.testGeneratedHsail(); |
101 } | 101 } |
102 | 102 |
103 /** | 103 /** |
104 * Initializes the input and output arrays passed to the run routine. | 104 * Initializes the input and output arrays passed to the run routine. |
105 * | 105 * |
106 * @param in the input array | 106 * @param in the input array |
107 */ | 107 */ |
108 void setupArrays(int[] in) { | 108 void setupArrays(int[] in) { |
109 for (int i = 0; i < num; i++) { | 109 for (int i = 0; i < num; i++) { |
110 in[i] = i < num / 2 ? i : -i; | 110 in[i] = i < num / 2 ? i : -i; |