< prev index next >

test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template

Print this page

467             }
468         }
469         return i - idx;
470     }
471 
472     @Test(dataProvider = "maskProvider")
473     static void maskFirstTrue$vectorteststype$SmokeTest(IntFunction<boolean[]> fa) {
474         boolean[] a = fa.apply(SPECIES.length());
475         int[] r = new int[a.length];
476 
477         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
478             for (int i = 0; i < a.length; i += SPECIES.length()) {
479                 var vmask = SPECIES.loadMask(a, i);
480                 r[i] = vmask.firstTrue();
481             }
482         }
483 
484         assertMaskReductionArraysEquals(r, a, $vectorteststype$::maskFirstTrue);
485     }
486 

















487 #if[!MaxBit]
488     @DataProvider
489     public static Object[][] longMaskProvider() {
490         return new Object[][]{
491                 {0xFFFFFFFFFFFFFFFFL},
492                 {0x0000000000000000L},
493                 {0x5555555555555555L},
494                 {0x0123456789abcdefL},
495         };
496     }
497 
498     @Test(dataProvider = "longMaskProvider")
499     static void maskFromToLong$vectorteststype$SmokeTest(long inputLong) {
500         var vmask = VectorMask.fromLong(SPECIES, inputLong);
501         long outputLong = vmask.toLong();
502         Assert.assertEquals(outputLong, inputLong & (((1L << (SPECIES.length() - 1)) << 1) - 1));
503     }
504 #end[!MaxBit]
505 
506     @DataProvider

467             }
468         }
469         return i - idx;
470     }
471 
472     @Test(dataProvider = "maskProvider")
473     static void maskFirstTrue$vectorteststype$SmokeTest(IntFunction<boolean[]> fa) {
474         boolean[] a = fa.apply(SPECIES.length());
475         int[] r = new int[a.length];
476 
477         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
478             for (int i = 0; i < a.length; i += SPECIES.length()) {
479                 var vmask = SPECIES.loadMask(a, i);
480                 r[i] = vmask.firstTrue();
481             }
482         }
483 
484         assertMaskReductionArraysEquals(r, a, $vectorteststype$::maskFirstTrue);
485     }
486 
487     @Test(dataProvider = "maskProvider")
488     static void maskCompress$vectorteststype$SmokeTest(IntFunction<boolean[]> fa) {
489         int trueCount = 0;
490         boolean[] a = fa.apply(SPECIES.length());
491 
492         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
493             for (int i = 0; i < a.length; i += SPECIES.length()) {
494                 var vmask = SPECIES.loadMask(a, i);
495                 trueCount = vmask.trueCount();
496                 var rmask = vmask.compress();
497                 for (int j = 0; j < SPECIES.length(); j++)  {
498                     Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
499                 }
500             }
501         }
502     }
503 
504 #if[!MaxBit]
505     @DataProvider
506     public static Object[][] longMaskProvider() {
507         return new Object[][]{
508                 {0xFFFFFFFFFFFFFFFFL},
509                 {0x0000000000000000L},
510                 {0x5555555555555555L},
511                 {0x0123456789abcdefL},
512         };
513     }
514 
515     @Test(dataProvider = "longMaskProvider")
516     static void maskFromToLong$vectorteststype$SmokeTest(long inputLong) {
517         var vmask = VectorMask.fromLong(SPECIES, inputLong);
518         long outputLong = vmask.toLong();
519         Assert.assertEquals(outputLong, inputLong & (((1L << (SPECIES.length() - 1)) << 1) - 1));
520     }
521 #end[!MaxBit]
522 
523     @DataProvider
< prev index next >