[SPIRV][Test] xor case added
@@ -43,6 +43,12 @@ public class TestLogic extends TornadoTestBase {
}
public static void logic03(int[] data, int[] output) {
+ for (@Parallel int i = 0; i < data.length; i++) {
+ output[i] = data[i] ^ data[i] - 1;
+ }
+ }
+
+ public static void logic04(int[] data, int[] output) {
for (@Parallel int i = 0; i < data.length; i++) {
int value = data[i];
if ((value & (value - 1)) != 0) {
@@ -106,7 +112,7 @@ public class TestLogic extends TornadoTestBase {
}
}
- @Ignore
+ @Test
public void testLogic03() {
final int N = 1024;
int[] data = new int[N];
@@ -125,6 +131,30 @@ public class TestLogic extends TornadoTestBase {
logic03(data, sequential);
+ for (int i = 0; i < data.length; i++) {
+ assertEquals(sequential[i], output[i]);
+ }
+ }
+
+ @Ignore
+ public void testLogic04() {
+ final int N = 1024;
+ int[] data = new int[N];
+ int[] output = new int[N];
+ int[] sequential = new int[N];
+
+ IntStream.range(0, data.length).sequential().forEach(i -> data[i] = i);
+
+ TaskSchedule s0 = new TaskSchedule("s0");
+
+ // @formatter:off
+ s0.task("t0", TestLogic::logic04, data, output)
+ .streamOut(output);
+ // @formatter:on
+ s0.execute();
+
+ logic04(data, sequential);
+
for (int i = 0; i < data.length; i++) {
assertEquals(sequential[i], output[i]);
}
