< prev index next >

test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template

Print this page

 1 
 2     @Test(dataProvider = "$type$CompareOpProvider")
 3     static void [[TEST]]$vectorteststype$BroadcastSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb) {
 4         $type$[] a = fa.apply(SPECIES.length());
 5         $type$[] b = fb.apply(SPECIES.length());
 6 
 7         for (int i = 0; i < a.length; i += SPECIES.length()) {
 8             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
 9             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], b[i]);
10 
11             // Check results as part of computation.
12             for (int j = 0; j < SPECIES.length(); j++) {
13                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] b[i]);
14             }
15         }
16     }
17 
18 
19     @Test(dataProvider = "$type$CompareOpMaskProvider")
20     static void [[TEST]]$vectorteststype$BroadcastMaskedSmokeTest(IntFunction<$type$[]> fa,
21                                 IntFunction<$type$[]> fb, IntFunction<boolean[]> fm) {
22         $type$[] a = fa.apply(SPECIES.length());
23         $type$[] b = fb.apply(SPECIES.length());
24         boolean[] mask = fm.apply(SPECIES.length());
25 
26         VectorMask<$Wideboxtype$> vmask = VectorMask.fromArray(SPECIES, mask, 0);
27 
28         for (int i = 0; i < a.length; i += SPECIES.length()) {
29             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
30             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], b[i], vmask);
31 
32             // Check results as part of computation.
33             for (int j = 0; j < SPECIES.length(); j++) {
34                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] b[i]));
35             }
36         }
37     }
38 
39 #if[!Long]
40     @Test(dataProvider = "$type$CompareOpProvider")
41     static void [[TEST]]$vectorteststype$BroadcastLongSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb) {
42         $type$[] a = fa.apply(SPECIES.length());
43         $type$[] b = fb.apply(SPECIES.length());
44 
45         for (int i = 0; i < a.length; i += SPECIES.length()) {
46             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
47             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], (long)b[i]);
48 
49             // Check results as part of computation.
50             for (int j = 0; j < SPECIES.length(); j++) {
51                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] ($type$)((long)b[i]));
52             }
53         }
54     }
55 
56 
57     @Test(dataProvider = "$type$CompareOpMaskProvider")
58     static void [[TEST]]$vectorteststype$BroadcastLongMaskedSmokeTest(IntFunction<$type$[]> fa,
59                                 IntFunction<$type$[]> fb, IntFunction<boolean[]> fm) {
60         $type$[] a = fa.apply(SPECIES.length());
61         $type$[] b = fb.apply(SPECIES.length());
62         boolean[] mask = fm.apply(SPECIES.length());
63 
64         VectorMask<$Wideboxtype$> vmask = VectorMask.fromArray(SPECIES, mask, 0);
65 
66         for (int i = 0; i < a.length; i += SPECIES.length()) {
67             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
68             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], (long)b[i], vmask);
69 
70             // Check results as part of computation.
71             for (int j = 0; j < SPECIES.length(); j++) {
72                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] ($type$)((long)b[i])));
73             }
74         }
75     }
76 #end[!Long]

 1 
 2     @Test(dataProvider = "$type$CompareOpProvider")
 3     static void [[TEST]]$vectorteststype$BroadcastSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb) {
 4         $type$[] a = fa.apply(SPECIES.length());
 5         $type$[] b = fb.apply(SPECIES.length());
 6 
 7         for (int i = 0; i < a.length; i += SPECIES.length()) {
 8             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
 9             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], b[i]);
10 
11             // Check results as part of computation.
12             for (int j = 0; j < SPECIES.length(); j++) {
13                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] b[i]);
14             }
15         }
16     }
17 

18     @Test(dataProvider = "$type$CompareOpMaskProvider")
19     static void [[TEST]]$vectorteststype$BroadcastMaskedSmokeTest(IntFunction<$type$[]> fa,
20                                 IntFunction<$type$[]> fb, IntFunction<boolean[]> fm) {
21         $type$[] a = fa.apply(SPECIES.length());
22         $type$[] b = fb.apply(SPECIES.length());
23         boolean[] mask = fm.apply(SPECIES.length());
24 
25         VectorMask<$Wideboxtype$> vmask = VectorMask.fromArray(SPECIES, mask, 0);
26 
27         for (int i = 0; i < a.length; i += SPECIES.length()) {
28             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
29             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], b[i], vmask);
30 
31             // Check results as part of computation.
32             for (int j = 0; j < SPECIES.length(); j++) {
33                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] b[i]));
34             }
35         }
36     }
37 
38 #if[!Long]
39     @Test(dataProvider = "$type$CompareOpProvider")
40     static void [[TEST]]$vectorteststype$BroadcastLongSmokeTest(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb) {
41         $type$[] a = fa.apply(SPECIES.length());
42         $type$[] b = fb.apply(SPECIES.length());
43 
44         for (int i = 0; i < a.length; i += SPECIES.length()) {
45             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
46             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], (long)b[i]);
47 
48             // Check results as part of computation.
49             for (int j = 0; j < SPECIES.length(); j++) {
50                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] ($type$)((long)b[i]));
51             }
52         }
53     }
54 

55     @Test(dataProvider = "$type$CompareOpMaskProvider")
56     static void [[TEST]]$vectorteststype$BroadcastLongMaskedSmokeTest(IntFunction<$type$[]> fa,
57                                 IntFunction<$type$[]> fb, IntFunction<boolean[]> fm) {
58         $type$[] a = fa.apply(SPECIES.length());
59         $type$[] b = fb.apply(SPECIES.length());
60         boolean[] mask = fm.apply(SPECIES.length());
61 
62         VectorMask<$Wideboxtype$> vmask = VectorMask.fromArray(SPECIES, mask, 0);
63 
64         for (int i = 0; i < a.length; i += SPECIES.length()) {
65             $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i);
66             VectorMask<$Wideboxtype$> mv = av.compare(VectorOperators.[[TEST]], (long)b[i], vmask);
67 
68             // Check results as part of computation.
69             for (int j = 0; j < SPECIES.length(); j++) {
70                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] ($type$)((long)b[i])));
71             }
72         }
73     }
74 #end[!Long]
< prev index next >