< prev index next >

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

Print this page


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

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

< prev index next >