< prev index next >

test/jdk/jdk/incubator/vector/templates/Unit-Slice-Masked-bop.template

Print this page


 1     static $type$[] [[TEST]]($type$[] a, $type$[] b, int origin, boolean[] mask, int idx) {
 2         $type$[] res = new $type$[SPECIES.length()];
 3         for (int i = 0, j = 0; i < SPECIES.length(); i++){
 4             if(i+origin < SPECIES.length())
 5                 res[i] = mask[i] ? a[idx+i+origin] : ($type$)0;
 6             else {
 7                 res[i] = mask[i] ? b[idx+j] : ($type$)0;
 8                 j++;
 9             }
10         }
11         return res;
12     }
13 
14     @Test(dataProvider = "$type$BinaryOpMaskProvider")
15     static void [[TEST]]$vectorteststype$Masked(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
16     IntFunction<boolean[]> fm) {
17 [[KERNEL]]
18         assertArraysEquals(r, a, b, origin, mask, $vectorteststype$::[[TEST]]);
19     }

 1 
 2     static $type$[] [[TEST]]($type$[] a, $type$[] b, int origin, boolean[] mask, int idx) {
 3         $type$[] res = new $type$[SPECIES.length()];
 4         for (int i = 0, j = 0; i < SPECIES.length(); i++){
 5             if(i+origin < SPECIES.length())
 6                 res[i] = mask[i] ? a[idx+i+origin] : ($type$)0;
 7             else {
 8                 res[i] = mask[i] ? b[idx+j] : ($type$)0;
 9                 j++;
10             }
11         }
12         return res;
13     }
14 
15     @Test(dataProvider = "$type$BinaryOpMaskProvider")
16     static void [[TEST]]$vectorteststype$Masked(IntFunction<$type$[]> fa, IntFunction<$type$[]> fb,
17     IntFunction<boolean[]> fm) {
18 [[KERNEL]]
19         assertArraysEquals(r, a, b, origin, mask, $vectorteststype$::[[TEST]]);
20     }
< prev index next >