1 /*
   2  * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @key randomness
  27  *
  28  * @library /test/lib
  29  * @modules jdk.incubator.vector
  30  * @run testng/othervm/timeout=300 -ea -esa -Xbatch -XX:-TieredCompilation Byte128VectorTests
  31  */
  32 
  33 // -- This file was mechanically generated: Do not edit! -- //
  34 
  35 import jdk.incubator.vector.VectorShape;
  36 import jdk.incubator.vector.VectorSpecies;
  37 import jdk.incubator.vector.VectorShuffle;
  38 import jdk.incubator.vector.VectorMask;
  39 import jdk.incubator.vector.VectorOperators;
  40 import jdk.incubator.vector.Vector;
  41 import jdk.incubator.vector.VectorMath;
  42 
  43 import jdk.incubator.vector.ByteVector;
  44 
  45 import org.testng.Assert;
  46 import org.testng.annotations.DataProvider;
  47 import org.testng.annotations.Test;
  48 
  49 import java.lang.Integer;
  50 import java.util.List;
  51 import java.util.Arrays;
  52 import java.util.function.BiFunction;
  53 import java.util.function.IntFunction;
  54 import java.util.Objects;
  55 import java.util.stream.Collectors;
  56 import java.util.stream.Stream;
  57 
  58 @Test
  59 public class Byte128VectorTests extends AbstractVectorTest {
  60 
  61     static final VectorSpecies<Byte> SPECIES =
  62                 ByteVector.SPECIES_128;
  63 
  64     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  65 
  66 
  67     private static final byte CONST_SHIFT = Byte.SIZE / 2;
  68 
  69     static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
  70 
  71     static void assertArraysStrictlyEquals(byte[] r, byte[] a) {
  72         for (int i = 0; i < a.length; i++) {
  73             if (r[i] != a[i]) {
  74                 Assert.fail("at index #" + i + ", expected = " + a[i] + ", actual = " + r[i]);
  75             }
  76         }
  77     }
  78 
  79     interface FUnOp {
  80         byte apply(byte a);
  81     }
  82 
  83     static void assertArraysEquals(byte[] r, byte[] a, FUnOp f) {
  84         int i = 0;
  85         try {
  86             for (; i < a.length; i++) {
  87                 Assert.assertEquals(r[i], f.apply(a[i]));
  88             }
  89         } catch (AssertionError e) {
  90             Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
  91         }
  92     }
  93 
  94     interface FUnArrayOp {
  95         byte[] apply(byte a);
  96     }
  97 
  98     static void assertArraysEquals(byte[] r, byte[] a, FUnArrayOp f) {
  99         int i = 0;
 100         try {
 101             for (; i < a.length; i += SPECIES.length()) {
 102                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 103                   f.apply(a[i]));
 104             }
 105         } catch (AssertionError e) {
 106             byte[] ref = f.apply(a[i]);
 107             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 108             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 109               + ", res: " + Arrays.toString(res)
 110               + "), at index #" + i);
 111         }
 112     }
 113 
 114     static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask, FUnOp f) {
 115         int i = 0;
 116         try {
 117             for (; i < a.length; i++) {
 118                 Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]);
 119             }
 120         } catch (AssertionError e) {
 121             Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]);
 122         }
 123     }
 124 
 125     interface FReductionOp {
 126         byte apply(byte[] a, int idx);
 127     }
 128 
 129     interface FReductionAllOp {
 130         byte apply(byte[] a);
 131     }
 132 
 133     static void assertReductionArraysEquals(byte[] r, byte rc, byte[] a,
 134                                             FReductionOp f, FReductionAllOp fa) {
 135         int i = 0;
 136         try {
 137             Assert.assertEquals(rc, fa.apply(a));
 138             for (; i < a.length; i += SPECIES.length()) {
 139                 Assert.assertEquals(r[i], f.apply(a, i));
 140             }
 141         } catch (AssertionError e) {
 142             Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!");
 143             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 144         }
 145     }
 146 
 147     interface FReductionMaskedOp {
 148         byte apply(byte[] a, int idx, boolean[] mask);
 149     }
 150 
 151     interface FReductionAllMaskedOp {
 152         byte apply(byte[] a, boolean[] mask);
 153     }
 154 
 155     static void assertReductionArraysEqualsMasked(byte[] r, byte rc, byte[] a, boolean[] mask,
 156                                             FReductionMaskedOp f, FReductionAllMaskedOp fa) {
 157         int i = 0;
 158         try {
 159             Assert.assertEquals(rc, fa.apply(a, mask));
 160             for (; i < a.length; i += SPECIES.length()) {
 161                 Assert.assertEquals(r[i], f.apply(a, i, mask));
 162             }
 163         } catch (AssertionError e) {
 164             Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!");
 165             Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i);
 166         }
 167     }
 168 
 169     interface FReductionOpLong {
 170         long apply(byte[] a, int idx);
 171     }
 172 
 173     interface FReductionAllOpLong {
 174         long apply(byte[] a);
 175     }
 176 
 177     static void assertReductionLongArraysEquals(long[] r, long rc, byte[] a,
 178                                             FReductionOpLong f, FReductionAllOpLong fa) {
 179         int i = 0;
 180         try {
 181             Assert.assertEquals(rc, fa.apply(a));
 182             for (; i < a.length; i += SPECIES.length()) {
 183                 Assert.assertEquals(r[i], f.apply(a, i));
 184             }
 185         } catch (AssertionError e) {
 186             Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!");
 187             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 188         }
 189     }
 190 
 191     interface FReductionMaskedOpLong {
 192         long apply(byte[] a, int idx, boolean[] mask);
 193     }
 194 
 195     interface FReductionAllMaskedOpLong {
 196         long apply(byte[] a, boolean[] mask);
 197     }
 198 
 199     static void assertReductionLongArraysEqualsMasked(long[] r, long rc, byte[] a, boolean[] mask,
 200                                             FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) {
 201         int i = 0;
 202         try {
 203             Assert.assertEquals(rc, fa.apply(a, mask));
 204             for (; i < a.length; i += SPECIES.length()) {
 205                 Assert.assertEquals(r[i], f.apply(a, i, mask));
 206             }
 207         } catch (AssertionError e) {
 208             Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!");
 209             Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i);
 210         }
 211     }
 212 
 213     interface FBoolReductionOp {
 214         boolean apply(boolean[] a, int idx);
 215     }
 216 
 217     static void assertReductionBoolArraysEquals(boolean[] r, boolean[] a, FBoolReductionOp f) {
 218         int i = 0;
 219         try {
 220             for (; i < a.length; i += SPECIES.length()) {
 221                 Assert.assertEquals(r[i], f.apply(a, i));
 222             }
 223         } catch (AssertionError e) {
 224             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 225         }
 226     }
 227 
 228     interface FMaskReductionOp {
 229         int apply(boolean[] a, int idx);
 230     }
 231 
 232     static void assertMaskReductionArraysEquals(int[] r, boolean[] a, FMaskReductionOp f) {
 233         int i = 0;
 234         try {
 235             for (; i < a.length; i += SPECIES.length()) {
 236                 Assert.assertEquals(r[i], f.apply(a, i));
 237             }
 238         } catch (AssertionError e) {
 239             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 240         }
 241     }
 242 
 243     static void assertRearrangeArraysEquals(byte[] r, byte[] a, int[] order, int vector_len) {
 244         int i = 0, j = 0;
 245         try {
 246             for (; i < a.length; i += vector_len) {
 247                 for (j = 0; j < vector_len; j++) {
 248                     Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 249                 }
 250             }
 251         } catch (AssertionError e) {
 252             int idx = i + j;
 253             Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]);
 254         }
 255     }
 256 
 257     static void assertcompressArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
 258         int i = 0, j = 0, k = 0;
 259         try {
 260             for (; i < a.length; i += vector_len) {
 261                 k = 0;
 262                 for (j = 0; j < vector_len; j++) {
 263                     if (m[(i + j) % SPECIES.length()]) {
 264                         Assert.assertEquals(r[i + k], a[i + j]);
 265                         k++;
 266                     }
 267                 }
 268                 for (; k < vector_len; k++) {
 269                     Assert.assertEquals(r[i + k], (byte)0);
 270                 }
 271             }
 272         } catch (AssertionError e) {
 273             int idx = i + k;
 274             if (m[(i + j) % SPECIES.length()]) {
 275                 Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
 276             } else {
 277                 Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
 278             }
 279         }
 280     }
 281 
 282     static void assertexpandArraysEquals(byte[] r, byte[] a, boolean[] m, int vector_len) {
 283         int i = 0, j = 0, k = 0;
 284         try {
 285             for (; i < a.length; i += vector_len) {
 286                 k = 0;
 287                 for (j = 0; j < vector_len; j++) {
 288                     if (m[(i + j) % SPECIES.length()]) {
 289                         Assert.assertEquals(r[i + j], a[i + k]);
 290                         k++;
 291                     } else {
 292                         Assert.assertEquals(r[i + j], (byte)0);
 293                     }
 294                 }
 295             }
 296         } catch (AssertionError e) {
 297             int idx = i + j;
 298             if (m[idx % SPECIES.length()]) {
 299                 Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
 300             } else {
 301                 Assert.assertEquals(r[idx], (byte)0, "at index #" + idx);
 302             }
 303         }
 304     }
 305 
 306     static void assertSelectFromTwoVectorEquals(byte[] r, byte[] order, byte[] a, byte[] b, int vector_len) {
 307         int i = 0, j = 0;
 308         boolean is_exceptional_idx = false;
 309         int idx = 0, wrapped_index = 0, oidx = 0;
 310         try {
 311             for (; i < a.length; i += vector_len) {
 312                 for (j = 0; j < vector_len; j++) {
 313                     idx = i + j;
 314                     wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len);
 315                     is_exceptional_idx = wrapped_index >= vector_len;
 316                     oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index;
 317                     Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]));
 318                 }
 319             }
 320         } catch (AssertionError e) {
 321             Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]);
 322         }
 323     }
 324 
 325     static void assertSelectFromArraysEquals(byte[] r, byte[] a, byte[] order, int vector_len) {
 326         int i = 0, j = 0;
 327         try {
 328             for (; i < a.length; i += vector_len) {
 329                 for (j = 0; j < vector_len; j++) {
 330                     Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 331                 }
 332             }
 333         } catch (AssertionError e) {
 334             int idx = i + j;
 335             Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]);
 336         }
 337     }
 338 
 339     static void assertRearrangeArraysEquals(byte[] r, byte[] a, int[] order, boolean[] mask, int vector_len) {
 340         int i = 0, j = 0;
 341         try {
 342             for (; i < a.length; i += vector_len) {
 343                 for (j = 0; j < vector_len; j++) {
 344                     if (mask[j % SPECIES.length()])
 345                          Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 346                     else
 347                          Assert.assertEquals(r[i+j], (byte)0);
 348                 }
 349             }
 350         } catch (AssertionError e) {
 351             int idx = i + j;
 352             if (mask[j % SPECIES.length()])
 353                 Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 354             else
 355                 Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 356         }
 357     }
 358 
 359     static void assertSelectFromArraysEquals(byte[] r, byte[] a, byte[] order, boolean[] mask, int vector_len) {
 360         int i = 0, j = 0;
 361         try {
 362             for (; i < a.length; i += vector_len) {
 363                 for (j = 0; j < vector_len; j++) {
 364                     if (mask[j % SPECIES.length()])
 365                          Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 366                     else
 367                          Assert.assertEquals(r[i+j], (byte)0);
 368                 }
 369             }
 370         } catch (AssertionError e) {
 371             int idx = i + j;
 372             if (mask[j % SPECIES.length()])
 373                 Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 374             else
 375                 Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 376         }
 377     }
 378 
 379     static void assertBroadcastArraysEquals(byte[] r, byte[] a) {
 380         int i = 0;
 381         for (; i < a.length; i += SPECIES.length()) {
 382             int idx = i;
 383             for (int j = idx; j < (idx + SPECIES.length()); j++)
 384                 a[j]=a[idx];
 385         }
 386 
 387         try {
 388             for (i = 0; i < a.length; i++) {
 389                 Assert.assertEquals(r[i], a[i]);
 390             }
 391         } catch (AssertionError e) {
 392             Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]);
 393         }
 394     }
 395 
 396     interface FBinOp {
 397         byte apply(byte a, byte b);
 398     }
 399 
 400     interface FBinMaskOp {
 401         byte apply(byte a, byte b, boolean m);
 402 
 403         static FBinMaskOp lift(FBinOp f) {
 404             return (a, b, m) -> m ? f.apply(a, b) : a;
 405         }
 406     }
 407 
 408     static void assertArraysEqualsAssociative(byte[] rl, byte[] rr, byte[] a, byte[] b, byte[] c, FBinOp f) {
 409         int i = 0;
 410         try {
 411             for (; i < a.length; i++) {
 412                 //Left associative
 413                 Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]));
 414 
 415                 //Right associative
 416                 Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])));
 417 
 418                 //Results equal sanity check
 419                 Assert.assertEquals(rl[i], rr[i]);
 420             }
 421         } catch (AssertionError e) {
 422             Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]);
 423             Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]);
 424             Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]);
 425         }
 426     }
 427 
 428    static void assertArraysEqualsAssociative(byte[] rl, byte[] rr, byte[] a, byte[] b, byte[] c, boolean[] mask, FBinOp f) {
 429        assertArraysEqualsAssociative(rl, rr, a, b, c, mask, FBinMaskOp.lift(f));
 430    }
 431 
 432     static void assertArraysEqualsAssociative(byte[] rl, byte[] rr, byte[] a, byte[] b, byte[] c, boolean[] mask, FBinMaskOp f) {
 433         int i = 0;
 434         boolean mask_bit = false;
 435         try {
 436             for (; i < a.length; i++) {
 437                 mask_bit = mask[i % SPECIES.length()];
 438                 //Left associative
 439                 Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit));
 440 
 441                 //Right associative
 442                 Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit));
 443 
 444                 //Results equal sanity check
 445                 Assert.assertEquals(rl[i], rr[i]);
 446             }
 447         } catch (AssertionError e) {
 448             Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit);
 449             Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit);
 450             Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]);
 451         }
 452     }
 453 
 454     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, FBinOp f) {
 455         int i = 0;
 456         try {
 457             for (; i < a.length; i++) {
 458                 Assert.assertEquals(r[i], f.apply(a[i], b[i]));
 459             }
 460         } catch (AssertionError e) {
 461             Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i);
 462         }
 463     }
 464 
 465     static void assertArraysEquals(byte[] r, byte[] a, byte b, FBinOp f) {
 466         int i = 0;
 467         try {
 468             for (; i < a.length; i++) {
 469                 Assert.assertEquals(r[i], f.apply(a[i], b));
 470             }
 471         } catch (AssertionError e) {
 472             Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i);
 473         }
 474     }
 475 
 476     static void assertBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, FBinOp f) {
 477         int i = 0;
 478         try {
 479             for (; i < a.length; i++) {
 480                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]));
 481             }
 482         } catch (AssertionError e) {
 483             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]),
 484                                 "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i);
 485         }
 486     }
 487 
 488     static void assertBroadcastLongArraysEquals(byte[] r, byte[] a, byte[] b, FBinOp f) {
 489         int i = 0;
 490         try {
 491             for (; i < a.length; i++) {
 492                 Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])));
 493             }
 494         } catch (AssertionError e) {
 495             Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])),
 496                                 "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i);
 497         }
 498     }
 499 
 500     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinOp f) {
 501         assertArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 502     }
 503 
 504     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinMaskOp f) {
 505         int i = 0;
 506         try {
 507             for (; i < a.length; i++) {
 508                 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]));
 509             }
 510         } catch (AssertionError err) {
 511             Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]);
 512         }
 513     }
 514 
 515     static void assertArraysEquals(byte[] r, byte[] a, byte b, boolean[] mask, FBinOp f) {
 516         assertArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 517     }
 518 
 519     static void assertArraysEquals(byte[] r, byte[] a, byte b, boolean[] mask, FBinMaskOp f) {
 520         int i = 0;
 521         try {
 522             for (; i < a.length; i++) {
 523                 Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]));
 524             }
 525         } catch (AssertionError err) {
 526             Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]);
 527         }
 528     }
 529 
 530     static void assertBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinOp f) {
 531         assertBroadcastArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 532     }
 533 
 534     static void assertBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinMaskOp f) {
 535         int i = 0;
 536         try {
 537             for (; i < a.length; i++) {
 538                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]));
 539             }
 540         } catch (AssertionError err) {
 541             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 542                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] +
 543                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 544                                 mask[i % SPECIES.length()]);
 545         }
 546     }
 547 
 548     static void assertBroadcastLongArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinOp f) {
 549         assertBroadcastLongArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 550     }
 551 
 552     static void assertBroadcastLongArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinMaskOp f) {
 553         int i = 0;
 554         try {
 555             for (; i < a.length; i++) {
 556                 Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]));
 557             }
 558         } catch (AssertionError err) {
 559             Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]),
 560                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] +
 561                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 562                                 mask[i % SPECIES.length()]);
 563         }
 564     }
 565 
 566     static void assertShiftArraysEquals(byte[] r, byte[] a, byte[] b, FBinOp f) {
 567         int i = 0;
 568         int j = 0;
 569         try {
 570             for (; j < a.length; j += SPECIES.length()) {
 571                 for (i = 0; i < SPECIES.length(); i++) {
 572                     Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]));
 573                 }
 574             }
 575         } catch (AssertionError e) {
 576             Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j);
 577         }
 578     }
 579 
 580     static void assertShiftArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinOp f) {
 581         assertShiftArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 582     }
 583 
 584     static void assertShiftArraysEquals(byte[] r, byte[] a, byte[] b, boolean[] mask, FBinMaskOp f) {
 585         int i = 0;
 586         int j = 0;
 587         try {
 588             for (; j < a.length; j += SPECIES.length()) {
 589                 for (i = 0; i < SPECIES.length(); i++) {
 590                     Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]));
 591                 }
 592             }
 593         } catch (AssertionError err) {
 594             Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]);
 595         }
 596     }
 597 
 598     interface FBinConstOp {
 599         byte apply(byte a);
 600     }
 601 
 602     interface FBinConstMaskOp {
 603         byte apply(byte a, boolean m);
 604 
 605         static FBinConstMaskOp lift(FBinConstOp f) {
 606             return (a, m) -> m ? f.apply(a) : a;
 607         }
 608     }
 609 
 610     static void assertShiftConstEquals(byte[] r, byte[] a, FBinConstOp f) {
 611         int i = 0;
 612         int j = 0;
 613         try {
 614             for (; j < a.length; j += SPECIES.length()) {
 615                 for (i = 0; i < SPECIES.length(); i++) {
 616                     Assert.assertEquals(r[i+j], f.apply(a[i+j]));
 617                 }
 618             }
 619         } catch (AssertionError e) {
 620             Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j);
 621         }
 622     }
 623 
 624     static void assertShiftConstEquals(byte[] r, byte[] a, boolean[] mask, FBinConstOp f) {
 625         assertShiftConstEquals(r, a, mask, FBinConstMaskOp.lift(f));
 626     }
 627 
 628     static void assertShiftConstEquals(byte[] r, byte[] a, boolean[] mask, FBinConstMaskOp f) {
 629         int i = 0;
 630         int j = 0;
 631         try {
 632             for (; j < a.length; j += SPECIES.length()) {
 633                 for (i = 0; i < SPECIES.length(); i++) {
 634                     Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]));
 635                 }
 636             }
 637         } catch (AssertionError err) {
 638             Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]);
 639         }
 640     }
 641 
 642     interface FTernOp {
 643         byte apply(byte a, byte b, byte c);
 644     }
 645 
 646     interface FTernMaskOp {
 647         byte apply(byte a, byte b, byte c, boolean m);
 648 
 649         static FTernMaskOp lift(FTernOp f) {
 650             return (a, b, c, m) -> m ? f.apply(a, b, c) : a;
 651         }
 652     }
 653 
 654     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, FTernOp f) {
 655         int i = 0;
 656         try {
 657             for (; i < a.length; i++) {
 658                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]));
 659             }
 660         } catch (AssertionError e) {
 661             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]);
 662         }
 663     }
 664 
 665     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask, FTernOp f) {
 666         assertArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 667     }
 668 
 669     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask, FTernMaskOp f) {
 670         int i = 0;
 671         try {
 672             for (; i < a.length; i++) {
 673                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]));
 674             }
 675         } catch (AssertionError err) {
 676             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = "
 677               + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]);
 678         }
 679     }
 680 
 681     static void assertBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, FTernOp f) {
 682         int i = 0;
 683         try {
 684             for (; i < a.length; i++) {
 685                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]));
 686             }
 687         } catch (AssertionError e) {
 688             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" +
 689                                 i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " +
 690                                 c[(i / SPECIES.length()) * SPECIES.length()]);
 691         }
 692     }
 693 
 694     static void assertAltBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, FTernOp f) {
 695         int i = 0;
 696         try {
 697             for (; i < a.length; i++) {
 698                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]));
 699             }
 700         } catch (AssertionError e) {
 701             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" +
 702                                 i + ", input1 = " + a[i] + ", input2 = " +
 703                                 b[(i / SPECIES.length()) * SPECIES.length()] + ",  input3 = " + c[i]);
 704         }
 705     }
 706 
 707     static void assertBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask,
 708                                             FTernOp f) {
 709         assertBroadcastArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 710     }
 711 
 712     static void assertBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask,
 713                                             FTernMaskOp f) {
 714         int i = 0;
 715         try {
 716             for (; i < a.length; i++) {
 717                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()],
 718                                     mask[i % SPECIES.length()]));
 719             }
 720         } catch (AssertionError err) {
 721             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()],
 722                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " +
 723                                 b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 724                                 mask[i % SPECIES.length()]);
 725         }
 726     }
 727 
 728     static void assertAltBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask,
 729                                             FTernOp f) {
 730         assertAltBroadcastArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 731     }
 732 
 733     static void assertAltBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask,
 734                                             FTernMaskOp f) {
 735         int i = 0;
 736         try {
 737             for (; i < a.length; i++) {
 738                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i],
 739                                     mask[i % SPECIES.length()]));
 740             }
 741         } catch (AssertionError err) {
 742             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i],
 743                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] +
 744                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] +
 745                                 ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]);
 746         }
 747     }
 748 
 749     static void assertDoubleBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, FTernOp f) {
 750         int i = 0;
 751         try {
 752             for (; i < a.length; i++) {
 753                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 754                                     c[(i / SPECIES.length()) * SPECIES.length()]));
 755             }
 756         } catch (AssertionError e) {
 757             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 758                                 c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i]
 759                                 + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " +
 760                                 c[(i / SPECIES.length()) * SPECIES.length()]);
 761         }
 762     }
 763 
 764     static void assertDoubleBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask,
 765                                                   FTernOp f) {
 766         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 767     }
 768 
 769     static void assertDoubleBroadcastArraysEquals(byte[] r, byte[] a, byte[] b, byte[] c, boolean[] mask,
 770                                                   FTernMaskOp f) {
 771         int i = 0;
 772         try {
 773             for (; i < a.length; i++) {
 774                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 775                                     c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]));
 776             }
 777         } catch (AssertionError err) {
 778             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 779                                 c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #"
 780                                 + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] +
 781                                 ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 782                                 mask[i % SPECIES.length()]);
 783         }
 784     }
 785 
 786 
 787 
 788     interface FGatherScatterOp {
 789         byte[] apply(byte[] a, int ix, int[] b, int iy);
 790     }
 791 
 792     static void assertArraysEquals(byte[] r, byte[] a, int[] b, FGatherScatterOp f) {
 793         int i = 0;
 794         try {
 795             for (; i < a.length; i += SPECIES.length()) {
 796                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 797                   f.apply(a, i, b, i));
 798             }
 799         } catch (AssertionError e) {
 800             byte[] ref = f.apply(a, i, b, i);
 801             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 802             Assert.assertEquals(res, ref,
 803               "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: "
 804               + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length()))
 805               + ", b: "
 806               + Arrays.toString(Arrays.copyOfRange(b, i, i+SPECIES.length()))
 807               + " at index #" + i);
 808         }
 809     }
 810 
 811     interface FGatherMaskedOp {
 812         byte[] apply(byte[] a, int ix, boolean[] mask, int[] b, int iy);
 813     }
 814 
 815     interface FScatterMaskedOp {
 816         byte[] apply(byte[] r, byte[] a, int ix, boolean[] mask, int[] b, int iy);
 817     }
 818 
 819     static void assertArraysEquals(byte[] r, byte[] a, int[] b, boolean[] mask, FGatherMaskedOp f) {
 820         int i = 0;
 821         try {
 822             for (; i < a.length; i += SPECIES.length()) {
 823                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 824                   f.apply(a, i, mask, b, i));
 825             }
 826         } catch (AssertionError e) {
 827             byte[] ref = f.apply(a, i, mask, b, i);
 828             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 829             Assert.assertEquals(res, ref,
 830               "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: "
 831               + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length()))
 832               + ", b: "
 833               + Arrays.toString(Arrays.copyOfRange(b, i, i+SPECIES.length()))
 834               + ", mask: "
 835               + Arrays.toString(mask)
 836               + " at index #" + i);
 837         }
 838     }
 839 
 840     static void assertArraysEquals(byte[] r, byte[] a, int[] b, boolean[] mask, FScatterMaskedOp f) {
 841         int i = 0;
 842         try {
 843             for (; i < a.length; i += SPECIES.length()) {
 844                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 845                   f.apply(r, a, i, mask, b, i));
 846             }
 847         } catch (AssertionError e) {
 848             byte[] ref = f.apply(r, a, i, mask, b, i);
 849             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 850             Assert.assertEquals(res, ref,
 851               "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: "
 852               + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length()))
 853               + ", b: "
 854               + Arrays.toString(Arrays.copyOfRange(b, i, i+SPECIES.length()))
 855               + ", r: "
 856               + Arrays.toString(Arrays.copyOfRange(r, i, i+SPECIES.length()))
 857               + ", mask: "
 858               + Arrays.toString(mask)
 859               + " at index #" + i);
 860         }
 861     }
 862 
 863     interface FLaneOp {
 864         byte[] apply(byte[] a, int origin, int idx);
 865     }
 866 
 867     static void assertArraysEquals(byte[] r, byte[] a, int origin, FLaneOp f) {
 868         int i = 0;
 869         try {
 870             for (; i < a.length; i += SPECIES.length()) {
 871                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 872                   f.apply(a, origin, i));
 873             }
 874         } catch (AssertionError e) {
 875             byte[] ref = f.apply(a, origin, i);
 876             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 877             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 878               + ", res: " + Arrays.toString(res)
 879               + "), at index #" + i);
 880         }
 881     }
 882 
 883     interface FLaneBop {
 884         byte[] apply(byte[] a, byte[] b, int origin, int idx);
 885     }
 886 
 887     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, int origin, FLaneBop f) {
 888         int i = 0;
 889         try {
 890             for (; i < a.length; i += SPECIES.length()) {
 891                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 892                   f.apply(a, b, origin, i));
 893             }
 894         } catch (AssertionError e) {
 895             byte[] ref = f.apply(a, b, origin, i);
 896             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 897             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 898               + ", res: " + Arrays.toString(res)
 899               + "), at index #" + i
 900               + ", at origin #" + origin);
 901         }
 902     }
 903 
 904     interface FLaneMaskedBop {
 905         byte[] apply(byte[] a, byte[] b, int origin, boolean[] mask, int idx);
 906     }
 907 
 908     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, int origin, boolean[] mask, FLaneMaskedBop f) {
 909         int i = 0;
 910         try {
 911             for (; i < a.length; i += SPECIES.length()) {
 912                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 913                   f.apply(a, b, origin, mask, i));
 914             }
 915         } catch (AssertionError e) {
 916             byte[] ref = f.apply(a, b, origin, mask, i);
 917             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 918             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 919               + ", res: " + Arrays.toString(res)
 920               + "), at index #" + i
 921               + ", at origin #" + origin);
 922         }
 923     }
 924 
 925     interface FLanePartBop {
 926         byte[] apply(byte[] a, byte[] b, int origin, int part, int idx);
 927     }
 928 
 929     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, int origin, int part, FLanePartBop f) {
 930         int i = 0;
 931         try {
 932             for (; i < a.length; i += SPECIES.length()) {
 933                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 934                   f.apply(a, b, origin, part, i));
 935             }
 936         } catch (AssertionError e) {
 937             byte[] ref = f.apply(a, b, origin, part, i);
 938             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 939             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 940               + ", res: " + Arrays.toString(res)
 941               + "), at index #" + i
 942               + ", at origin #" + origin
 943               + ", with part #" + part);
 944         }
 945     }
 946 
 947     interface FLanePartMaskedBop {
 948         byte[] apply(byte[] a, byte[] b, int origin, int part, boolean[] mask, int idx);
 949     }
 950 
 951     static void assertArraysEquals(byte[] r, byte[] a, byte[] b, int origin, int part, boolean[] mask, FLanePartMaskedBop f) {
 952         int i = 0;
 953         try {
 954             for (; i < a.length; i += SPECIES.length()) {
 955                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 956                   f.apply(a, b, origin, part, mask, i));
 957             }
 958         } catch (AssertionError e) {
 959             byte[] ref = f.apply(a, b, origin, part, mask, i);
 960             byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 961             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 962               + ", res: " + Arrays.toString(res)
 963               + "), at index #" + i
 964               + ", at origin #" + origin
 965               + ", with part #" + part);
 966         }
 967     }
 968 
 969 
 970     static void assertArraysEquals(int[] r, byte[] a, int offs) {
 971         int i = 0;
 972         try {
 973             for (; i < r.length; i++) {
 974                 Assert.assertEquals(r[i], (int)(a[i+offs]));
 975             }
 976         } catch (AssertionError e) {
 977             Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 978         }
 979     }
 980 
 981 
 982     static void assertArraysEquals(byte[] r, byte[] a, int offs) {
 983         int i = 0;
 984         try {
 985             for (; i < r.length; i++) {
 986                 Assert.assertEquals(r[i], (long)(a[i+offs]));
 987             }
 988         } catch (AssertionError e) {
 989             Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 990         }
 991     }
 992 
 993     static void assertArraysEquals(long[] r, byte[] a, int offs) {
 994         int i = 0;
 995         try {
 996             for (; i < r.length; i++) {
 997                 Assert.assertEquals(r[i], (long)(a[i+offs]));
 998             }
 999         } catch (AssertionError e) {
1000             Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
1001         }
1002     }
1003 
1004     static void assertArraysEquals(double[] r, byte[] a, int offs) {
1005         int i = 0;
1006         try {
1007             for (; i < r.length; i++) {
1008                 Assert.assertEquals(r[i], (double)(a[i+offs]));
1009             }
1010         } catch (AssertionError e) {
1011             Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
1012         }
1013     }
1014 
1015     static byte bits(byte e) {
1016         return  e;
1017     }
1018 
1019     static final List<IntFunction<byte[]>> BYTE_GENERATORS = List.of(
1020             withToString("byte[-i * 5]", (int s) -> {
1021                 return fill(s * BUFFER_REPS,
1022                             i -> (byte)(-i * 5));
1023             }),
1024             withToString("byte[i * 5]", (int s) -> {
1025                 return fill(s * BUFFER_REPS,
1026                             i -> (byte)(i * 5));
1027             }),
1028             withToString("byte[i + 1]", (int s) -> {
1029                 return fill(s * BUFFER_REPS,
1030                             i -> (((byte)(i + 1) == 0) ? 1 : (byte)(i + 1)));
1031             }),
1032             withToString("byte[cornerCaseValue(i)]", (int s) -> {
1033                 return fill(s * BUFFER_REPS,
1034                             i -> cornerCaseValue(i));
1035             })
1036     );
1037 
1038     static final List<IntFunction<byte[]>> BYTE_SATURATING_GENERATORS = List.of(
1039             withToString("byte[Byte.MIN_VALUE]", (int s) -> {
1040                 return fill(s * BUFFER_REPS,
1041                             i -> (byte)(Byte.MIN_VALUE));
1042             }),
1043             withToString("byte[Byte.MAX_VALUE]", (int s) -> {
1044                 return fill(s * BUFFER_REPS,
1045                             i -> (byte)(Byte.MAX_VALUE));
1046             }),
1047             withToString("byte[Byte.MAX_VALUE - 100]", (int s) -> {
1048                 return fill(s * BUFFER_REPS,
1049                             i -> (byte)(Byte.MAX_VALUE - 100));
1050             }),
1051             withToString("byte[Byte.MIN_VALUE + 100]", (int s) -> {
1052                 return fill(s * BUFFER_REPS,
1053                             i -> (byte)(Byte.MIN_VALUE + 100));
1054             }),
1055             withToString("byte[-i * 5]", (int s) -> {
1056                 return fill(s * BUFFER_REPS,
1057                             i -> (byte)(-i * 5));
1058             }),
1059             withToString("byte[i * 5]", (int s) -> {
1060                 return fill(s * BUFFER_REPS,
1061                             i -> (byte)(i * 5));
1062             })
1063     );
1064 
1065     static final List<IntFunction<byte[]>> BYTE_SATURATING_GENERATORS_ASSOC = List.of(
1066             withToString("byte[Byte.MAX_VALUE]", (int s) -> {
1067                 return fill(s * BUFFER_REPS,
1068                             i -> (byte)(Byte.MAX_VALUE));
1069             }),
1070             withToString("byte[Byte.MAX_VALUE - 100]", (int s) -> {
1071                 return fill(s * BUFFER_REPS,
1072                             i -> (byte)(Byte.MAX_VALUE - 100));
1073             }),
1074             withToString("byte[-1]", (int s) -> {
1075                 return fill(s * BUFFER_REPS,
1076                             i -> (byte)(-1));
1077             })
1078     );
1079 
1080     // Create combinations of pairs
1081     // @@@ Might be sensitive to order e.g. div by 0
1082     static final List<List<IntFunction<byte[]>>> BYTE_GENERATOR_PAIRS =
1083         Stream.of(BYTE_GENERATORS.get(0)).
1084                 flatMap(fa -> BYTE_GENERATORS.stream().skip(1).map(fb -> List.of(fa, fb))).
1085                 collect(Collectors.toList());
1086 
1087     static final List<List<IntFunction<byte[]>>> BYTE_SATURATING_GENERATOR_PAIRS =
1088         Stream.of(BYTE_GENERATORS.get(0)).
1089                 flatMap(fa -> BYTE_SATURATING_GENERATORS.stream().skip(1).map(fb -> List.of(fa, fb))).
1090                 collect(Collectors.toList());
1091 
1092     static final List<List<IntFunction<byte[]>>> BYTE_SATURATING_GENERATOR_TRIPLETS =
1093             Stream.of(BYTE_GENERATORS.get(1))
1094                     .flatMap(fa -> BYTE_SATURATING_GENERATORS_ASSOC.stream().map(fb -> List.of(fa, fb)))
1095                     .flatMap(pair -> BYTE_SATURATING_GENERATORS_ASSOC.stream().map(f -> List.of(pair.get(0), pair.get(1), f)))
1096                     .collect(Collectors.toList());
1097 
1098     @DataProvider
1099     public Object[][] boolUnaryOpProvider() {
1100         return BOOL_ARRAY_GENERATORS.stream().
1101                 map(f -> new Object[]{f}).
1102                 toArray(Object[][]::new);
1103     }
1104 
1105     static final List<List<IntFunction<byte[]>>> BYTE_GENERATOR_TRIPLES =
1106         BYTE_GENERATOR_PAIRS.stream().
1107                 flatMap(pair -> BYTE_GENERATORS.stream().map(f -> List.of(pair.get(0), pair.get(1), f))).
1108                 collect(Collectors.toList());
1109 
1110     static final List<IntFunction<byte[]>> SELECT_FROM_INDEX_GENERATORS = List.of(
1111             withToString("byte[0..VECLEN*2)", (int s) -> {
1112                 return fill(s * BUFFER_REPS,
1113                             i -> (byte)(RAND.nextInt()));
1114             })
1115     );
1116 
1117     static final List<List<IntFunction<byte[]>>> BYTE_GENERATOR_SELECT_FROM_TRIPLES =
1118         BYTE_GENERATOR_PAIRS.stream().
1119                 flatMap(pair -> SELECT_FROM_INDEX_GENERATORS.stream().map(f -> List.of(pair.get(0), pair.get(1), f))).
1120                 collect(Collectors.toList());
1121 
1122     @DataProvider
1123     public Object[][] byteBinaryOpProvider() {
1124         return BYTE_GENERATOR_PAIRS.stream().map(List::toArray).
1125                 toArray(Object[][]::new);
1126     }
1127 
1128     @DataProvider
1129     public Object[][] byteSaturatingBinaryOpProvider() {
1130         return BYTE_SATURATING_GENERATOR_PAIRS.stream().map(List::toArray).
1131                 toArray(Object[][]::new);
1132     }
1133 
1134     @DataProvider
1135     public Object[][] byteSaturatingBinaryOpAssocProvider() {
1136         return BYTE_SATURATING_GENERATOR_TRIPLETS.stream().map(List::toArray).
1137                 toArray(Object[][]::new);
1138     }
1139 
1140     @DataProvider
1141     public Object[][] byteSaturatingBinaryOpAssocMaskProvider() {
1142         return BOOLEAN_MASK_GENERATORS.stream().
1143                 flatMap(fm -> BYTE_SATURATING_GENERATOR_TRIPLETS.stream().map(lfa -> {
1144                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1145                 })).
1146                 toArray(Object[][]::new);
1147     }
1148 
1149 
1150     @DataProvider
1151     public Object[][] byteIndexedOpProvider() {
1152         return BYTE_GENERATOR_PAIRS.stream().map(List::toArray).
1153                 toArray(Object[][]::new);
1154     }
1155 
1156     @DataProvider
1157     public Object[][] byteSaturatingBinaryOpMaskProvider() {
1158         return BOOLEAN_MASK_GENERATORS.stream().
1159                 flatMap(fm -> BYTE_SATURATING_GENERATOR_PAIRS.stream().map(lfa -> {
1160                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1161                 })).
1162                 toArray(Object[][]::new);
1163     }
1164 
1165    @DataProvider
1166    public Object[][] byteSaturatingUnaryOpProvider() {
1167        return BYTE_SATURATING_GENERATORS.stream().
1168                     map(f -> new Object[]{f}).
1169                     toArray(Object[][]::new);
1170    }
1171 
1172    @DataProvider
1173    public Object[][] byteSaturatingUnaryOpMaskProvider() {
1174         return BOOLEAN_MASK_GENERATORS.stream().
1175                 flatMap(fm -> BYTE_SATURATING_GENERATORS.stream().map(fa -> {
1176                     return new Object[] {fa, fm};
1177                 })).
1178                 toArray(Object[][]::new);
1179    }
1180 
1181     @DataProvider
1182     public Object[][] byteBinaryOpMaskProvider() {
1183         return BOOLEAN_MASK_GENERATORS.stream().
1184                 flatMap(fm -> BYTE_GENERATOR_PAIRS.stream().map(lfa -> {
1185                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1186                 })).
1187                 toArray(Object[][]::new);
1188     }
1189 
1190     @DataProvider
1191     public Object[][] byteTernaryOpProvider() {
1192         return BYTE_GENERATOR_TRIPLES.stream().map(List::toArray).
1193                 toArray(Object[][]::new);
1194     }
1195 
1196     @DataProvider
1197     public Object[][] byteSelectFromTwoVectorOpProvider() {
1198         return BYTE_GENERATOR_SELECT_FROM_TRIPLES.stream().map(List::toArray).
1199                 toArray(Object[][]::new);
1200     }
1201 
1202     @DataProvider
1203     public Object[][] byteTernaryOpMaskProvider() {
1204         return BOOLEAN_MASK_GENERATORS.stream().
1205                 flatMap(fm -> BYTE_GENERATOR_TRIPLES.stream().map(lfa -> {
1206                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1207                 })).
1208                 toArray(Object[][]::new);
1209     }
1210 
1211     @DataProvider
1212     public Object[][] byteUnaryOpProvider() {
1213         return BYTE_GENERATORS.stream().
1214                 map(f -> new Object[]{f}).
1215                 toArray(Object[][]::new);
1216     }
1217 
1218     @DataProvider
1219     public Object[][] byteUnaryOpMaskProvider() {
1220         return BOOLEAN_MASK_GENERATORS.stream().
1221                 flatMap(fm -> BYTE_GENERATORS.stream().map(fa -> {
1222                     return new Object[] {fa, fm};
1223                 })).
1224                 toArray(Object[][]::new);
1225     }
1226 
1227     @DataProvider
1228     public Object[][] maskProvider() {
1229         return BOOLEAN_MASK_GENERATORS.stream().
1230                 map(f -> new Object[]{f}).
1231                 toArray(Object[][]::new);
1232     }
1233 
1234     @DataProvider
1235     public Object[][] maskCompareOpProvider() {
1236         return BOOLEAN_MASK_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
1237                 toArray(Object[][]::new);
1238     }
1239 
1240     @DataProvider
1241     public Object[][] shuffleProvider() {
1242         return INT_SHUFFLE_GENERATORS.stream().
1243                 map(f -> new Object[]{f}).
1244                 toArray(Object[][]::new);
1245     }
1246 
1247     @DataProvider
1248     public Object[][] shuffleCompareOpProvider() {
1249         return INT_SHUFFLE_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
1250                 toArray(Object[][]::new);
1251     }
1252 
1253     @DataProvider
1254     public Object[][] byteUnaryOpShuffleProvider() {
1255         return INT_SHUFFLE_GENERATORS.stream().
1256                 flatMap(fs -> BYTE_GENERATORS.stream().map(fa -> {
1257                     return new Object[] {fa, fs};
1258                 })).
1259                 toArray(Object[][]::new);
1260     }
1261 
1262     @DataProvider
1263     public Object[][] byteUnaryOpShuffleMaskProvider() {
1264         return BOOLEAN_MASK_GENERATORS.stream().
1265                 flatMap(fm -> INT_SHUFFLE_GENERATORS.stream().
1266                     flatMap(fs -> BYTE_GENERATORS.stream().map(fa -> {
1267                         return new Object[] {fa, fs, fm};
1268                 }))).
1269                 toArray(Object[][]::new);
1270     }
1271 
1272     static final List<BiFunction<Integer,Integer,byte[]>> BYTE_SHUFFLE_GENERATORS = List.of(
1273             withToStringBi("shuffle[random]", (Integer l, Integer m) -> {
1274                 byte[] a = new byte[l];
1275                 int upper = m;
1276                 for (int i = 0; i < 1; i++) {
1277                     a[i] = (byte)RAND.nextInt(upper);
1278                 }
1279                 return a;
1280             })
1281     );
1282 
1283     @DataProvider
1284     public Object[][] byteUnaryOpSelectFromProvider() {
1285         return BYTE_SHUFFLE_GENERATORS.stream().
1286                 flatMap(fs -> BYTE_GENERATORS.stream().map(fa -> {
1287                     return new Object[] {fa, fs};
1288                 })).
1289                 toArray(Object[][]::new);
1290     }
1291 
1292     @DataProvider
1293     public Object[][] byteUnaryOpSelectFromMaskProvider() {
1294         return BOOLEAN_MASK_GENERATORS.stream().
1295                 flatMap(fm -> BYTE_SHUFFLE_GENERATORS.stream().
1296                     flatMap(fs -> BYTE_GENERATORS.stream().map(fa -> {
1297                         return new Object[] {fa, fs, fm};
1298                 }))).
1299                 toArray(Object[][]::new);
1300     }
1301 
1302     static final List<IntFunction<byte[]>> BYTE_COMPARE_GENERATORS = List.of(
1303             withToString("byte[i]", (int s) -> {
1304                 return fill(s * BUFFER_REPS,
1305                             i -> (byte)i);
1306             }),
1307             withToString("byte[i - length / 2]", (int s) -> {
1308                 return fill(s * BUFFER_REPS,
1309                             i -> (byte)(i - (s * BUFFER_REPS / 2)));
1310             }),
1311             withToString("byte[i + 1]", (int s) -> {
1312                 return fill(s * BUFFER_REPS,
1313                             i -> (byte)(i + 1));
1314             }),
1315             withToString("byte[i - 2]", (int s) -> {
1316                 return fill(s * BUFFER_REPS,
1317                             i -> (byte)(i - 2));
1318             }),
1319             withToString("byte[zigZag(i)]", (int s) -> {
1320                 return fill(s * BUFFER_REPS,
1321                             i -> i%3 == 0 ? (byte)i : (i%3 == 1 ? (byte)(i + 1) : (byte)(i - 2)));
1322             }),
1323             withToString("byte[cornerCaseValue(i)]", (int s) -> {
1324                 return fill(s * BUFFER_REPS,
1325                             i -> cornerCaseValue(i));
1326             })
1327     );
1328 
1329     static final List<List<IntFunction<byte[]>>> BYTE_TEST_GENERATOR_ARGS =
1330         BYTE_COMPARE_GENERATORS.stream().
1331                 map(fa -> List.of(fa)).
1332                 collect(Collectors.toList());
1333 
1334     @DataProvider
1335     public Object[][] byteTestOpProvider() {
1336         return BYTE_TEST_GENERATOR_ARGS.stream().map(List::toArray).
1337                 toArray(Object[][]::new);
1338     }
1339 
1340     @DataProvider
1341     public Object[][] byteTestOpMaskProvider() {
1342         return BOOLEAN_MASK_GENERATORS.stream().
1343                 flatMap(fm -> BYTE_TEST_GENERATOR_ARGS.stream().map(lfa -> {
1344                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1345                 })).
1346                 toArray(Object[][]::new);
1347     }
1348 
1349     static final List<List<IntFunction<byte[]>>> BYTE_COMPARE_GENERATOR_PAIRS =
1350         BYTE_COMPARE_GENERATORS.stream().
1351                 flatMap(fa -> BYTE_COMPARE_GENERATORS.stream().map(fb -> List.of(fa, fb))).
1352                 collect(Collectors.toList());
1353 
1354     @DataProvider
1355     public Object[][] byteCompareOpProvider() {
1356         return BYTE_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
1357                 toArray(Object[][]::new);
1358     }
1359 
1360     @DataProvider
1361     public Object[][] byteCompareOpMaskProvider() {
1362         return BOOLEAN_MASK_GENERATORS.stream().
1363                 flatMap(fm -> BYTE_COMPARE_GENERATOR_PAIRS.stream().map(lfa -> {
1364                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1365                 })).
1366                 toArray(Object[][]::new);
1367     }
1368 
1369     interface ToByteF {
1370         byte apply(int i);
1371     }
1372 
1373     static byte[] fill(int s , ToByteF f) {
1374         return fill(new byte[s], f);
1375     }
1376 
1377     static byte[] fill(byte[] a, ToByteF f) {
1378         for (int i = 0; i < a.length; i++) {
1379             a[i] = f.apply(i);
1380         }
1381         return a;
1382     }
1383 
1384     static byte cornerCaseValue(int i) {
1385         switch(i % 5) {
1386             case 0:
1387                 return Byte.MAX_VALUE;
1388             case 1:
1389                 return Byte.MIN_VALUE;
1390             case 2:
1391                 return Byte.MIN_VALUE;
1392             case 3:
1393                 return Byte.MAX_VALUE;
1394             default:
1395                 return (byte)0;
1396         }
1397     }
1398 
1399     static final IntFunction<byte[]> fr = (vl) -> {
1400         int length = BUFFER_REPS * vl;
1401         return new byte[length];
1402     };
1403 
1404     static final IntFunction<boolean[]> fmr = (vl) -> {
1405         int length = BUFFER_REPS * vl;
1406         return new boolean[length];
1407     };
1408 
1409     static final IntFunction<long[]> lfr = (vl) -> {
1410         int length = BUFFER_REPS * vl;
1411         return new long[length];
1412     };
1413 
1414     static void replaceZero(byte[] a, byte v) {
1415         for (int i = 0; i < a.length; i++) {
1416             if (a[i] == 0) {
1417                 a[i] = v;
1418             }
1419         }
1420     }
1421 
1422     static void replaceZero(byte[] a, boolean[] mask, byte v) {
1423         for (int i = 0; i < a.length; i++) {
1424             if (mask[i % mask.length] && a[i] == 0) {
1425                 a[i] = v;
1426             }
1427         }
1428     }
1429 
1430     static byte ROL_scalar(byte a, byte b) {
1431         return (byte)(((((byte)a) & 0xFF) << (b & 7)) | ((((byte)a) & 0xFF) >>> (8 - (b & 7))));
1432     }
1433 
1434     static byte ROR_scalar(byte a, byte b) {
1435         return (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))));
1436     }
1437 
1438     static byte TRAILING_ZEROS_COUNT_scalar(byte a) {
1439         return (byte) (a != 0 ? Integer.numberOfTrailingZeros(a) : 8);
1440     }
1441 
1442     static byte LEADING_ZEROS_COUNT_scalar(byte a) {
1443         return (byte) (a >= 0 ? Integer.numberOfLeadingZeros(a) - 24 : 0);
1444     }
1445 
1446     static byte REVERSE_scalar(byte a) {
1447         byte b = (byte) ROL_scalar(a, (byte) 4);
1448         b = (byte) (((b & 0x55) << 1) | ((b & 0xAA) >>> 1));
1449         b = (byte) (((b & 0x33) << 2) | ((b & 0xCC) >>> 2));
1450         return b;
1451     }
1452 
1453     static boolean eq(byte a, byte b) {
1454         return a == b;
1455     }
1456 
1457     static boolean neq(byte a, byte b) {
1458         return a != b;
1459     }
1460 
1461     static boolean lt(byte a, byte b) {
1462         return a < b;
1463     }
1464 
1465     static boolean le(byte a, byte b) {
1466         return a <= b;
1467     }
1468 
1469     static boolean gt(byte a, byte b) {
1470         return a > b;
1471     }
1472 
1473     static boolean ge(byte a, byte b) {
1474         return a >= b;
1475     }
1476 
1477     static boolean ult(byte a, byte b) {
1478         return Byte.compareUnsigned(a, b) < 0;
1479     }
1480 
1481     static boolean ule(byte a, byte b) {
1482         return Byte.compareUnsigned(a, b) <= 0;
1483     }
1484 
1485     static boolean ugt(byte a, byte b) {
1486         return Byte.compareUnsigned(a, b) > 0;
1487     }
1488 
1489     static boolean uge(byte a, byte b) {
1490         return Byte.compareUnsigned(a, b) >= 0;
1491     }
1492 
1493     static byte firstNonZero(byte a, byte b) {
1494         return Byte.compare(a, (byte) 0) != 0 ? a : b;
1495     }
1496 
1497     @Test
1498     static void smokeTest1() {
1499         ByteVector three = ByteVector.broadcast(SPECIES, (byte)-3);
1500         ByteVector three2 = (ByteVector) SPECIES.broadcast(-3);
1501         assert(three.eq(three2).allTrue());
1502         ByteVector three3 = three2.broadcast(1).broadcast(-3);
1503         assert(three.eq(three3).allTrue());
1504         int scale = 2;
1505         Class<?> ETYPE = byte.class;
1506         if (ETYPE == double.class || ETYPE == long.class)
1507             scale = 1000000;
1508         else if (ETYPE == byte.class && SPECIES.length() >= 64)
1509             scale = 1;
1510         ByteVector higher = three.addIndex(scale);
1511         VectorMask<Byte> m = three.compare(VectorOperators.LE, higher);
1512         assert(m.allTrue());
1513         m = higher.min((byte)-1).test(VectorOperators.IS_NEGATIVE);
1514         assert(m.allTrue());
1515         byte max = higher.reduceLanes(VectorOperators.MAX);
1516         assert(max == -3 + scale * (SPECIES.length()-1));
1517     }
1518 
1519     private static byte[]
1520     bothToArray(ByteVector a, ByteVector b) {
1521         byte[] r = new byte[a.length() + b.length()];
1522         a.intoArray(r, 0);
1523         b.intoArray(r, a.length());
1524         return r;
1525     }
1526 
1527     @Test
1528     static void smokeTest2() {
1529         // Do some zipping and shuffling.
1530         ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1);
1531         ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector();
1532         Assert.assertEquals(io, io2);
1533         ByteVector a = io.add((byte)1); //[1,2]
1534         ByteVector b = a.neg();  //[-1,-2]
1535         byte[] abValues = bothToArray(a,b); //[1,2,-1,-2]
1536         VectorShuffle<Byte> zip0 = VectorShuffle.makeZip(SPECIES, 0);
1537         VectorShuffle<Byte> zip1 = VectorShuffle.makeZip(SPECIES, 1);
1538         ByteVector zab0 = a.rearrange(zip0,b); //[1,-1]
1539         ByteVector zab1 = a.rearrange(zip1,b); //[2,-2]
1540         byte[] zabValues = bothToArray(zab0, zab1); //[1,-1,2,-2]
1541         // manually zip
1542         byte[] manual = new byte[zabValues.length];
1543         for (int i = 0; i < manual.length; i += 2) {
1544             manual[i+0] = abValues[i/2];
1545             manual[i+1] = abValues[a.length() + i/2];
1546         }
1547         Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual));
1548         VectorShuffle<Byte> unz0 = VectorShuffle.makeUnzip(SPECIES, 0);
1549         VectorShuffle<Byte> unz1 = VectorShuffle.makeUnzip(SPECIES, 1);
1550         ByteVector uab0 = zab0.rearrange(unz0,zab1);
1551         ByteVector uab1 = zab0.rearrange(unz1,zab1);
1552         byte[] abValues1 = bothToArray(uab0, uab1);
1553         Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1));
1554     }
1555 
1556     static void iotaShuffle() {
1557         ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1);
1558         ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector();
1559         Assert.assertEquals(io, io2);
1560     }
1561 
1562     @Test
1563     // Test all shuffle related operations.
1564     static void shuffleTest() {
1565         // To test backend instructions, make sure that C2 is used.
1566         for (int loop = 0; loop < INVOC_COUNT * INVOC_COUNT; loop++) {
1567             iotaShuffle();
1568         }
1569     }
1570 
1571     @Test
1572     void viewAsIntegeralLanesTest() {
1573         Vector<?> asIntegral = SPECIES.zero().viewAsIntegralLanes();
1574         Assert.assertEquals(asIntegral.species(), SPECIES);
1575     }
1576 
1577     @Test(expectedExceptions = UnsupportedOperationException.class)
1578     void viewAsFloatingLanesTest() {
1579         SPECIES.zero().viewAsFloatingLanes();
1580     }
1581 
1582     @Test
1583     // Test div by 0.
1584     static void bitwiseDivByZeroSmokeTest() {
1585         try {
1586             ByteVector a = (ByteVector) SPECIES.broadcast(0).addIndex(1);
1587             ByteVector b = (ByteVector) SPECIES.broadcast(0);
1588             a.div(b);
1589             Assert.fail();
1590         } catch (ArithmeticException e) {
1591         }
1592 
1593         try {
1594             ByteVector a = (ByteVector) SPECIES.broadcast(0).addIndex(1);
1595             ByteVector b = (ByteVector) SPECIES.broadcast(0);
1596             VectorMask<Byte> m = a.lt((byte) 1);
1597             a.div(b, m);
1598             Assert.fail();
1599         } catch (ArithmeticException e) {
1600         }
1601     }
1602 
1603     static byte ADD(byte a, byte b) {
1604         return (byte)(a + b);
1605     }
1606 
1607     @Test(dataProvider = "byteBinaryOpProvider")
1608     static void ADDByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1609         byte[] a = fa.apply(SPECIES.length());
1610         byte[] b = fb.apply(SPECIES.length());
1611         byte[] r = fr.apply(SPECIES.length());
1612 
1613         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1614             for (int i = 0; i < a.length; i += SPECIES.length()) {
1615                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1616                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1617                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1618             }
1619         }
1620 
1621         assertArraysEquals(r, a, b, Byte128VectorTests::ADD);
1622     }
1623 
1624     static byte add(byte a, byte b) {
1625         return (byte)(a + b);
1626     }
1627 
1628     @Test(dataProvider = "byteBinaryOpProvider")
1629     static void addByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1630         byte[] a = fa.apply(SPECIES.length());
1631         byte[] b = fb.apply(SPECIES.length());
1632         byte[] r = fr.apply(SPECIES.length());
1633 
1634         for (int i = 0; i < a.length; i += SPECIES.length()) {
1635             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1636             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1637             av.add(bv).intoArray(r, i);
1638         }
1639 
1640         assertArraysEquals(r, a, b, Byte128VectorTests::add);
1641     }
1642 
1643     @Test(dataProvider = "byteBinaryOpMaskProvider")
1644     static void ADDByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1645                                           IntFunction<boolean[]> fm) {
1646         byte[] a = fa.apply(SPECIES.length());
1647         byte[] b = fb.apply(SPECIES.length());
1648         byte[] r = fr.apply(SPECIES.length());
1649         boolean[] mask = fm.apply(SPECIES.length());
1650         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1651 
1652         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1653             for (int i = 0; i < a.length; i += SPECIES.length()) {
1654                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1655                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1656                 av.lanewise(VectorOperators.ADD, bv, vmask).intoArray(r, i);
1657             }
1658         }
1659 
1660         assertArraysEquals(r, a, b, mask, Byte128VectorTests::ADD);
1661     }
1662 
1663     @Test(dataProvider = "byteBinaryOpMaskProvider")
1664     static void addByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1665                                           IntFunction<boolean[]> fm) {
1666         byte[] a = fa.apply(SPECIES.length());
1667         byte[] b = fb.apply(SPECIES.length());
1668         byte[] r = fr.apply(SPECIES.length());
1669         boolean[] mask = fm.apply(SPECIES.length());
1670         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1671 
1672         for (int i = 0; i < a.length; i += SPECIES.length()) {
1673             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1674             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1675             av.add(bv, vmask).intoArray(r, i);
1676         }
1677 
1678         assertArraysEquals(r, a, b, mask, Byte128VectorTests::add);
1679     }
1680 
1681     static byte SUB(byte a, byte b) {
1682         return (byte)(a - b);
1683     }
1684 
1685     @Test(dataProvider = "byteBinaryOpProvider")
1686     static void SUBByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1687         byte[] a = fa.apply(SPECIES.length());
1688         byte[] b = fb.apply(SPECIES.length());
1689         byte[] r = fr.apply(SPECIES.length());
1690 
1691         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1692             for (int i = 0; i < a.length; i += SPECIES.length()) {
1693                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1694                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1695                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1696             }
1697         }
1698 
1699         assertArraysEquals(r, a, b, Byte128VectorTests::SUB);
1700     }
1701 
1702     static byte sub(byte a, byte b) {
1703         return (byte)(a - b);
1704     }
1705 
1706     @Test(dataProvider = "byteBinaryOpProvider")
1707     static void subByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1708         byte[] a = fa.apply(SPECIES.length());
1709         byte[] b = fb.apply(SPECIES.length());
1710         byte[] r = fr.apply(SPECIES.length());
1711 
1712         for (int i = 0; i < a.length; i += SPECIES.length()) {
1713             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1714             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1715             av.sub(bv).intoArray(r, i);
1716         }
1717 
1718         assertArraysEquals(r, a, b, Byte128VectorTests::sub);
1719     }
1720 
1721     @Test(dataProvider = "byteBinaryOpMaskProvider")
1722     static void SUBByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1723                                           IntFunction<boolean[]> fm) {
1724         byte[] a = fa.apply(SPECIES.length());
1725         byte[] b = fb.apply(SPECIES.length());
1726         byte[] r = fr.apply(SPECIES.length());
1727         boolean[] mask = fm.apply(SPECIES.length());
1728         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1729 
1730         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1731             for (int i = 0; i < a.length; i += SPECIES.length()) {
1732                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1733                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1734                 av.lanewise(VectorOperators.SUB, bv, vmask).intoArray(r, i);
1735             }
1736         }
1737 
1738         assertArraysEquals(r, a, b, mask, Byte128VectorTests::SUB);
1739     }
1740 
1741     @Test(dataProvider = "byteBinaryOpMaskProvider")
1742     static void subByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1743                                           IntFunction<boolean[]> fm) {
1744         byte[] a = fa.apply(SPECIES.length());
1745         byte[] b = fb.apply(SPECIES.length());
1746         byte[] r = fr.apply(SPECIES.length());
1747         boolean[] mask = fm.apply(SPECIES.length());
1748         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1749 
1750         for (int i = 0; i < a.length; i += SPECIES.length()) {
1751             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1752             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1753             av.sub(bv, vmask).intoArray(r, i);
1754         }
1755 
1756         assertArraysEquals(r, a, b, mask, Byte128VectorTests::sub);
1757     }
1758 
1759     static byte MUL(byte a, byte b) {
1760         return (byte)(a * b);
1761     }
1762 
1763     @Test(dataProvider = "byteBinaryOpProvider")
1764     static void MULByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1765         byte[] a = fa.apply(SPECIES.length());
1766         byte[] b = fb.apply(SPECIES.length());
1767         byte[] r = fr.apply(SPECIES.length());
1768 
1769         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1770             for (int i = 0; i < a.length; i += SPECIES.length()) {
1771                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1772                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1773                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1774             }
1775         }
1776 
1777         assertArraysEquals(r, a, b, Byte128VectorTests::MUL);
1778     }
1779 
1780     static byte mul(byte a, byte b) {
1781         return (byte)(a * b);
1782     }
1783 
1784     @Test(dataProvider = "byteBinaryOpProvider")
1785     static void mulByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1786         byte[] a = fa.apply(SPECIES.length());
1787         byte[] b = fb.apply(SPECIES.length());
1788         byte[] r = fr.apply(SPECIES.length());
1789 
1790         for (int i = 0; i < a.length; i += SPECIES.length()) {
1791             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1792             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1793             av.mul(bv).intoArray(r, i);
1794         }
1795 
1796         assertArraysEquals(r, a, b, Byte128VectorTests::mul);
1797     }
1798 
1799     @Test(dataProvider = "byteBinaryOpMaskProvider")
1800     static void MULByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1801                                           IntFunction<boolean[]> fm) {
1802         byte[] a = fa.apply(SPECIES.length());
1803         byte[] b = fb.apply(SPECIES.length());
1804         byte[] r = fr.apply(SPECIES.length());
1805         boolean[] mask = fm.apply(SPECIES.length());
1806         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1807 
1808         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1809             for (int i = 0; i < a.length; i += SPECIES.length()) {
1810                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1811                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1812                 av.lanewise(VectorOperators.MUL, bv, vmask).intoArray(r, i);
1813             }
1814         }
1815 
1816         assertArraysEquals(r, a, b, mask, Byte128VectorTests::MUL);
1817     }
1818 
1819     @Test(dataProvider = "byteBinaryOpMaskProvider")
1820     static void mulByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1821                                           IntFunction<boolean[]> fm) {
1822         byte[] a = fa.apply(SPECIES.length());
1823         byte[] b = fb.apply(SPECIES.length());
1824         byte[] r = fr.apply(SPECIES.length());
1825         boolean[] mask = fm.apply(SPECIES.length());
1826         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1827 
1828         for (int i = 0; i < a.length; i += SPECIES.length()) {
1829             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1830             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1831             av.mul(bv, vmask).intoArray(r, i);
1832         }
1833 
1834         assertArraysEquals(r, a, b, mask, Byte128VectorTests::mul);
1835     }
1836 
1837     static byte DIV(byte a, byte b) {
1838         return (byte)(a / b);
1839     }
1840 
1841     @Test(dataProvider = "byteBinaryOpProvider")
1842     static void DIVByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1843         byte[] a = fa.apply(SPECIES.length());
1844         byte[] b = fb.apply(SPECIES.length());
1845         byte[] r = fr.apply(SPECIES.length());
1846 
1847         replaceZero(b, (byte) 1);
1848 
1849         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1850             for (int i = 0; i < a.length; i += SPECIES.length()) {
1851                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1852                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1853                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
1854             }
1855         }
1856 
1857         assertArraysEquals(r, a, b, Byte128VectorTests::DIV);
1858     }
1859 
1860     static byte div(byte a, byte b) {
1861         return (byte)(a / b);
1862     }
1863 
1864     @Test(dataProvider = "byteBinaryOpProvider")
1865     static void divByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1866         byte[] a = fa.apply(SPECIES.length());
1867         byte[] b = fb.apply(SPECIES.length());
1868         byte[] r = fr.apply(SPECIES.length());
1869 
1870         replaceZero(b, (byte) 1);
1871 
1872         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1873             for (int i = 0; i < a.length; i += SPECIES.length()) {
1874                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1875                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1876                 av.div(bv).intoArray(r, i);
1877             }
1878         }
1879 
1880         assertArraysEquals(r, a, b, Byte128VectorTests::div);
1881     }
1882 
1883     @Test(dataProvider = "byteBinaryOpMaskProvider")
1884     static void DIVByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1885                                           IntFunction<boolean[]> fm) {
1886         byte[] a = fa.apply(SPECIES.length());
1887         byte[] b = fb.apply(SPECIES.length());
1888         byte[] r = fr.apply(SPECIES.length());
1889         boolean[] mask = fm.apply(SPECIES.length());
1890         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1891 
1892         replaceZero(b, mask, (byte) 1);
1893 
1894         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1895             for (int i = 0; i < a.length; i += SPECIES.length()) {
1896                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1897                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1898                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1899             }
1900         }
1901 
1902         assertArraysEquals(r, a, b, mask, Byte128VectorTests::DIV);
1903     }
1904 
1905     @Test(dataProvider = "byteBinaryOpMaskProvider")
1906     static void divByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1907                                           IntFunction<boolean[]> fm) {
1908         byte[] a = fa.apply(SPECIES.length());
1909         byte[] b = fb.apply(SPECIES.length());
1910         byte[] r = fr.apply(SPECIES.length());
1911         boolean[] mask = fm.apply(SPECIES.length());
1912         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1913 
1914         replaceZero(b, mask, (byte) 1);
1915 
1916         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1917             for (int i = 0; i < a.length; i += SPECIES.length()) {
1918                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1919                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1920                 av.div(bv, vmask).intoArray(r, i);
1921             }
1922         }
1923 
1924         assertArraysEquals(r, a, b, mask, Byte128VectorTests::div);
1925     }
1926 
1927     static byte FIRST_NONZERO(byte a, byte b) {
1928         return (byte)((a)!=0?a:b);
1929     }
1930 
1931     @Test(dataProvider = "byteBinaryOpProvider")
1932     static void FIRST_NONZEROByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1933         byte[] a = fa.apply(SPECIES.length());
1934         byte[] b = fb.apply(SPECIES.length());
1935         byte[] r = fr.apply(SPECIES.length());
1936 
1937         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1938             for (int i = 0; i < a.length; i += SPECIES.length()) {
1939                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1940                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1941                 av.lanewise(VectorOperators.FIRST_NONZERO, bv).intoArray(r, i);
1942             }
1943         }
1944 
1945         assertArraysEquals(r, a, b, Byte128VectorTests::FIRST_NONZERO);
1946     }
1947 
1948     @Test(dataProvider = "byteBinaryOpMaskProvider")
1949     static void FIRST_NONZEROByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
1950                                           IntFunction<boolean[]> fm) {
1951         byte[] a = fa.apply(SPECIES.length());
1952         byte[] b = fb.apply(SPECIES.length());
1953         byte[] r = fr.apply(SPECIES.length());
1954         boolean[] mask = fm.apply(SPECIES.length());
1955         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1956 
1957         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1958             for (int i = 0; i < a.length; i += SPECIES.length()) {
1959                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1960                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1961                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1962             }
1963         }
1964 
1965         assertArraysEquals(r, a, b, mask, Byte128VectorTests::FIRST_NONZERO);
1966     }
1967 
1968     static byte AND(byte a, byte b) {
1969         return (byte)(a & b);
1970     }
1971 
1972     @Test(dataProvider = "byteBinaryOpProvider")
1973     static void ANDByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1974         byte[] a = fa.apply(SPECIES.length());
1975         byte[] b = fb.apply(SPECIES.length());
1976         byte[] r = fr.apply(SPECIES.length());
1977 
1978         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1979             for (int i = 0; i < a.length; i += SPECIES.length()) {
1980                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
1981                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
1982                 av.lanewise(VectorOperators.AND, bv).intoArray(r, i);
1983             }
1984         }
1985 
1986         assertArraysEquals(r, a, b, Byte128VectorTests::AND);
1987     }
1988 
1989     static byte and(byte a, byte b) {
1990         return (byte)(a & b);
1991     }
1992 
1993     @Test(dataProvider = "byteBinaryOpProvider")
1994     static void andByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
1995         byte[] a = fa.apply(SPECIES.length());
1996         byte[] b = fb.apply(SPECIES.length());
1997         byte[] r = fr.apply(SPECIES.length());
1998 
1999         for (int i = 0; i < a.length; i += SPECIES.length()) {
2000             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2001             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2002             av.and(bv).intoArray(r, i);
2003         }
2004 
2005         assertArraysEquals(r, a, b, Byte128VectorTests::and);
2006     }
2007 
2008     @Test(dataProvider = "byteBinaryOpMaskProvider")
2009     static void ANDByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2010                                           IntFunction<boolean[]> fm) {
2011         byte[] a = fa.apply(SPECIES.length());
2012         byte[] b = fb.apply(SPECIES.length());
2013         byte[] r = fr.apply(SPECIES.length());
2014         boolean[] mask = fm.apply(SPECIES.length());
2015         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2016 
2017         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2018             for (int i = 0; i < a.length; i += SPECIES.length()) {
2019                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2020                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2021                 av.lanewise(VectorOperators.AND, bv, vmask).intoArray(r, i);
2022             }
2023         }
2024 
2025         assertArraysEquals(r, a, b, mask, Byte128VectorTests::AND);
2026     }
2027 
2028     static byte AND_NOT(byte a, byte b) {
2029         return (byte)(a & ~b);
2030     }
2031 
2032     @Test(dataProvider = "byteBinaryOpProvider")
2033     static void AND_NOTByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2034         byte[] a = fa.apply(SPECIES.length());
2035         byte[] b = fb.apply(SPECIES.length());
2036         byte[] r = fr.apply(SPECIES.length());
2037 
2038         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2039             for (int i = 0; i < a.length; i += SPECIES.length()) {
2040                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2041                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2042                 av.lanewise(VectorOperators.AND_NOT, bv).intoArray(r, i);
2043             }
2044         }
2045 
2046         assertArraysEquals(r, a, b, Byte128VectorTests::AND_NOT);
2047     }
2048 
2049     @Test(dataProvider = "byteBinaryOpMaskProvider")
2050     static void AND_NOTByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2051                                           IntFunction<boolean[]> fm) {
2052         byte[] a = fa.apply(SPECIES.length());
2053         byte[] b = fb.apply(SPECIES.length());
2054         byte[] r = fr.apply(SPECIES.length());
2055         boolean[] mask = fm.apply(SPECIES.length());
2056         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2057 
2058         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2059             for (int i = 0; i < a.length; i += SPECIES.length()) {
2060                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2061                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2062                 av.lanewise(VectorOperators.AND_NOT, bv, vmask).intoArray(r, i);
2063             }
2064         }
2065 
2066         assertArraysEquals(r, a, b, mask, Byte128VectorTests::AND_NOT);
2067     }
2068 
2069     static byte OR(byte a, byte b) {
2070         return (byte)(a | b);
2071     }
2072 
2073     @Test(dataProvider = "byteBinaryOpProvider")
2074     static void ORByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2075         byte[] a = fa.apply(SPECIES.length());
2076         byte[] b = fb.apply(SPECIES.length());
2077         byte[] r = fr.apply(SPECIES.length());
2078 
2079         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2080             for (int i = 0; i < a.length; i += SPECIES.length()) {
2081                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2082                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2083                 av.lanewise(VectorOperators.OR, bv).intoArray(r, i);
2084             }
2085         }
2086 
2087         assertArraysEquals(r, a, b, Byte128VectorTests::OR);
2088     }
2089 
2090     static byte or(byte a, byte b) {
2091         return (byte)(a | b);
2092     }
2093 
2094     @Test(dataProvider = "byteBinaryOpProvider")
2095     static void orByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2096         byte[] a = fa.apply(SPECIES.length());
2097         byte[] b = fb.apply(SPECIES.length());
2098         byte[] r = fr.apply(SPECIES.length());
2099 
2100         for (int i = 0; i < a.length; i += SPECIES.length()) {
2101             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2102             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2103             av.or(bv).intoArray(r, i);
2104         }
2105 
2106         assertArraysEquals(r, a, b, Byte128VectorTests::or);
2107     }
2108 
2109     @Test(dataProvider = "byteBinaryOpMaskProvider")
2110     static void ORByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2111                                           IntFunction<boolean[]> fm) {
2112         byte[] a = fa.apply(SPECIES.length());
2113         byte[] b = fb.apply(SPECIES.length());
2114         byte[] r = fr.apply(SPECIES.length());
2115         boolean[] mask = fm.apply(SPECIES.length());
2116         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2117 
2118         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2119             for (int i = 0; i < a.length; i += SPECIES.length()) {
2120                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2121                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2122                 av.lanewise(VectorOperators.OR, bv, vmask).intoArray(r, i);
2123             }
2124         }
2125 
2126         assertArraysEquals(r, a, b, mask, Byte128VectorTests::OR);
2127     }
2128 
2129     static byte XOR(byte a, byte b) {
2130         return (byte)(a ^ b);
2131     }
2132 
2133     @Test(dataProvider = "byteBinaryOpProvider")
2134     static void XORByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2135         byte[] a = fa.apply(SPECIES.length());
2136         byte[] b = fb.apply(SPECIES.length());
2137         byte[] r = fr.apply(SPECIES.length());
2138 
2139         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2140             for (int i = 0; i < a.length; i += SPECIES.length()) {
2141                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2142                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2143                 av.lanewise(VectorOperators.XOR, bv).intoArray(r, i);
2144             }
2145         }
2146 
2147         assertArraysEquals(r, a, b, Byte128VectorTests::XOR);
2148     }
2149 
2150     @Test(dataProvider = "byteBinaryOpMaskProvider")
2151     static void XORByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2152                                           IntFunction<boolean[]> fm) {
2153         byte[] a = fa.apply(SPECIES.length());
2154         byte[] b = fb.apply(SPECIES.length());
2155         byte[] r = fr.apply(SPECIES.length());
2156         boolean[] mask = fm.apply(SPECIES.length());
2157         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2158 
2159         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2160             for (int i = 0; i < a.length; i += SPECIES.length()) {
2161                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2162                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2163                 av.lanewise(VectorOperators.XOR, bv, vmask).intoArray(r, i);
2164             }
2165         }
2166 
2167         assertArraysEquals(r, a, b, mask, Byte128VectorTests::XOR);
2168     }
2169 
2170     @Test(dataProvider = "byteBinaryOpProvider")
2171     static void addByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2172         byte[] a = fa.apply(SPECIES.length());
2173         byte[] b = fb.apply(SPECIES.length());
2174         byte[] r = fr.apply(SPECIES.length());
2175 
2176         for (int i = 0; i < a.length; i += SPECIES.length()) {
2177             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2178             av.add(b[i]).intoArray(r, i);
2179         }
2180 
2181         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::add);
2182     }
2183 
2184     @Test(dataProvider = "byteBinaryOpMaskProvider")
2185     static void addByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2186                                           IntFunction<boolean[]> fm) {
2187         byte[] a = fa.apply(SPECIES.length());
2188         byte[] b = fb.apply(SPECIES.length());
2189         byte[] r = fr.apply(SPECIES.length());
2190         boolean[] mask = fm.apply(SPECIES.length());
2191         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2192 
2193         for (int i = 0; i < a.length; i += SPECIES.length()) {
2194             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2195             av.add(b[i], vmask).intoArray(r, i);
2196         }
2197 
2198         assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::add);
2199     }
2200 
2201     @Test(dataProvider = "byteBinaryOpProvider")
2202     static void subByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2203         byte[] a = fa.apply(SPECIES.length());
2204         byte[] b = fb.apply(SPECIES.length());
2205         byte[] r = fr.apply(SPECIES.length());
2206 
2207         for (int i = 0; i < a.length; i += SPECIES.length()) {
2208             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2209             av.sub(b[i]).intoArray(r, i);
2210         }
2211 
2212         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::sub);
2213     }
2214 
2215     @Test(dataProvider = "byteBinaryOpMaskProvider")
2216     static void subByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2217                                           IntFunction<boolean[]> fm) {
2218         byte[] a = fa.apply(SPECIES.length());
2219         byte[] b = fb.apply(SPECIES.length());
2220         byte[] r = fr.apply(SPECIES.length());
2221         boolean[] mask = fm.apply(SPECIES.length());
2222         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2223 
2224         for (int i = 0; i < a.length; i += SPECIES.length()) {
2225             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2226             av.sub(b[i], vmask).intoArray(r, i);
2227         }
2228 
2229         assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::sub);
2230     }
2231 
2232     @Test(dataProvider = "byteBinaryOpProvider")
2233     static void mulByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2234         byte[] a = fa.apply(SPECIES.length());
2235         byte[] b = fb.apply(SPECIES.length());
2236         byte[] r = fr.apply(SPECIES.length());
2237 
2238         for (int i = 0; i < a.length; i += SPECIES.length()) {
2239             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2240             av.mul(b[i]).intoArray(r, i);
2241         }
2242 
2243         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::mul);
2244     }
2245 
2246     @Test(dataProvider = "byteBinaryOpMaskProvider")
2247     static void mulByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2248                                           IntFunction<boolean[]> fm) {
2249         byte[] a = fa.apply(SPECIES.length());
2250         byte[] b = fb.apply(SPECIES.length());
2251         byte[] r = fr.apply(SPECIES.length());
2252         boolean[] mask = fm.apply(SPECIES.length());
2253         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2254 
2255         for (int i = 0; i < a.length; i += SPECIES.length()) {
2256             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2257             av.mul(b[i], vmask).intoArray(r, i);
2258         }
2259 
2260         assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::mul);
2261     }
2262 
2263     @Test(dataProvider = "byteBinaryOpProvider")
2264     static void divByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2265         byte[] a = fa.apply(SPECIES.length());
2266         byte[] b = fb.apply(SPECIES.length());
2267         byte[] r = fr.apply(SPECIES.length());
2268 
2269         replaceZero(b, (byte) 1);
2270 
2271         for (int i = 0; i < a.length; i += SPECIES.length()) {
2272             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2273             av.div(b[i]).intoArray(r, i);
2274         }
2275 
2276         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::div);
2277     }
2278 
2279     @Test(dataProvider = "byteBinaryOpMaskProvider")
2280     static void divByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2281                                           IntFunction<boolean[]> fm) {
2282         byte[] a = fa.apply(SPECIES.length());
2283         byte[] b = fb.apply(SPECIES.length());
2284         byte[] r = fr.apply(SPECIES.length());
2285         boolean[] mask = fm.apply(SPECIES.length());
2286         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2287 
2288         replaceZero(b, (byte) 1);
2289 
2290         for (int i = 0; i < a.length; i += SPECIES.length()) {
2291             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2292             av.div(b[i], vmask).intoArray(r, i);
2293         }
2294 
2295         assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::div);
2296     }
2297 
2298     @Test(dataProvider = "byteBinaryOpProvider")
2299     static void ORByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2300         byte[] a = fa.apply(SPECIES.length());
2301         byte[] b = fb.apply(SPECIES.length());
2302         byte[] r = fr.apply(SPECIES.length());
2303 
2304         for (int i = 0; i < a.length; i += SPECIES.length()) {
2305             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2306             av.lanewise(VectorOperators.OR, b[i]).intoArray(r, i);
2307         }
2308 
2309         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::OR);
2310     }
2311 
2312     @Test(dataProvider = "byteBinaryOpProvider")
2313     static void orByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2314         byte[] a = fa.apply(SPECIES.length());
2315         byte[] b = fb.apply(SPECIES.length());
2316         byte[] r = fr.apply(SPECIES.length());
2317 
2318         for (int i = 0; i < a.length; i += SPECIES.length()) {
2319             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2320             av.or(b[i]).intoArray(r, i);
2321         }
2322 
2323         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::or);
2324     }
2325 
2326     @Test(dataProvider = "byteBinaryOpMaskProvider")
2327     static void ORByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2328                                           IntFunction<boolean[]> fm) {
2329         byte[] a = fa.apply(SPECIES.length());
2330         byte[] b = fb.apply(SPECIES.length());
2331         byte[] r = fr.apply(SPECIES.length());
2332         boolean[] mask = fm.apply(SPECIES.length());
2333         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2334 
2335         for (int i = 0; i < a.length; i += SPECIES.length()) {
2336             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2337             av.lanewise(VectorOperators.OR, b[i], vmask).intoArray(r, i);
2338         }
2339 
2340         assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::OR);
2341     }
2342 
2343     @Test(dataProvider = "byteBinaryOpProvider")
2344     static void ANDByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2345         byte[] a = fa.apply(SPECIES.length());
2346         byte[] b = fb.apply(SPECIES.length());
2347         byte[] r = fr.apply(SPECIES.length());
2348 
2349         for (int i = 0; i < a.length; i += SPECIES.length()) {
2350             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2351             av.lanewise(VectorOperators.AND, b[i]).intoArray(r, i);
2352         }
2353 
2354         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::AND);
2355     }
2356 
2357     @Test(dataProvider = "byteBinaryOpProvider")
2358     static void andByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2359         byte[] a = fa.apply(SPECIES.length());
2360         byte[] b = fb.apply(SPECIES.length());
2361         byte[] r = fr.apply(SPECIES.length());
2362 
2363         for (int i = 0; i < a.length; i += SPECIES.length()) {
2364             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2365             av.and(b[i]).intoArray(r, i);
2366         }
2367 
2368         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::and);
2369     }
2370 
2371     @Test(dataProvider = "byteBinaryOpMaskProvider")
2372     static void ANDByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2373                                           IntFunction<boolean[]> fm) {
2374         byte[] a = fa.apply(SPECIES.length());
2375         byte[] b = fb.apply(SPECIES.length());
2376         byte[] r = fr.apply(SPECIES.length());
2377         boolean[] mask = fm.apply(SPECIES.length());
2378         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2379 
2380         for (int i = 0; i < a.length; i += SPECIES.length()) {
2381             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2382             av.lanewise(VectorOperators.AND, b[i], vmask).intoArray(r, i);
2383         }
2384 
2385         assertBroadcastArraysEquals(r, a, b, mask, Byte128VectorTests::AND);
2386     }
2387 
2388     @Test(dataProvider = "byteBinaryOpProvider")
2389     static void ORByte128VectorTestsBroadcastLongSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2390         byte[] a = fa.apply(SPECIES.length());
2391         byte[] b = fb.apply(SPECIES.length());
2392         byte[] r = fr.apply(SPECIES.length());
2393 
2394         for (int i = 0; i < a.length; i += SPECIES.length()) {
2395             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2396             av.lanewise(VectorOperators.OR, (long)b[i]).intoArray(r, i);
2397         }
2398 
2399         assertBroadcastLongArraysEquals(r, a, b, Byte128VectorTests::OR);
2400     }
2401 
2402     @Test(dataProvider = "byteBinaryOpMaskProvider")
2403     static void ORByte128VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2404                                           IntFunction<boolean[]> fm) {
2405         byte[] a = fa.apply(SPECIES.length());
2406         byte[] b = fb.apply(SPECIES.length());
2407         byte[] r = fr.apply(SPECIES.length());
2408         boolean[] mask = fm.apply(SPECIES.length());
2409         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2410 
2411         for (int i = 0; i < a.length; i += SPECIES.length()) {
2412             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2413             av.lanewise(VectorOperators.OR, (long)b[i], vmask).intoArray(r, i);
2414         }
2415 
2416         assertBroadcastLongArraysEquals(r, a, b, mask, Byte128VectorTests::OR);
2417     }
2418 
2419     @Test(dataProvider = "byteBinaryOpProvider")
2420     static void ADDByte128VectorTestsBroadcastLongSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2421         byte[] a = fa.apply(SPECIES.length());
2422         byte[] b = fb.apply(SPECIES.length());
2423         byte[] r = fr.apply(SPECIES.length());
2424 
2425         for (int i = 0; i < a.length; i += SPECIES.length()) {
2426             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2427             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
2428         }
2429 
2430         assertBroadcastLongArraysEquals(r, a, b, Byte128VectorTests::ADD);
2431     }
2432 
2433     @Test(dataProvider = "byteBinaryOpMaskProvider")
2434     static void ADDByte128VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2435                                           IntFunction<boolean[]> fm) {
2436         byte[] a = fa.apply(SPECIES.length());
2437         byte[] b = fb.apply(SPECIES.length());
2438         byte[] r = fr.apply(SPECIES.length());
2439         boolean[] mask = fm.apply(SPECIES.length());
2440         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2441 
2442         for (int i = 0; i < a.length; i += SPECIES.length()) {
2443             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2444             av.lanewise(VectorOperators.ADD, (long)b[i], vmask).intoArray(r, i);
2445         }
2446 
2447         assertBroadcastLongArraysEquals(r, a, b, mask, Byte128VectorTests::ADD);
2448     }
2449 
2450     static byte LSHL(byte a, byte b) {
2451         return (byte)((a << (b & 0x7)));
2452     }
2453 
2454     @Test(dataProvider = "byteBinaryOpProvider")
2455     static void LSHLByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2456         byte[] a = fa.apply(SPECIES.length());
2457         byte[] b = fb.apply(SPECIES.length());
2458         byte[] r = fr.apply(SPECIES.length());
2459 
2460         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2461             for (int i = 0; i < a.length; i += SPECIES.length()) {
2462                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2463                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2464                 av.lanewise(VectorOperators.LSHL, bv).intoArray(r, i);
2465             }
2466         }
2467 
2468         assertArraysEquals(r, a, b, Byte128VectorTests::LSHL);
2469     }
2470 
2471     @Test(dataProvider = "byteBinaryOpMaskProvider")
2472     static void LSHLByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2473                                           IntFunction<boolean[]> fm) {
2474         byte[] a = fa.apply(SPECIES.length());
2475         byte[] b = fb.apply(SPECIES.length());
2476         byte[] r = fr.apply(SPECIES.length());
2477         boolean[] mask = fm.apply(SPECIES.length());
2478         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2479 
2480         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2481             for (int i = 0; i < a.length; i += SPECIES.length()) {
2482                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2483                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2484                 av.lanewise(VectorOperators.LSHL, bv, vmask).intoArray(r, i);
2485             }
2486         }
2487 
2488         assertArraysEquals(r, a, b, mask, Byte128VectorTests::LSHL);
2489     }
2490 
2491     static byte ASHR(byte a, byte b) {
2492         return (byte)((a >> (b & 0x7)));
2493     }
2494 
2495     @Test(dataProvider = "byteBinaryOpProvider")
2496     static void ASHRByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2497         byte[] a = fa.apply(SPECIES.length());
2498         byte[] b = fb.apply(SPECIES.length());
2499         byte[] r = fr.apply(SPECIES.length());
2500 
2501         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2502             for (int i = 0; i < a.length; i += SPECIES.length()) {
2503                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2504                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2505                 av.lanewise(VectorOperators.ASHR, bv).intoArray(r, i);
2506             }
2507         }
2508 
2509         assertArraysEquals(r, a, b, Byte128VectorTests::ASHR);
2510     }
2511 
2512     @Test(dataProvider = "byteBinaryOpMaskProvider")
2513     static void ASHRByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2514                                           IntFunction<boolean[]> fm) {
2515         byte[] a = fa.apply(SPECIES.length());
2516         byte[] b = fb.apply(SPECIES.length());
2517         byte[] r = fr.apply(SPECIES.length());
2518         boolean[] mask = fm.apply(SPECIES.length());
2519         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2520 
2521         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2522             for (int i = 0; i < a.length; i += SPECIES.length()) {
2523                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2524                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2525                 av.lanewise(VectorOperators.ASHR, bv, vmask).intoArray(r, i);
2526             }
2527         }
2528 
2529         assertArraysEquals(r, a, b, mask, Byte128VectorTests::ASHR);
2530     }
2531 
2532     static byte LSHR(byte a, byte b) {
2533         return (byte)(((a & 0xFF) >>> (b & 0x7)));
2534     }
2535 
2536     @Test(dataProvider = "byteBinaryOpProvider")
2537     static void LSHRByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2538         byte[] a = fa.apply(SPECIES.length());
2539         byte[] b = fb.apply(SPECIES.length());
2540         byte[] r = fr.apply(SPECIES.length());
2541 
2542         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2543             for (int i = 0; i < a.length; i += SPECIES.length()) {
2544                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2545                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2546                 av.lanewise(VectorOperators.LSHR, bv).intoArray(r, i);
2547             }
2548         }
2549 
2550         assertArraysEquals(r, a, b, Byte128VectorTests::LSHR);
2551     }
2552 
2553     @Test(dataProvider = "byteBinaryOpMaskProvider")
2554     static void LSHRByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2555                                           IntFunction<boolean[]> fm) {
2556         byte[] a = fa.apply(SPECIES.length());
2557         byte[] b = fb.apply(SPECIES.length());
2558         byte[] r = fr.apply(SPECIES.length());
2559         boolean[] mask = fm.apply(SPECIES.length());
2560         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2561 
2562         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2563             for (int i = 0; i < a.length; i += SPECIES.length()) {
2564                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2565                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2566                 av.lanewise(VectorOperators.LSHR, bv, vmask).intoArray(r, i);
2567             }
2568         }
2569 
2570         assertArraysEquals(r, a, b, mask, Byte128VectorTests::LSHR);
2571     }
2572 
2573     static byte LSHL_unary(byte a, byte b) {
2574         return (byte)((a << (b & 7)));
2575     }
2576 
2577     @Test(dataProvider = "byteBinaryOpProvider")
2578     static void LSHLByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2579         byte[] a = fa.apply(SPECIES.length());
2580         byte[] b = fb.apply(SPECIES.length());
2581         byte[] r = fr.apply(SPECIES.length());
2582 
2583         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2584             for (int i = 0; i < a.length; i += SPECIES.length()) {
2585                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2586                 av.lanewise(VectorOperators.LSHL, (int)b[i]).intoArray(r, i);
2587             }
2588         }
2589 
2590         assertShiftArraysEquals(r, a, b, Byte128VectorTests::LSHL_unary);
2591     }
2592 
2593     @Test(dataProvider = "byteBinaryOpMaskProvider")
2594     static void LSHLByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2595                                           IntFunction<boolean[]> fm) {
2596         byte[] a = fa.apply(SPECIES.length());
2597         byte[] b = fb.apply(SPECIES.length());
2598         byte[] r = fr.apply(SPECIES.length());
2599         boolean[] mask = fm.apply(SPECIES.length());
2600         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2601 
2602         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2603             for (int i = 0; i < a.length; i += SPECIES.length()) {
2604                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2605                 av.lanewise(VectorOperators.LSHL, (int)b[i], vmask).intoArray(r, i);
2606             }
2607         }
2608 
2609         assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::LSHL_unary);
2610     }
2611 
2612     static byte LSHR_unary(byte a, byte b) {
2613         return (byte)(((a & 0xFF) >>> (b & 7)));
2614     }
2615 
2616     @Test(dataProvider = "byteBinaryOpProvider")
2617     static void LSHRByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2618         byte[] a = fa.apply(SPECIES.length());
2619         byte[] b = fb.apply(SPECIES.length());
2620         byte[] r = fr.apply(SPECIES.length());
2621 
2622         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2623             for (int i = 0; i < a.length; i += SPECIES.length()) {
2624                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2625                 av.lanewise(VectorOperators.LSHR, (int)b[i]).intoArray(r, i);
2626             }
2627         }
2628 
2629         assertShiftArraysEquals(r, a, b, Byte128VectorTests::LSHR_unary);
2630     }
2631 
2632     @Test(dataProvider = "byteBinaryOpMaskProvider")
2633     static void LSHRByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2634                                           IntFunction<boolean[]> fm) {
2635         byte[] a = fa.apply(SPECIES.length());
2636         byte[] b = fb.apply(SPECIES.length());
2637         byte[] r = fr.apply(SPECIES.length());
2638         boolean[] mask = fm.apply(SPECIES.length());
2639         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2640 
2641         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2642             for (int i = 0; i < a.length; i += SPECIES.length()) {
2643                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2644                 av.lanewise(VectorOperators.LSHR, (int)b[i], vmask).intoArray(r, i);
2645             }
2646         }
2647 
2648         assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::LSHR_unary);
2649     }
2650 
2651     static byte ASHR_unary(byte a, byte b) {
2652         return (byte)((a >> (b & 7)));
2653     }
2654 
2655     @Test(dataProvider = "byteBinaryOpProvider")
2656     static void ASHRByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2657         byte[] a = fa.apply(SPECIES.length());
2658         byte[] b = fb.apply(SPECIES.length());
2659         byte[] r = fr.apply(SPECIES.length());
2660 
2661         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2662             for (int i = 0; i < a.length; i += SPECIES.length()) {
2663                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2664                 av.lanewise(VectorOperators.ASHR, (int)b[i]).intoArray(r, i);
2665             }
2666         }
2667 
2668         assertShiftArraysEquals(r, a, b, Byte128VectorTests::ASHR_unary);
2669     }
2670 
2671     @Test(dataProvider = "byteBinaryOpMaskProvider")
2672     static void ASHRByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2673                                           IntFunction<boolean[]> fm) {
2674         byte[] a = fa.apply(SPECIES.length());
2675         byte[] b = fb.apply(SPECIES.length());
2676         byte[] r = fr.apply(SPECIES.length());
2677         boolean[] mask = fm.apply(SPECIES.length());
2678         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2679 
2680         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2681             for (int i = 0; i < a.length; i += SPECIES.length()) {
2682                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2683                 av.lanewise(VectorOperators.ASHR, (int)b[i], vmask).intoArray(r, i);
2684             }
2685         }
2686 
2687         assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ASHR_unary);
2688     }
2689 
2690     static byte ROR(byte a, byte b) {
2691         return (byte)(ROR_scalar(a,b));
2692     }
2693 
2694     @Test(dataProvider = "byteBinaryOpProvider")
2695     static void RORByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2696         byte[] a = fa.apply(SPECIES.length());
2697         byte[] b = fb.apply(SPECIES.length());
2698         byte[] r = fr.apply(SPECIES.length());
2699 
2700         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2701             for (int i = 0; i < a.length; i += SPECIES.length()) {
2702                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2703                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2704                 av.lanewise(VectorOperators.ROR, bv).intoArray(r, i);
2705             }
2706         }
2707 
2708         assertArraysEquals(r, a, b, Byte128VectorTests::ROR);
2709     }
2710 
2711     @Test(dataProvider = "byteBinaryOpMaskProvider")
2712     static void RORByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2713                                           IntFunction<boolean[]> fm) {
2714         byte[] a = fa.apply(SPECIES.length());
2715         byte[] b = fb.apply(SPECIES.length());
2716         byte[] r = fr.apply(SPECIES.length());
2717         boolean[] mask = fm.apply(SPECIES.length());
2718         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2719 
2720         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2721             for (int i = 0; i < a.length; i += SPECIES.length()) {
2722                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2723                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2724                 av.lanewise(VectorOperators.ROR, bv, vmask).intoArray(r, i);
2725             }
2726         }
2727 
2728         assertArraysEquals(r, a, b, mask, Byte128VectorTests::ROR);
2729     }
2730 
2731     static byte ROL(byte a, byte b) {
2732         return (byte)(ROL_scalar(a,b));
2733     }
2734 
2735     @Test(dataProvider = "byteBinaryOpProvider")
2736     static void ROLByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2737         byte[] a = fa.apply(SPECIES.length());
2738         byte[] b = fb.apply(SPECIES.length());
2739         byte[] r = fr.apply(SPECIES.length());
2740 
2741         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2742             for (int i = 0; i < a.length; i += SPECIES.length()) {
2743                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2744                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2745                 av.lanewise(VectorOperators.ROL, bv).intoArray(r, i);
2746             }
2747         }
2748 
2749         assertArraysEquals(r, a, b, Byte128VectorTests::ROL);
2750     }
2751 
2752     @Test(dataProvider = "byteBinaryOpMaskProvider")
2753     static void ROLByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2754                                           IntFunction<boolean[]> fm) {
2755         byte[] a = fa.apply(SPECIES.length());
2756         byte[] b = fb.apply(SPECIES.length());
2757         byte[] r = fr.apply(SPECIES.length());
2758         boolean[] mask = fm.apply(SPECIES.length());
2759         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2760 
2761         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2762             for (int i = 0; i < a.length; i += SPECIES.length()) {
2763                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2764                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
2765                 av.lanewise(VectorOperators.ROL, bv, vmask).intoArray(r, i);
2766             }
2767         }
2768 
2769         assertArraysEquals(r, a, b, mask, Byte128VectorTests::ROL);
2770     }
2771 
2772     static byte ROR_unary(byte a, byte b) {
2773         return (byte)(ROR_scalar(a, b));
2774     }
2775 
2776     @Test(dataProvider = "byteBinaryOpProvider")
2777     static void RORByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2778         byte[] a = fa.apply(SPECIES.length());
2779         byte[] b = fb.apply(SPECIES.length());
2780         byte[] r = fr.apply(SPECIES.length());
2781 
2782         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2783             for (int i = 0; i < a.length; i += SPECIES.length()) {
2784                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2785                 av.lanewise(VectorOperators.ROR, (int)b[i]).intoArray(r, i);
2786             }
2787         }
2788 
2789         assertShiftArraysEquals(r, a, b, Byte128VectorTests::ROR_unary);
2790     }
2791 
2792     @Test(dataProvider = "byteBinaryOpMaskProvider")
2793     static void RORByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2794                                           IntFunction<boolean[]> fm) {
2795         byte[] a = fa.apply(SPECIES.length());
2796         byte[] b = fb.apply(SPECIES.length());
2797         byte[] r = fr.apply(SPECIES.length());
2798         boolean[] mask = fm.apply(SPECIES.length());
2799         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2800 
2801         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2802             for (int i = 0; i < a.length; i += SPECIES.length()) {
2803                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2804                 av.lanewise(VectorOperators.ROR, (int)b[i], vmask).intoArray(r, i);
2805             }
2806         }
2807 
2808         assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ROR_unary);
2809     }
2810 
2811     static byte ROL_unary(byte a, byte b) {
2812         return (byte)(ROL_scalar(a, b));
2813     }
2814 
2815     @Test(dataProvider = "byteBinaryOpProvider")
2816     static void ROLByte128VectorTestsScalarShift(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
2817         byte[] a = fa.apply(SPECIES.length());
2818         byte[] b = fb.apply(SPECIES.length());
2819         byte[] r = fr.apply(SPECIES.length());
2820 
2821         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2822             for (int i = 0; i < a.length; i += SPECIES.length()) {
2823                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2824                 av.lanewise(VectorOperators.ROL, (int)b[i]).intoArray(r, i);
2825             }
2826         }
2827 
2828         assertShiftArraysEquals(r, a, b, Byte128VectorTests::ROL_unary);
2829     }
2830 
2831     @Test(dataProvider = "byteBinaryOpMaskProvider")
2832     static void ROLByte128VectorTestsScalarShiftMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
2833                                           IntFunction<boolean[]> fm) {
2834         byte[] a = fa.apply(SPECIES.length());
2835         byte[] b = fb.apply(SPECIES.length());
2836         byte[] r = fr.apply(SPECIES.length());
2837         boolean[] mask = fm.apply(SPECIES.length());
2838         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2839 
2840         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2841             for (int i = 0; i < a.length; i += SPECIES.length()) {
2842                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2843                 av.lanewise(VectorOperators.ROL, (int)b[i], vmask).intoArray(r, i);
2844             }
2845         }
2846 
2847         assertShiftArraysEquals(r, a, b, mask, Byte128VectorTests::ROL_unary);
2848     }
2849     static byte LSHR_binary_const(byte a) {
2850         return (byte)(((a & 0xFF) >>> CONST_SHIFT));
2851     }
2852 
2853     @Test(dataProvider = "byteUnaryOpProvider")
2854     static void LSHRByte128VectorTestsScalarShiftConst(IntFunction<byte[]> fa) {
2855         byte[] a = fa.apply(SPECIES.length());
2856         byte[] r = fr.apply(SPECIES.length());
2857 
2858         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2859             for (int i = 0; i < a.length; i += SPECIES.length()) {
2860                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2861                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT).intoArray(r, i);
2862             }
2863         }
2864 
2865         assertShiftConstEquals(r, a, Byte128VectorTests::LSHR_binary_const);
2866     }
2867 
2868     @Test(dataProvider = "byteUnaryOpMaskProvider")
2869     static void LSHRByte128VectorTestsScalarShiftMaskedConst(IntFunction<byte[]> fa,
2870                                           IntFunction<boolean[]> fm) {
2871         byte[] a = fa.apply(SPECIES.length());
2872         byte[] r = fr.apply(SPECIES.length());
2873         boolean[] mask = fm.apply(SPECIES.length());
2874         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2875 
2876         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2877             for (int i = 0; i < a.length; i += SPECIES.length()) {
2878                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2879                 av.lanewise(VectorOperators.LSHR, CONST_SHIFT, vmask).intoArray(r, i);
2880             }
2881         }
2882 
2883         assertShiftConstEquals(r, a, mask, Byte128VectorTests::LSHR_binary_const);
2884     }
2885 
2886     static byte LSHL_binary_const(byte a) {
2887         return (byte)((a << CONST_SHIFT));
2888     }
2889 
2890     @Test(dataProvider = "byteUnaryOpProvider")
2891     static void LSHLByte128VectorTestsScalarShiftConst(IntFunction<byte[]> fa) {
2892         byte[] a = fa.apply(SPECIES.length());
2893         byte[] r = fr.apply(SPECIES.length());
2894 
2895         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2896             for (int i = 0; i < a.length; i += SPECIES.length()) {
2897                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2898                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT).intoArray(r, i);
2899             }
2900         }
2901 
2902         assertShiftConstEquals(r, a, Byte128VectorTests::LSHL_binary_const);
2903     }
2904 
2905     @Test(dataProvider = "byteUnaryOpMaskProvider")
2906     static void LSHLByte128VectorTestsScalarShiftMaskedConst(IntFunction<byte[]> fa,
2907                                           IntFunction<boolean[]> fm) {
2908         byte[] a = fa.apply(SPECIES.length());
2909         byte[] r = fr.apply(SPECIES.length());
2910         boolean[] mask = fm.apply(SPECIES.length());
2911         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2912 
2913         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2914             for (int i = 0; i < a.length; i += SPECIES.length()) {
2915                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2916                 av.lanewise(VectorOperators.LSHL, CONST_SHIFT, vmask).intoArray(r, i);
2917             }
2918         }
2919 
2920         assertShiftConstEquals(r, a, mask, Byte128VectorTests::LSHL_binary_const);
2921     }
2922 
2923     static byte ASHR_binary_const(byte a) {
2924         return (byte)((a >> CONST_SHIFT));
2925     }
2926 
2927     @Test(dataProvider = "byteUnaryOpProvider")
2928     static void ASHRByte128VectorTestsScalarShiftConst(IntFunction<byte[]> fa) {
2929         byte[] a = fa.apply(SPECIES.length());
2930         byte[] r = fr.apply(SPECIES.length());
2931 
2932         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2933             for (int i = 0; i < a.length; i += SPECIES.length()) {
2934                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2935                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT).intoArray(r, i);
2936             }
2937         }
2938 
2939         assertShiftConstEquals(r, a, Byte128VectorTests::ASHR_binary_const);
2940     }
2941 
2942     @Test(dataProvider = "byteUnaryOpMaskProvider")
2943     static void ASHRByte128VectorTestsScalarShiftMaskedConst(IntFunction<byte[]> fa,
2944                                           IntFunction<boolean[]> fm) {
2945         byte[] a = fa.apply(SPECIES.length());
2946         byte[] r = fr.apply(SPECIES.length());
2947         boolean[] mask = fm.apply(SPECIES.length());
2948         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2949 
2950         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2951             for (int i = 0; i < a.length; i += SPECIES.length()) {
2952                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2953                 av.lanewise(VectorOperators.ASHR, CONST_SHIFT, vmask).intoArray(r, i);
2954             }
2955         }
2956 
2957         assertShiftConstEquals(r, a, mask, Byte128VectorTests::ASHR_binary_const);
2958     }
2959 
2960     static byte ROR_binary_const(byte a) {
2961         return (byte)(ROR_scalar(a, CONST_SHIFT));
2962     }
2963 
2964     @Test(dataProvider = "byteUnaryOpProvider")
2965     static void RORByte128VectorTestsScalarShiftConst(IntFunction<byte[]> fa) {
2966         byte[] a = fa.apply(SPECIES.length());
2967         byte[] r = fr.apply(SPECIES.length());
2968 
2969         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2970             for (int i = 0; i < a.length; i += SPECIES.length()) {
2971                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2972                 av.lanewise(VectorOperators.ROR, CONST_SHIFT).intoArray(r, i);
2973             }
2974         }
2975 
2976         assertShiftConstEquals(r, a, Byte128VectorTests::ROR_binary_const);
2977     }
2978 
2979     @Test(dataProvider = "byteUnaryOpMaskProvider")
2980     static void RORByte128VectorTestsScalarShiftMaskedConst(IntFunction<byte[]> fa,
2981                                           IntFunction<boolean[]> fm) {
2982         byte[] a = fa.apply(SPECIES.length());
2983         byte[] r = fr.apply(SPECIES.length());
2984         boolean[] mask = fm.apply(SPECIES.length());
2985         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2986 
2987         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2988             for (int i = 0; i < a.length; i += SPECIES.length()) {
2989                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
2990                 av.lanewise(VectorOperators.ROR, CONST_SHIFT, vmask).intoArray(r, i);
2991             }
2992         }
2993 
2994         assertShiftConstEquals(r, a, mask, Byte128VectorTests::ROR_binary_const);
2995     }
2996 
2997     static byte ROL_binary_const(byte a) {
2998         return (byte)(ROL_scalar(a, CONST_SHIFT));
2999     }
3000 
3001     @Test(dataProvider = "byteUnaryOpProvider")
3002     static void ROLByte128VectorTestsScalarShiftConst(IntFunction<byte[]> fa) {
3003         byte[] a = fa.apply(SPECIES.length());
3004         byte[] r = fr.apply(SPECIES.length());
3005 
3006         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3007             for (int i = 0; i < a.length; i += SPECIES.length()) {
3008                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3009                 av.lanewise(VectorOperators.ROL, CONST_SHIFT).intoArray(r, i);
3010             }
3011         }
3012 
3013         assertShiftConstEquals(r, a, Byte128VectorTests::ROL_binary_const);
3014     }
3015 
3016     @Test(dataProvider = "byteUnaryOpMaskProvider")
3017     static void ROLByte128VectorTestsScalarShiftMaskedConst(IntFunction<byte[]> fa,
3018                                           IntFunction<boolean[]> fm) {
3019         byte[] a = fa.apply(SPECIES.length());
3020         byte[] r = fr.apply(SPECIES.length());
3021         boolean[] mask = fm.apply(SPECIES.length());
3022         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3023 
3024         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3025             for (int i = 0; i < a.length; i += SPECIES.length()) {
3026                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3027                 av.lanewise(VectorOperators.ROL, CONST_SHIFT, vmask).intoArray(r, i);
3028             }
3029         }
3030 
3031         assertShiftConstEquals(r, a, mask, Byte128VectorTests::ROL_binary_const);
3032     }
3033 
3034 
3035     static ByteVector bv_MIN = ByteVector.broadcast(SPECIES, (byte)10);
3036 
3037     @Test(dataProvider = "byteUnaryOpProvider")
3038     static void MINByte128VectorTestsWithMemOp(IntFunction<byte[]> fa) {
3039         byte[] a = fa.apply(SPECIES.length());
3040         byte[] r = fr.apply(SPECIES.length());
3041 
3042         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3043             for (int i = 0; i < a.length; i += SPECIES.length()) {
3044                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3045                 av.lanewise(VectorOperators.MIN, bv_MIN).intoArray(r, i);
3046             }
3047         }
3048 
3049         assertArraysEquals(r, a, (byte)10, Byte128VectorTests::MIN);
3050     }
3051 
3052     static ByteVector bv_min = ByteVector.broadcast(SPECIES, (byte)10);
3053 
3054     @Test(dataProvider = "byteUnaryOpProvider")
3055     static void minByte128VectorTestsWithMemOp(IntFunction<byte[]> fa) {
3056         byte[] a = fa.apply(SPECIES.length());
3057         byte[] r = fr.apply(SPECIES.length());
3058 
3059         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3060             for (int i = 0; i < a.length; i += SPECIES.length()) {
3061                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3062                 av.min(bv_min).intoArray(r, i);
3063             }
3064         }
3065 
3066         assertArraysEquals(r, a, (byte)10, Byte128VectorTests::min);
3067     }
3068 
3069     static ByteVector bv_MIN_M = ByteVector.broadcast(SPECIES, (byte)10);
3070 
3071     @Test(dataProvider = "byteUnaryOpMaskProvider")
3072     static void MINByte128VectorTestsMaskedWithMemOp(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
3073         byte[] a = fa.apply(SPECIES.length());
3074         byte[] r = fr.apply(SPECIES.length());
3075         boolean[] mask = fm.apply(SPECIES.length());
3076         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3077 
3078         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3079             for (int i = 0; i < a.length; i += SPECIES.length()) {
3080                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3081                 av.lanewise(VectorOperators.MIN, bv_MIN_M, vmask).intoArray(r, i);
3082             }
3083         }
3084 
3085         assertArraysEquals(r, a, (byte)10, mask, Byte128VectorTests::MIN);
3086     }
3087 
3088     static ByteVector bv_MAX = ByteVector.broadcast(SPECIES, (byte)10);
3089 
3090     @Test(dataProvider = "byteUnaryOpProvider")
3091     static void MAXByte128VectorTestsWithMemOp(IntFunction<byte[]> fa) {
3092         byte[] a = fa.apply(SPECIES.length());
3093         byte[] r = fr.apply(SPECIES.length());
3094 
3095         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3096             for (int i = 0; i < a.length; i += SPECIES.length()) {
3097                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3098                 av.lanewise(VectorOperators.MAX, bv_MAX).intoArray(r, i);
3099             }
3100         }
3101 
3102         assertArraysEquals(r, a, (byte)10, Byte128VectorTests::MAX);
3103     }
3104 
3105     static ByteVector bv_max = ByteVector.broadcast(SPECIES, (byte)10);
3106 
3107     @Test(dataProvider = "byteUnaryOpProvider")
3108     static void maxByte128VectorTestsWithMemOp(IntFunction<byte[]> fa) {
3109         byte[] a = fa.apply(SPECIES.length());
3110         byte[] r = fr.apply(SPECIES.length());
3111 
3112         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3113             for (int i = 0; i < a.length; i += SPECIES.length()) {
3114                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3115                 av.max(bv_max).intoArray(r, i);
3116             }
3117         }
3118 
3119         assertArraysEquals(r, a, (byte)10, Byte128VectorTests::max);
3120     }
3121 
3122     static ByteVector bv_MAX_M = ByteVector.broadcast(SPECIES, (byte)10);
3123 
3124     @Test(dataProvider = "byteUnaryOpMaskProvider")
3125     static void MAXByte128VectorTestsMaskedWithMemOp(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
3126         byte[] a = fa.apply(SPECIES.length());
3127         byte[] r = fr.apply(SPECIES.length());
3128         boolean[] mask = fm.apply(SPECIES.length());
3129         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3130 
3131         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3132             for (int i = 0; i < a.length; i += SPECIES.length()) {
3133                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3134                 av.lanewise(VectorOperators.MAX, bv_MAX_M, vmask).intoArray(r, i);
3135             }
3136         }
3137 
3138         assertArraysEquals(r, a, (byte)10, mask, Byte128VectorTests::MAX);
3139     }
3140 
3141     static byte MIN(byte a, byte b) {
3142         return (byte)(Math.min(a, b));
3143     }
3144 
3145     @Test(dataProvider = "byteBinaryOpProvider")
3146     static void MINByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3147         byte[] a = fa.apply(SPECIES.length());
3148         byte[] b = fb.apply(SPECIES.length());
3149         byte[] r = fr.apply(SPECIES.length());
3150 
3151         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3152             for (int i = 0; i < a.length; i += SPECIES.length()) {
3153                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3154                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3155                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
3156             }
3157         }
3158 
3159         assertArraysEquals(r, a, b, Byte128VectorTests::MIN);
3160     }
3161 
3162     static byte min(byte a, byte b) {
3163         return (byte)(Math.min(a, b));
3164     }
3165 
3166     @Test(dataProvider = "byteBinaryOpProvider")
3167     static void minByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3168         byte[] a = fa.apply(SPECIES.length());
3169         byte[] b = fb.apply(SPECIES.length());
3170         byte[] r = fr.apply(SPECIES.length());
3171 
3172         for (int i = 0; i < a.length; i += SPECIES.length()) {
3173             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3174             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3175             av.min(bv).intoArray(r, i);
3176         }
3177 
3178         assertArraysEquals(r, a, b, Byte128VectorTests::min);
3179     }
3180 
3181     static byte MAX(byte a, byte b) {
3182         return (byte)(Math.max(a, b));
3183     }
3184 
3185     @Test(dataProvider = "byteBinaryOpProvider")
3186     static void MAXByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3187         byte[] a = fa.apply(SPECIES.length());
3188         byte[] b = fb.apply(SPECIES.length());
3189         byte[] r = fr.apply(SPECIES.length());
3190 
3191         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3192             for (int i = 0; i < a.length; i += SPECIES.length()) {
3193                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3194                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3195                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
3196             }
3197         }
3198 
3199         assertArraysEquals(r, a, b, Byte128VectorTests::MAX);
3200     }
3201 
3202     static byte max(byte a, byte b) {
3203         return (byte)(Math.max(a, b));
3204     }
3205 
3206     @Test(dataProvider = "byteBinaryOpProvider")
3207     static void maxByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3208         byte[] a = fa.apply(SPECIES.length());
3209         byte[] b = fb.apply(SPECIES.length());
3210         byte[] r = fr.apply(SPECIES.length());
3211 
3212         for (int i = 0; i < a.length; i += SPECIES.length()) {
3213             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3214             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3215             av.max(bv).intoArray(r, i);
3216         }
3217 
3218         assertArraysEquals(r, a, b, Byte128VectorTests::max);
3219     }
3220 
3221     static byte UMIN(byte a, byte b) {
3222         return (byte)(VectorMath.minUnsigned(a, b));
3223     }
3224 
3225     @Test(dataProvider = "byteBinaryOpProvider")
3226     static void UMINByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3227         byte[] a = fa.apply(SPECIES.length());
3228         byte[] b = fb.apply(SPECIES.length());
3229         byte[] r = fr.apply(SPECIES.length());
3230 
3231         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3232             for (int i = 0; i < a.length; i += SPECIES.length()) {
3233                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3234                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3235                 av.lanewise(VectorOperators.UMIN, bv).intoArray(r, i);
3236             }
3237         }
3238 
3239         assertArraysEquals(r, a, b, Byte128VectorTests::UMIN);
3240     }
3241 
3242     @Test(dataProvider = "byteBinaryOpMaskProvider")
3243     static void UMINByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
3244                                           IntFunction<boolean[]> fm) {
3245         byte[] a = fa.apply(SPECIES.length());
3246         byte[] b = fb.apply(SPECIES.length());
3247         byte[] r = fr.apply(SPECIES.length());
3248         boolean[] mask = fm.apply(SPECIES.length());
3249         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3250 
3251         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3252             for (int i = 0; i < a.length; i += SPECIES.length()) {
3253                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3254                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3255                 av.lanewise(VectorOperators.UMIN, bv, vmask).intoArray(r, i);
3256             }
3257         }
3258 
3259         assertArraysEquals(r, a, b, mask, Byte128VectorTests::UMIN);
3260     }
3261 
3262     static byte UMAX(byte a, byte b) {
3263         return (byte)(VectorMath.maxUnsigned(a, b));
3264     }
3265 
3266     @Test(dataProvider = "byteBinaryOpProvider")
3267     static void UMAXByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3268         byte[] a = fa.apply(SPECIES.length());
3269         byte[] b = fb.apply(SPECIES.length());
3270         byte[] r = fr.apply(SPECIES.length());
3271 
3272         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3273             for (int i = 0; i < a.length; i += SPECIES.length()) {
3274                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3275                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3276                 av.lanewise(VectorOperators.UMAX, bv).intoArray(r, i);
3277             }
3278         }
3279 
3280         assertArraysEquals(r, a, b, Byte128VectorTests::UMAX);
3281     }
3282 
3283     @Test(dataProvider = "byteBinaryOpMaskProvider")
3284     static void UMAXByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
3285                                           IntFunction<boolean[]> fm) {
3286         byte[] a = fa.apply(SPECIES.length());
3287         byte[] b = fb.apply(SPECIES.length());
3288         byte[] r = fr.apply(SPECIES.length());
3289         boolean[] mask = fm.apply(SPECIES.length());
3290         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3291 
3292         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3293             for (int i = 0; i < a.length; i += SPECIES.length()) {
3294                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3295                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3296                 av.lanewise(VectorOperators.UMAX, bv, vmask).intoArray(r, i);
3297             }
3298         }
3299 
3300         assertArraysEquals(r, a, b, mask, Byte128VectorTests::UMAX);
3301     }
3302 
3303     static byte SADD(byte a, byte b) {
3304         return (byte)(VectorMath.addSaturating(a, b));
3305     }
3306 
3307     @Test(dataProvider = "byteSaturatingBinaryOpProvider")
3308     static void SADDByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3309         byte[] a = fa.apply(SPECIES.length());
3310         byte[] b = fb.apply(SPECIES.length());
3311         byte[] r = fr.apply(SPECIES.length());
3312 
3313         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3314             for (int i = 0; i < a.length; i += SPECIES.length()) {
3315                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3316                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3317                 av.lanewise(VectorOperators.SADD, bv).intoArray(r, i);
3318             }
3319         }
3320 
3321         assertArraysEquals(r, a, b, Byte128VectorTests::SADD);
3322     }
3323 
3324     @Test(dataProvider = "byteSaturatingBinaryOpMaskProvider")
3325     static void SADDByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
3326                                           IntFunction<boolean[]> fm) {
3327         byte[] a = fa.apply(SPECIES.length());
3328         byte[] b = fb.apply(SPECIES.length());
3329         byte[] r = fr.apply(SPECIES.length());
3330         boolean[] mask = fm.apply(SPECIES.length());
3331         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3332 
3333         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3334             for (int i = 0; i < a.length; i += SPECIES.length()) {
3335                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3336                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3337                 av.lanewise(VectorOperators.SADD, bv, vmask).intoArray(r, i);
3338             }
3339         }
3340 
3341         assertArraysEquals(r, a, b, mask, Byte128VectorTests::SADD);
3342     }
3343 
3344     static byte SSUB(byte a, byte b) {
3345         return (byte)(VectorMath.subSaturating(a, b));
3346     }
3347 
3348     @Test(dataProvider = "byteSaturatingBinaryOpProvider")
3349     static void SSUBByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3350         byte[] a = fa.apply(SPECIES.length());
3351         byte[] b = fb.apply(SPECIES.length());
3352         byte[] r = fr.apply(SPECIES.length());
3353 
3354         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3355             for (int i = 0; i < a.length; i += SPECIES.length()) {
3356                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3357                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3358                 av.lanewise(VectorOperators.SSUB, bv).intoArray(r, i);
3359             }
3360         }
3361 
3362         assertArraysEquals(r, a, b, Byte128VectorTests::SSUB);
3363     }
3364 
3365     @Test(dataProvider = "byteSaturatingBinaryOpMaskProvider")
3366     static void SSUBByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
3367                                           IntFunction<boolean[]> fm) {
3368         byte[] a = fa.apply(SPECIES.length());
3369         byte[] b = fb.apply(SPECIES.length());
3370         byte[] r = fr.apply(SPECIES.length());
3371         boolean[] mask = fm.apply(SPECIES.length());
3372         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3373 
3374         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3375             for (int i = 0; i < a.length; i += SPECIES.length()) {
3376                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3377                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3378                 av.lanewise(VectorOperators.SSUB, bv, vmask).intoArray(r, i);
3379             }
3380         }
3381 
3382         assertArraysEquals(r, a, b, mask, Byte128VectorTests::SSUB);
3383     }
3384 
3385     static byte SUADD(byte a, byte b) {
3386         return (byte)(VectorMath.addSaturatingUnsigned(a, b));
3387     }
3388 
3389     @Test(dataProvider = "byteSaturatingBinaryOpProvider")
3390     static void SUADDByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3391         byte[] a = fa.apply(SPECIES.length());
3392         byte[] b = fb.apply(SPECIES.length());
3393         byte[] r = fr.apply(SPECIES.length());
3394 
3395         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3396             for (int i = 0; i < a.length; i += SPECIES.length()) {
3397                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3398                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3399                 av.lanewise(VectorOperators.SUADD, bv).intoArray(r, i);
3400             }
3401         }
3402 
3403         assertArraysEquals(r, a, b, Byte128VectorTests::SUADD);
3404     }
3405 
3406     @Test(dataProvider = "byteSaturatingBinaryOpMaskProvider")
3407     static void SUADDByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
3408                                           IntFunction<boolean[]> fm) {
3409         byte[] a = fa.apply(SPECIES.length());
3410         byte[] b = fb.apply(SPECIES.length());
3411         byte[] r = fr.apply(SPECIES.length());
3412         boolean[] mask = fm.apply(SPECIES.length());
3413         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3414 
3415         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3416             for (int i = 0; i < a.length; i += SPECIES.length()) {
3417                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3418                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3419                 av.lanewise(VectorOperators.SUADD, bv, vmask).intoArray(r, i);
3420             }
3421         }
3422 
3423         assertArraysEquals(r, a, b, mask, Byte128VectorTests::SUADD);
3424     }
3425 
3426     static byte SUSUB(byte a, byte b) {
3427         return (byte)(VectorMath.subSaturatingUnsigned(a, b));
3428     }
3429 
3430     @Test(dataProvider = "byteSaturatingBinaryOpProvider")
3431     static void SUSUBByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3432         byte[] a = fa.apply(SPECIES.length());
3433         byte[] b = fb.apply(SPECIES.length());
3434         byte[] r = fr.apply(SPECIES.length());
3435 
3436         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3437             for (int i = 0; i < a.length; i += SPECIES.length()) {
3438                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3439                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3440                 av.lanewise(VectorOperators.SUSUB, bv).intoArray(r, i);
3441             }
3442         }
3443 
3444         assertArraysEquals(r, a, b, Byte128VectorTests::SUSUB);
3445     }
3446 
3447     @Test(dataProvider = "byteSaturatingBinaryOpMaskProvider")
3448     static void SUSUBByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
3449                                           IntFunction<boolean[]> fm) {
3450         byte[] a = fa.apply(SPECIES.length());
3451         byte[] b = fb.apply(SPECIES.length());
3452         byte[] r = fr.apply(SPECIES.length());
3453         boolean[] mask = fm.apply(SPECIES.length());
3454         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3455 
3456         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3457             for (int i = 0; i < a.length; i += SPECIES.length()) {
3458                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3459                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3460                 av.lanewise(VectorOperators.SUSUB, bv, vmask).intoArray(r, i);
3461             }
3462         }
3463 
3464         assertArraysEquals(r, a, b, mask, Byte128VectorTests::SUSUB);
3465     }
3466 
3467     @Test(dataProvider = "byteBinaryOpProvider")
3468     static void MINByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3469         byte[] a = fa.apply(SPECIES.length());
3470         byte[] b = fb.apply(SPECIES.length());
3471         byte[] r = fr.apply(SPECIES.length());
3472 
3473         for (int i = 0; i < a.length; i += SPECIES.length()) {
3474             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3475             av.lanewise(VectorOperators.MIN, b[i]).intoArray(r, i);
3476         }
3477 
3478         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::MIN);
3479     }
3480 
3481     @Test(dataProvider = "byteBinaryOpProvider")
3482     static void minByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3483         byte[] a = fa.apply(SPECIES.length());
3484         byte[] b = fb.apply(SPECIES.length());
3485         byte[] r = fr.apply(SPECIES.length());
3486 
3487         for (int i = 0; i < a.length; i += SPECIES.length()) {
3488             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3489             av.min(b[i]).intoArray(r, i);
3490         }
3491 
3492         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::min);
3493     }
3494 
3495     @Test(dataProvider = "byteBinaryOpProvider")
3496     static void MAXByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3497         byte[] a = fa.apply(SPECIES.length());
3498         byte[] b = fb.apply(SPECIES.length());
3499         byte[] r = fr.apply(SPECIES.length());
3500 
3501         for (int i = 0; i < a.length; i += SPECIES.length()) {
3502             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3503             av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i);
3504         }
3505 
3506         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::MAX);
3507     }
3508 
3509     @Test(dataProvider = "byteBinaryOpProvider")
3510     static void maxByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
3511         byte[] a = fa.apply(SPECIES.length());
3512         byte[] b = fb.apply(SPECIES.length());
3513         byte[] r = fr.apply(SPECIES.length());
3514 
3515         for (int i = 0; i < a.length; i += SPECIES.length()) {
3516             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3517             av.max(b[i]).intoArray(r, i);
3518         }
3519 
3520         assertBroadcastArraysEquals(r, a, b, Byte128VectorTests::max);
3521     }
3522     @Test(dataProvider = "byteSaturatingBinaryOpAssocProvider")
3523     static void SUADDAssocByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
3524         byte[] a = fa.apply(SPECIES.length());
3525         byte[] b = fb.apply(SPECIES.length());
3526         byte[] c = fc.apply(SPECIES.length());
3527         byte[] rl = fr.apply(SPECIES.length());
3528         byte[] rr = fr.apply(SPECIES.length());
3529 
3530         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3531             for (int i = 0; i < a.length; i += SPECIES.length()) {
3532                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3533                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3534                 ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
3535                 av.lanewise(VectorOperators.SUADD, bv).lanewise(VectorOperators.SUADD, cv).intoArray(rl, i);
3536                 av.lanewise(VectorOperators.SUADD, bv.lanewise(VectorOperators.SUADD, cv)).intoArray(rr, i);
3537             }
3538         }
3539 
3540         assertArraysEqualsAssociative(rl, rr, a, b, c, Byte128VectorTests::SUADD);
3541     }
3542 
3543     @Test(dataProvider = "byteSaturatingBinaryOpAssocMaskProvider")
3544     static void SUADDAssocByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
3545                                                      IntFunction<byte[]> fc, IntFunction<boolean[]> fm) {
3546         byte[] a = fa.apply(SPECIES.length());
3547         byte[] b = fb.apply(SPECIES.length());
3548         byte[] c = fc.apply(SPECIES.length());
3549         boolean[] mask = fm.apply(SPECIES.length());
3550         byte[] rl = fr.apply(SPECIES.length());
3551         byte[] rr = fr.apply(SPECIES.length());
3552 
3553         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3554 
3555         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3556             for (int i = 0; i < a.length; i += SPECIES.length()) {
3557                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3558                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
3559                 ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
3560                 av.lanewise(VectorOperators.SUADD, bv, vmask).lanewise(VectorOperators.SUADD, cv, vmask).intoArray(rl, i);
3561                 av.lanewise(VectorOperators.SUADD, bv.lanewise(VectorOperators.SUADD, cv, vmask), vmask).intoArray(rr, i);
3562             }
3563         }
3564 
3565         assertArraysEqualsAssociative(rl, rr, a, b, c, mask, Byte128VectorTests::SUADD);
3566     }
3567 
3568     static byte ANDReduce(byte[] a, int idx) {
3569         byte res = -1;
3570         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3571             res &= a[i];
3572         }
3573 
3574         return res;
3575     }
3576 
3577     static byte ANDReduceAll(byte[] a) {
3578         byte res = -1;
3579         for (int i = 0; i < a.length; i += SPECIES.length()) {
3580             res &= ANDReduce(a, i);
3581         }
3582 
3583         return res;
3584     }
3585 
3586     @Test(dataProvider = "byteUnaryOpProvider")
3587     static void ANDReduceByte128VectorTests(IntFunction<byte[]> fa) {
3588         byte[] a = fa.apply(SPECIES.length());
3589         byte[] r = fr.apply(SPECIES.length());
3590         byte ra = -1;
3591 
3592         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3593             for (int i = 0; i < a.length; i += SPECIES.length()) {
3594                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3595                 r[i] = av.reduceLanes(VectorOperators.AND);
3596             }
3597         }
3598 
3599         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3600             ra = -1;
3601             for (int i = 0; i < a.length; i += SPECIES.length()) {
3602                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3603                 ra &= av.reduceLanes(VectorOperators.AND);
3604             }
3605         }
3606 
3607         assertReductionArraysEquals(r, ra, a,
3608                 Byte128VectorTests::ANDReduce, Byte128VectorTests::ANDReduceAll);
3609     }
3610 
3611     static byte ANDReduceMasked(byte[] a, int idx, boolean[] mask) {
3612         byte res = -1;
3613         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3614             if (mask[i % SPECIES.length()])
3615                 res &= a[i];
3616         }
3617 
3618         return res;
3619     }
3620 
3621     static byte ANDReduceAllMasked(byte[] a, boolean[] mask) {
3622         byte res = -1;
3623         for (int i = 0; i < a.length; i += SPECIES.length()) {
3624             res &= ANDReduceMasked(a, i, mask);
3625         }
3626 
3627         return res;
3628     }
3629 
3630     @Test(dataProvider = "byteUnaryOpMaskProvider")
3631     static void ANDReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
3632         byte[] a = fa.apply(SPECIES.length());
3633         byte[] r = fr.apply(SPECIES.length());
3634         boolean[] mask = fm.apply(SPECIES.length());
3635         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3636         byte ra = -1;
3637 
3638         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3639             for (int i = 0; i < a.length; i += SPECIES.length()) {
3640                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3641                 r[i] = av.reduceLanes(VectorOperators.AND, vmask);
3642             }
3643         }
3644 
3645         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3646             ra = -1;
3647             for (int i = 0; i < a.length; i += SPECIES.length()) {
3648                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3649                 ra &= av.reduceLanes(VectorOperators.AND, vmask);
3650             }
3651         }
3652 
3653         assertReductionArraysEqualsMasked(r, ra, a, mask,
3654                 Byte128VectorTests::ANDReduceMasked, Byte128VectorTests::ANDReduceAllMasked);
3655     }
3656 
3657     static byte ORReduce(byte[] a, int idx) {
3658         byte res = 0;
3659         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3660             res |= a[i];
3661         }
3662 
3663         return res;
3664     }
3665 
3666     static byte ORReduceAll(byte[] a) {
3667         byte res = 0;
3668         for (int i = 0; i < a.length; i += SPECIES.length()) {
3669             res |= ORReduce(a, i);
3670         }
3671 
3672         return res;
3673     }
3674 
3675     @Test(dataProvider = "byteUnaryOpProvider")
3676     static void ORReduceByte128VectorTests(IntFunction<byte[]> fa) {
3677         byte[] a = fa.apply(SPECIES.length());
3678         byte[] r = fr.apply(SPECIES.length());
3679         byte ra = 0;
3680 
3681         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3682             for (int i = 0; i < a.length; i += SPECIES.length()) {
3683                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3684                 r[i] = av.reduceLanes(VectorOperators.OR);
3685             }
3686         }
3687 
3688         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3689             ra = 0;
3690             for (int i = 0; i < a.length; i += SPECIES.length()) {
3691                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3692                 ra |= av.reduceLanes(VectorOperators.OR);
3693             }
3694         }
3695 
3696         assertReductionArraysEquals(r, ra, a,
3697                 Byte128VectorTests::ORReduce, Byte128VectorTests::ORReduceAll);
3698     }
3699 
3700     static byte ORReduceMasked(byte[] a, int idx, boolean[] mask) {
3701         byte res = 0;
3702         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3703             if (mask[i % SPECIES.length()])
3704                 res |= a[i];
3705         }
3706 
3707         return res;
3708     }
3709 
3710     static byte ORReduceAllMasked(byte[] a, boolean[] mask) {
3711         byte res = 0;
3712         for (int i = 0; i < a.length; i += SPECIES.length()) {
3713             res |= ORReduceMasked(a, i, mask);
3714         }
3715 
3716         return res;
3717     }
3718 
3719     @Test(dataProvider = "byteUnaryOpMaskProvider")
3720     static void ORReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
3721         byte[] a = fa.apply(SPECIES.length());
3722         byte[] r = fr.apply(SPECIES.length());
3723         boolean[] mask = fm.apply(SPECIES.length());
3724         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3725         byte ra = 0;
3726 
3727         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3728             for (int i = 0; i < a.length; i += SPECIES.length()) {
3729                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3730                 r[i] = av.reduceLanes(VectorOperators.OR, vmask);
3731             }
3732         }
3733 
3734         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3735             ra = 0;
3736             for (int i = 0; i < a.length; i += SPECIES.length()) {
3737                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3738                 ra |= av.reduceLanes(VectorOperators.OR, vmask);
3739             }
3740         }
3741 
3742         assertReductionArraysEqualsMasked(r, ra, a, mask,
3743                 Byte128VectorTests::ORReduceMasked, Byte128VectorTests::ORReduceAllMasked);
3744     }
3745 
3746     static byte XORReduce(byte[] a, int idx) {
3747         byte res = 0;
3748         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3749             res ^= a[i];
3750         }
3751 
3752         return res;
3753     }
3754 
3755     static byte XORReduceAll(byte[] a) {
3756         byte res = 0;
3757         for (int i = 0; i < a.length; i += SPECIES.length()) {
3758             res ^= XORReduce(a, i);
3759         }
3760 
3761         return res;
3762     }
3763 
3764     @Test(dataProvider = "byteUnaryOpProvider")
3765     static void XORReduceByte128VectorTests(IntFunction<byte[]> fa) {
3766         byte[] a = fa.apply(SPECIES.length());
3767         byte[] r = fr.apply(SPECIES.length());
3768         byte ra = 0;
3769 
3770         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3771             for (int i = 0; i < a.length; i += SPECIES.length()) {
3772                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3773                 r[i] = av.reduceLanes(VectorOperators.XOR);
3774             }
3775         }
3776 
3777         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3778             ra = 0;
3779             for (int i = 0; i < a.length; i += SPECIES.length()) {
3780                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3781                 ra ^= av.reduceLanes(VectorOperators.XOR);
3782             }
3783         }
3784 
3785         assertReductionArraysEquals(r, ra, a,
3786                 Byte128VectorTests::XORReduce, Byte128VectorTests::XORReduceAll);
3787     }
3788 
3789     static byte XORReduceMasked(byte[] a, int idx, boolean[] mask) {
3790         byte res = 0;
3791         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3792             if (mask[i % SPECIES.length()])
3793                 res ^= a[i];
3794         }
3795 
3796         return res;
3797     }
3798 
3799     static byte XORReduceAllMasked(byte[] a, boolean[] mask) {
3800         byte res = 0;
3801         for (int i = 0; i < a.length; i += SPECIES.length()) {
3802             res ^= XORReduceMasked(a, i, mask);
3803         }
3804 
3805         return res;
3806     }
3807 
3808     @Test(dataProvider = "byteUnaryOpMaskProvider")
3809     static void XORReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
3810         byte[] a = fa.apply(SPECIES.length());
3811         byte[] r = fr.apply(SPECIES.length());
3812         boolean[] mask = fm.apply(SPECIES.length());
3813         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3814         byte ra = 0;
3815 
3816         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3817             for (int i = 0; i < a.length; i += SPECIES.length()) {
3818                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3819                 r[i] = av.reduceLanes(VectorOperators.XOR, vmask);
3820             }
3821         }
3822 
3823         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3824             ra = 0;
3825             for (int i = 0; i < a.length; i += SPECIES.length()) {
3826                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3827                 ra ^= av.reduceLanes(VectorOperators.XOR, vmask);
3828             }
3829         }
3830 
3831         assertReductionArraysEqualsMasked(r, ra, a, mask,
3832                 Byte128VectorTests::XORReduceMasked, Byte128VectorTests::XORReduceAllMasked);
3833     }
3834 
3835     static byte ADDReduce(byte[] a, int idx) {
3836         byte res = 0;
3837         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3838             res += a[i];
3839         }
3840 
3841         return res;
3842     }
3843 
3844     static byte ADDReduceAll(byte[] a) {
3845         byte res = 0;
3846         for (int i = 0; i < a.length; i += SPECIES.length()) {
3847             res += ADDReduce(a, i);
3848         }
3849 
3850         return res;
3851     }
3852 
3853     @Test(dataProvider = "byteUnaryOpProvider")
3854     static void ADDReduceByte128VectorTests(IntFunction<byte[]> fa) {
3855         byte[] a = fa.apply(SPECIES.length());
3856         byte[] r = fr.apply(SPECIES.length());
3857         byte ra = 0;
3858 
3859         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3860             for (int i = 0; i < a.length; i += SPECIES.length()) {
3861                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3862                 r[i] = av.reduceLanes(VectorOperators.ADD);
3863             }
3864         }
3865 
3866         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3867             ra = 0;
3868             for (int i = 0; i < a.length; i += SPECIES.length()) {
3869                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3870                 ra += av.reduceLanes(VectorOperators.ADD);
3871             }
3872         }
3873 
3874         assertReductionArraysEquals(r, ra, a,
3875                 Byte128VectorTests::ADDReduce, Byte128VectorTests::ADDReduceAll);
3876     }
3877 
3878     static byte ADDReduceMasked(byte[] a, int idx, boolean[] mask) {
3879         byte res = 0;
3880         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3881             if (mask[i % SPECIES.length()])
3882                 res += a[i];
3883         }
3884 
3885         return res;
3886     }
3887 
3888     static byte ADDReduceAllMasked(byte[] a, boolean[] mask) {
3889         byte res = 0;
3890         for (int i = 0; i < a.length; i += SPECIES.length()) {
3891             res += ADDReduceMasked(a, i, mask);
3892         }
3893 
3894         return res;
3895     }
3896 
3897     @Test(dataProvider = "byteUnaryOpMaskProvider")
3898     static void ADDReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
3899         byte[] a = fa.apply(SPECIES.length());
3900         byte[] r = fr.apply(SPECIES.length());
3901         boolean[] mask = fm.apply(SPECIES.length());
3902         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3903         byte ra = 0;
3904 
3905         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3906             for (int i = 0; i < a.length; i += SPECIES.length()) {
3907                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3908                 r[i] = av.reduceLanes(VectorOperators.ADD, vmask);
3909             }
3910         }
3911 
3912         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3913             ra = 0;
3914             for (int i = 0; i < a.length; i += SPECIES.length()) {
3915                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3916                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
3917             }
3918         }
3919 
3920         assertReductionArraysEqualsMasked(r, ra, a, mask,
3921                 Byte128VectorTests::ADDReduceMasked, Byte128VectorTests::ADDReduceAllMasked);
3922     }
3923 
3924     static byte MULReduce(byte[] a, int idx) {
3925         byte res = 1;
3926         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3927             res *= a[i];
3928         }
3929 
3930         return res;
3931     }
3932 
3933     static byte MULReduceAll(byte[] a) {
3934         byte res = 1;
3935         for (int i = 0; i < a.length; i += SPECIES.length()) {
3936             res *= MULReduce(a, i);
3937         }
3938 
3939         return res;
3940     }
3941 
3942     @Test(dataProvider = "byteUnaryOpProvider")
3943     static void MULReduceByte128VectorTests(IntFunction<byte[]> fa) {
3944         byte[] a = fa.apply(SPECIES.length());
3945         byte[] r = fr.apply(SPECIES.length());
3946         byte ra = 1;
3947 
3948         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3949             for (int i = 0; i < a.length; i += SPECIES.length()) {
3950                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3951                 r[i] = av.reduceLanes(VectorOperators.MUL);
3952             }
3953         }
3954 
3955         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3956             ra = 1;
3957             for (int i = 0; i < a.length; i += SPECIES.length()) {
3958                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3959                 ra *= av.reduceLanes(VectorOperators.MUL);
3960             }
3961         }
3962 
3963         assertReductionArraysEquals(r, ra, a,
3964                 Byte128VectorTests::MULReduce, Byte128VectorTests::MULReduceAll);
3965     }
3966 
3967     static byte MULReduceMasked(byte[] a, int idx, boolean[] mask) {
3968         byte res = 1;
3969         for (int i = idx; i < (idx + SPECIES.length()); i++) {
3970             if (mask[i % SPECIES.length()])
3971                 res *= a[i];
3972         }
3973 
3974         return res;
3975     }
3976 
3977     static byte MULReduceAllMasked(byte[] a, boolean[] mask) {
3978         byte res = 1;
3979         for (int i = 0; i < a.length; i += SPECIES.length()) {
3980             res *= MULReduceMasked(a, i, mask);
3981         }
3982 
3983         return res;
3984     }
3985 
3986     @Test(dataProvider = "byteUnaryOpMaskProvider")
3987     static void MULReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
3988         byte[] a = fa.apply(SPECIES.length());
3989         byte[] r = fr.apply(SPECIES.length());
3990         boolean[] mask = fm.apply(SPECIES.length());
3991         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3992         byte ra = 1;
3993 
3994         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3995             for (int i = 0; i < a.length; i += SPECIES.length()) {
3996                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
3997                 r[i] = av.reduceLanes(VectorOperators.MUL, vmask);
3998             }
3999         }
4000 
4001         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4002             ra = 1;
4003             for (int i = 0; i < a.length; i += SPECIES.length()) {
4004                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4005                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
4006             }
4007         }
4008 
4009         assertReductionArraysEqualsMasked(r, ra, a, mask,
4010                 Byte128VectorTests::MULReduceMasked, Byte128VectorTests::MULReduceAllMasked);
4011     }
4012 
4013     static byte MINReduce(byte[] a, int idx) {
4014         byte res = Byte.MAX_VALUE;
4015         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4016             res = (byte) Math.min(res, a[i]);
4017         }
4018 
4019         return res;
4020     }
4021 
4022     static byte MINReduceAll(byte[] a) {
4023         byte res = Byte.MAX_VALUE;
4024         for (int i = 0; i < a.length; i += SPECIES.length()) {
4025             res = (byte) Math.min(res, MINReduce(a, i));
4026         }
4027 
4028         return res;
4029     }
4030 
4031     @Test(dataProvider = "byteUnaryOpProvider")
4032     static void MINReduceByte128VectorTests(IntFunction<byte[]> fa) {
4033         byte[] a = fa.apply(SPECIES.length());
4034         byte[] r = fr.apply(SPECIES.length());
4035         byte ra = Byte.MAX_VALUE;
4036 
4037         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4038             for (int i = 0; i < a.length; i += SPECIES.length()) {
4039                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4040                 r[i] = av.reduceLanes(VectorOperators.MIN);
4041             }
4042         }
4043 
4044         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4045             ra = Byte.MAX_VALUE;
4046             for (int i = 0; i < a.length; i += SPECIES.length()) {
4047                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4048                 ra = (byte) Math.min(ra, av.reduceLanes(VectorOperators.MIN));
4049             }
4050         }
4051 
4052         assertReductionArraysEquals(r, ra, a,
4053                 Byte128VectorTests::MINReduce, Byte128VectorTests::MINReduceAll);
4054     }
4055 
4056     static byte MINReduceMasked(byte[] a, int idx, boolean[] mask) {
4057         byte res = Byte.MAX_VALUE;
4058         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4059             if (mask[i % SPECIES.length()])
4060                 res = (byte) Math.min(res, a[i]);
4061         }
4062 
4063         return res;
4064     }
4065 
4066     static byte MINReduceAllMasked(byte[] a, boolean[] mask) {
4067         byte res = Byte.MAX_VALUE;
4068         for (int i = 0; i < a.length; i += SPECIES.length()) {
4069             res = (byte) Math.min(res, MINReduceMasked(a, i, mask));
4070         }
4071 
4072         return res;
4073     }
4074 
4075     @Test(dataProvider = "byteUnaryOpMaskProvider")
4076     static void MINReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
4077         byte[] a = fa.apply(SPECIES.length());
4078         byte[] r = fr.apply(SPECIES.length());
4079         boolean[] mask = fm.apply(SPECIES.length());
4080         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4081         byte ra = Byte.MAX_VALUE;
4082 
4083         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4084             for (int i = 0; i < a.length; i += SPECIES.length()) {
4085                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4086                 r[i] = av.reduceLanes(VectorOperators.MIN, vmask);
4087             }
4088         }
4089 
4090         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4091             ra = Byte.MAX_VALUE;
4092             for (int i = 0; i < a.length; i += SPECIES.length()) {
4093                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4094                 ra = (byte) Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
4095             }
4096         }
4097 
4098         assertReductionArraysEqualsMasked(r, ra, a, mask,
4099                 Byte128VectorTests::MINReduceMasked, Byte128VectorTests::MINReduceAllMasked);
4100     }
4101 
4102     static byte MAXReduce(byte[] a, int idx) {
4103         byte res = Byte.MIN_VALUE;
4104         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4105             res = (byte) Math.max(res, a[i]);
4106         }
4107 
4108         return res;
4109     }
4110 
4111     static byte MAXReduceAll(byte[] a) {
4112         byte res = Byte.MIN_VALUE;
4113         for (int i = 0; i < a.length; i += SPECIES.length()) {
4114             res = (byte) Math.max(res, MAXReduce(a, i));
4115         }
4116 
4117         return res;
4118     }
4119 
4120     @Test(dataProvider = "byteUnaryOpProvider")
4121     static void MAXReduceByte128VectorTests(IntFunction<byte[]> fa) {
4122         byte[] a = fa.apply(SPECIES.length());
4123         byte[] r = fr.apply(SPECIES.length());
4124         byte ra = Byte.MIN_VALUE;
4125 
4126         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4127             for (int i = 0; i < a.length; i += SPECIES.length()) {
4128                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4129                 r[i] = av.reduceLanes(VectorOperators.MAX);
4130             }
4131         }
4132 
4133         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4134             ra = Byte.MIN_VALUE;
4135             for (int i = 0; i < a.length; i += SPECIES.length()) {
4136                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4137                 ra = (byte) Math.max(ra, av.reduceLanes(VectorOperators.MAX));
4138             }
4139         }
4140 
4141         assertReductionArraysEquals(r, ra, a,
4142                 Byte128VectorTests::MAXReduce, Byte128VectorTests::MAXReduceAll);
4143     }
4144 
4145     static byte MAXReduceMasked(byte[] a, int idx, boolean[] mask) {
4146         byte res = Byte.MIN_VALUE;
4147         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4148             if (mask[i % SPECIES.length()])
4149                 res = (byte) Math.max(res, a[i]);
4150         }
4151 
4152         return res;
4153     }
4154 
4155     static byte MAXReduceAllMasked(byte[] a, boolean[] mask) {
4156         byte res = Byte.MIN_VALUE;
4157         for (int i = 0; i < a.length; i += SPECIES.length()) {
4158             res = (byte) Math.max(res, MAXReduceMasked(a, i, mask));
4159         }
4160 
4161         return res;
4162     }
4163 
4164     @Test(dataProvider = "byteUnaryOpMaskProvider")
4165     static void MAXReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
4166         byte[] a = fa.apply(SPECIES.length());
4167         byte[] r = fr.apply(SPECIES.length());
4168         boolean[] mask = fm.apply(SPECIES.length());
4169         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4170         byte ra = Byte.MIN_VALUE;
4171 
4172         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4173             for (int i = 0; i < a.length; i += SPECIES.length()) {
4174                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4175                 r[i] = av.reduceLanes(VectorOperators.MAX, vmask);
4176             }
4177         }
4178 
4179         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4180             ra = Byte.MIN_VALUE;
4181             for (int i = 0; i < a.length; i += SPECIES.length()) {
4182                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4183                 ra = (byte) Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
4184             }
4185         }
4186 
4187         assertReductionArraysEqualsMasked(r, ra, a, mask,
4188                 Byte128VectorTests::MAXReduceMasked, Byte128VectorTests::MAXReduceAllMasked);
4189     }
4190 
4191     static byte UMINReduce(byte[] a, int idx) {
4192         byte res = Byte.MAX_VALUE;
4193         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4194             res = (byte) VectorMath.minUnsigned(res, a[i]);
4195         }
4196 
4197         return res;
4198     }
4199 
4200     static byte UMINReduceAll(byte[] a) {
4201         byte res = Byte.MAX_VALUE;
4202         for (int i = 0; i < a.length; i += SPECIES.length()) {
4203             res = (byte) VectorMath.minUnsigned(res, UMINReduce(a, i));
4204         }
4205 
4206         return res;
4207     }
4208 
4209     @Test(dataProvider = "byteUnaryOpProvider")
4210     static void UMINReduceByte128VectorTests(IntFunction<byte[]> fa) {
4211         byte[] a = fa.apply(SPECIES.length());
4212         byte[] r = fr.apply(SPECIES.length());
4213         byte ra = Byte.MAX_VALUE;
4214 
4215         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4216             for (int i = 0; i < a.length; i += SPECIES.length()) {
4217                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4218                 r[i] = av.reduceLanes(VectorOperators.UMIN);
4219             }
4220         }
4221 
4222         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4223             ra = Byte.MAX_VALUE;
4224             for (int i = 0; i < a.length; i += SPECIES.length()) {
4225                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4226                 ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN));
4227             }
4228         }
4229 
4230         assertReductionArraysEquals(r, ra, a,
4231                 Byte128VectorTests::UMINReduce, Byte128VectorTests::UMINReduceAll);
4232     }
4233 
4234     static byte UMINReduceMasked(byte[] a, int idx, boolean[] mask) {
4235         byte res = Byte.MAX_VALUE;
4236         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4237             if (mask[i % SPECIES.length()])
4238                 res = (byte) VectorMath.minUnsigned(res, a[i]);
4239         }
4240 
4241         return res;
4242     }
4243 
4244     static byte UMINReduceAllMasked(byte[] a, boolean[] mask) {
4245         byte res = Byte.MAX_VALUE;
4246         for (int i = 0; i < a.length; i += SPECIES.length()) {
4247             res = (byte) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask));
4248         }
4249 
4250         return res;
4251     }
4252 
4253     @Test(dataProvider = "byteUnaryOpMaskProvider")
4254     static void UMINReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
4255         byte[] a = fa.apply(SPECIES.length());
4256         byte[] r = fr.apply(SPECIES.length());
4257         boolean[] mask = fm.apply(SPECIES.length());
4258         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4259         byte ra = Byte.MAX_VALUE;
4260 
4261         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4262             for (int i = 0; i < a.length; i += SPECIES.length()) {
4263                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4264                 r[i] = av.reduceLanes(VectorOperators.UMIN, vmask);
4265             }
4266         }
4267 
4268         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4269             ra = Byte.MAX_VALUE;
4270             for (int i = 0; i < a.length; i += SPECIES.length()) {
4271                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4272                 ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask));
4273             }
4274         }
4275 
4276         assertReductionArraysEqualsMasked(r, ra, a, mask,
4277                 Byte128VectorTests::UMINReduceMasked, Byte128VectorTests::UMINReduceAllMasked);
4278     }
4279 
4280     static byte UMAXReduce(byte[] a, int idx) {
4281         byte res = Byte.MIN_VALUE;
4282         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4283             res = (byte) VectorMath.maxUnsigned(res, a[i]);
4284         }
4285 
4286         return res;
4287     }
4288 
4289     static byte UMAXReduceAll(byte[] a) {
4290         byte res = Byte.MIN_VALUE;
4291         for (int i = 0; i < a.length; i += SPECIES.length()) {
4292             res = (byte) VectorMath.maxUnsigned(res, UMAXReduce(a, i));
4293         }
4294 
4295         return res;
4296     }
4297 
4298     @Test(dataProvider = "byteUnaryOpProvider")
4299     static void UMAXReduceByte128VectorTests(IntFunction<byte[]> fa) {
4300         byte[] a = fa.apply(SPECIES.length());
4301         byte[] r = fr.apply(SPECIES.length());
4302         byte ra = Byte.MIN_VALUE;
4303 
4304         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4305             for (int i = 0; i < a.length; i += SPECIES.length()) {
4306                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4307                 r[i] = av.reduceLanes(VectorOperators.UMAX);
4308             }
4309         }
4310 
4311         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4312             ra = Byte.MIN_VALUE;
4313             for (int i = 0; i < a.length; i += SPECIES.length()) {
4314                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4315                 ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX));
4316             }
4317         }
4318 
4319         assertReductionArraysEquals(r, ra, a,
4320                 Byte128VectorTests::UMAXReduce, Byte128VectorTests::UMAXReduceAll);
4321     }
4322 
4323     static byte UMAXReduceMasked(byte[] a, int idx, boolean[] mask) {
4324         byte res = Byte.MIN_VALUE;
4325         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4326             if (mask[i % SPECIES.length()])
4327                 res = (byte) VectorMath.maxUnsigned(res, a[i]);
4328         }
4329 
4330         return res;
4331     }
4332 
4333     static byte UMAXReduceAllMasked(byte[] a, boolean[] mask) {
4334         byte res = Byte.MIN_VALUE;
4335         for (int i = 0; i < a.length; i += SPECIES.length()) {
4336             res = (byte) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask));
4337         }
4338 
4339         return res;
4340     }
4341 
4342     @Test(dataProvider = "byteUnaryOpMaskProvider")
4343     static void UMAXReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
4344         byte[] a = fa.apply(SPECIES.length());
4345         byte[] r = fr.apply(SPECIES.length());
4346         boolean[] mask = fm.apply(SPECIES.length());
4347         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4348         byte ra = Byte.MIN_VALUE;
4349 
4350         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4351             for (int i = 0; i < a.length; i += SPECIES.length()) {
4352                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4353                 r[i] = av.reduceLanes(VectorOperators.UMAX, vmask);
4354             }
4355         }
4356 
4357         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4358             ra = Byte.MIN_VALUE;
4359             for (int i = 0; i < a.length; i += SPECIES.length()) {
4360                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4361                 ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask));
4362             }
4363         }
4364 
4365         assertReductionArraysEqualsMasked(r, ra, a, mask,
4366                 Byte128VectorTests::UMAXReduceMasked, Byte128VectorTests::UMAXReduceAllMasked);
4367     }
4368 
4369     static byte FIRST_NONZEROReduce(byte[] a, int idx) {
4370         byte res = (byte) 0;
4371         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4372             res = firstNonZero(res, a[i]);
4373         }
4374 
4375         return res;
4376     }
4377 
4378     static byte FIRST_NONZEROReduceAll(byte[] a) {
4379         byte res = (byte) 0;
4380         for (int i = 0; i < a.length; i += SPECIES.length()) {
4381             res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
4382         }
4383 
4384         return res;
4385     }
4386 
4387     @Test(dataProvider = "byteUnaryOpProvider")
4388     static void FIRST_NONZEROReduceByte128VectorTests(IntFunction<byte[]> fa) {
4389         byte[] a = fa.apply(SPECIES.length());
4390         byte[] r = fr.apply(SPECIES.length());
4391         byte ra = (byte) 0;
4392 
4393         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4394             for (int i = 0; i < a.length; i += SPECIES.length()) {
4395                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4396                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO);
4397             }
4398         }
4399 
4400         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4401             ra = (byte) 0;
4402             for (int i = 0; i < a.length; i += SPECIES.length()) {
4403                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4404                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO));
4405             }
4406         }
4407 
4408         assertReductionArraysEquals(r, ra, a,
4409                 Byte128VectorTests::FIRST_NONZEROReduce, Byte128VectorTests::FIRST_NONZEROReduceAll);
4410     }
4411 
4412     static byte FIRST_NONZEROReduceMasked(byte[] a, int idx, boolean[] mask) {
4413         byte res = (byte) 0;
4414         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4415             if (mask[i % SPECIES.length()])
4416                 res = firstNonZero(res, a[i]);
4417         }
4418 
4419         return res;
4420     }
4421 
4422     static byte FIRST_NONZEROReduceAllMasked(byte[] a, boolean[] mask) {
4423         byte res = (byte) 0;
4424         for (int i = 0; i < a.length; i += SPECIES.length()) {
4425             res = firstNonZero(res, FIRST_NONZEROReduceMasked(a, i, mask));
4426         }
4427 
4428         return res;
4429     }
4430 
4431     @Test(dataProvider = "byteUnaryOpMaskProvider")
4432     static void FIRST_NONZEROReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
4433         byte[] a = fa.apply(SPECIES.length());
4434         byte[] r = fr.apply(SPECIES.length());
4435         boolean[] mask = fm.apply(SPECIES.length());
4436         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4437         byte ra = (byte) 0;
4438 
4439         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4440             for (int i = 0; i < a.length; i += SPECIES.length()) {
4441                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4442                 r[i] = av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask);
4443             }
4444         }
4445 
4446         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4447             ra = (byte) 0;
4448             for (int i = 0; i < a.length; i += SPECIES.length()) {
4449                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4450                 ra = firstNonZero(ra, av.reduceLanes(VectorOperators.FIRST_NONZERO, vmask));
4451             }
4452         }
4453 
4454         assertReductionArraysEqualsMasked(r, ra, a, mask,
4455                 Byte128VectorTests::FIRST_NONZEROReduceMasked, Byte128VectorTests::FIRST_NONZEROReduceAllMasked);
4456     }
4457 
4458     static boolean anyTrue(boolean[] a, int idx) {
4459         boolean res = false;
4460         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4461             res |= a[i];
4462         }
4463 
4464         return res;
4465     }
4466 
4467     @Test(dataProvider = "boolUnaryOpProvider")
4468     static void anyTrueByte128VectorTests(IntFunction<boolean[]> fm) {
4469         boolean[] mask = fm.apply(SPECIES.length());
4470         boolean[] r = fmr.apply(SPECIES.length());
4471 
4472         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4473             for (int i = 0; i < mask.length; i += SPECIES.length()) {
4474                 VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, i);
4475                 r[i] = vmask.anyTrue();
4476             }
4477         }
4478 
4479         assertReductionBoolArraysEquals(r, mask, Byte128VectorTests::anyTrue);
4480     }
4481 
4482     static boolean allTrue(boolean[] a, int idx) {
4483         boolean res = true;
4484         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4485             res &= a[i];
4486         }
4487 
4488         return res;
4489     }
4490 
4491     @Test(dataProvider = "boolUnaryOpProvider")
4492     static void allTrueByte128VectorTests(IntFunction<boolean[]> fm) {
4493         boolean[] mask = fm.apply(SPECIES.length());
4494         boolean[] r = fmr.apply(SPECIES.length());
4495 
4496         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4497             for (int i = 0; i < mask.length; i += SPECIES.length()) {
4498                 VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, i);
4499                 r[i] = vmask.allTrue();
4500             }
4501         }
4502 
4503         assertReductionBoolArraysEquals(r, mask, Byte128VectorTests::allTrue);
4504     }
4505 
4506     static byte SUADDReduce(byte[] a, int idx) {
4507         byte res = 0;
4508         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4509             res = (byte) VectorMath.addSaturatingUnsigned(res, a[i]);
4510         }
4511 
4512         return res;
4513     }
4514 
4515     static byte SUADDReduceAll(byte[] a) {
4516         byte res = 0;
4517         for (int i = 0; i < a.length; i += SPECIES.length()) {
4518             res = (byte) VectorMath.addSaturatingUnsigned(res, SUADDReduce(a, i));
4519         }
4520 
4521         return res;
4522     }
4523 
4524     @Test(dataProvider = "byteSaturatingUnaryOpProvider")
4525     static void SUADDReduceByte128VectorTests(IntFunction<byte[]> fa) {
4526         byte[] a = fa.apply(SPECIES.length());
4527         byte[] r = fr.apply(SPECIES.length());
4528         byte ra = 0;
4529 
4530         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4531             for (int i = 0; i < a.length; i += SPECIES.length()) {
4532                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4533                 r[i] = av.reduceLanes(VectorOperators.SUADD);
4534             }
4535         }
4536 
4537         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4538             ra = 0;
4539             for (int i = 0; i < a.length; i += SPECIES.length()) {
4540                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4541                 ra = (byte) VectorMath.addSaturatingUnsigned(ra, av.reduceLanes(VectorOperators.SUADD));
4542             }
4543         }
4544 
4545         assertReductionArraysEquals(r, ra, a,
4546                 Byte128VectorTests::SUADDReduce, Byte128VectorTests::SUADDReduceAll);
4547     }
4548 
4549     static byte SUADDReduceMasked(byte[] a, int idx, boolean[] mask) {
4550         byte res = 0;
4551         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4552             if (mask[i % SPECIES.length()])
4553                 res = (byte) VectorMath.addSaturatingUnsigned(res, a[i]);
4554         }
4555 
4556         return res;
4557     }
4558 
4559     static byte SUADDReduceAllMasked(byte[] a, boolean[] mask) {
4560         byte res = 0;
4561         for (int i = 0; i < a.length; i += SPECIES.length()) {
4562             res = (byte) VectorMath.addSaturatingUnsigned(res, SUADDReduceMasked(a, i, mask));
4563         }
4564 
4565         return res;
4566     }
4567     @Test(dataProvider = "byteSaturatingUnaryOpMaskProvider")
4568     static void SUADDReduceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
4569         byte[] a = fa.apply(SPECIES.length());
4570         byte[] r = fr.apply(SPECIES.length());
4571         boolean[] mask = fm.apply(SPECIES.length());
4572         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4573         byte ra = 0;
4574 
4575         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4576             for (int i = 0; i < a.length; i += SPECIES.length()) {
4577                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4578                 r[i] = av.reduceLanes(VectorOperators.SUADD, vmask);
4579             }
4580         }
4581 
4582         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4583             ra = 0;
4584             for (int i = 0; i < a.length; i += SPECIES.length()) {
4585                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4586                 ra = (byte) VectorMath.addSaturatingUnsigned(ra, av.reduceLanes(VectorOperators.SUADD, vmask));
4587             }
4588         }
4589 
4590         assertReductionArraysEqualsMasked(r, ra, a, mask,
4591                 Byte128VectorTests::SUADDReduceMasked, Byte128VectorTests::SUADDReduceAllMasked);
4592     }
4593 
4594     @Test(dataProvider = "byteBinaryOpProvider")
4595     static void withByte128VectorTests(IntFunction<byte []> fa, IntFunction<byte []> fb) {
4596         byte[] a = fa.apply(SPECIES.length());
4597         byte[] b = fb.apply(SPECIES.length());
4598         byte[] r = fr.apply(SPECIES.length());
4599 
4600         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4601             for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
4602                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4603                 av.withLane(j, b[i + j]).intoArray(r, i);
4604                 a[i + j] = b[i + j];
4605                 j = (j + 1) & (SPECIES.length() - 1);
4606             }
4607         }
4608 
4609 
4610         assertArraysStrictlyEquals(r, a);
4611     }
4612 
4613     static boolean testIS_DEFAULT(byte a) {
4614         return bits(a)==0;
4615     }
4616 
4617     @Test(dataProvider = "byteTestOpProvider")
4618     static void IS_DEFAULTByte128VectorTests(IntFunction<byte[]> fa) {
4619         byte[] a = fa.apply(SPECIES.length());
4620 
4621         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4622             for (int i = 0; i < a.length; i += SPECIES.length()) {
4623                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4624                 VectorMask<Byte> mv = av.test(VectorOperators.IS_DEFAULT);
4625 
4626                 // Check results as part of computation.
4627                 for (int j = 0; j < SPECIES.length(); j++) {
4628                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
4629                 }
4630             }
4631         }
4632     }
4633 
4634     @Test(dataProvider = "byteTestOpMaskProvider")
4635     static void IS_DEFAULTMaskedByte128VectorTests(IntFunction<byte[]> fa,
4636                                           IntFunction<boolean[]> fm) {
4637         byte[] a = fa.apply(SPECIES.length());
4638         boolean[] mask = fm.apply(SPECIES.length());
4639         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4640 
4641         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4642             for (int i = 0; i < a.length; i += SPECIES.length()) {
4643                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4644                 VectorMask<Byte> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
4645 
4646                 // Check results as part of computation.
4647                 for (int j = 0; j < SPECIES.length(); j++) {
4648                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
4649                 }
4650             }
4651         }
4652     }
4653 
4654     static boolean testIS_NEGATIVE(byte a) {
4655         return bits(a)<0;
4656     }
4657 
4658     @Test(dataProvider = "byteTestOpProvider")
4659     static void IS_NEGATIVEByte128VectorTests(IntFunction<byte[]> fa) {
4660         byte[] a = fa.apply(SPECIES.length());
4661 
4662         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4663             for (int i = 0; i < a.length; i += SPECIES.length()) {
4664                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4665                 VectorMask<Byte> mv = av.test(VectorOperators.IS_NEGATIVE);
4666 
4667                 // Check results as part of computation.
4668                 for (int j = 0; j < SPECIES.length(); j++) {
4669                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
4670                 }
4671             }
4672         }
4673     }
4674 
4675     @Test(dataProvider = "byteTestOpMaskProvider")
4676     static void IS_NEGATIVEMaskedByte128VectorTests(IntFunction<byte[]> fa,
4677                                           IntFunction<boolean[]> fm) {
4678         byte[] a = fa.apply(SPECIES.length());
4679         boolean[] mask = fm.apply(SPECIES.length());
4680         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4681 
4682         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4683             for (int i = 0; i < a.length; i += SPECIES.length()) {
4684                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4685                 VectorMask<Byte> mv = av.test(VectorOperators.IS_NEGATIVE, vmask);
4686 
4687                 // Check results as part of computation.
4688                 for (int j = 0; j < SPECIES.length(); j++) {
4689                     Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j]));
4690                 }
4691             }
4692         }
4693     }
4694 
4695     @Test(dataProvider = "byteCompareOpProvider")
4696     static void LTByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4697         byte[] a = fa.apply(SPECIES.length());
4698         byte[] b = fb.apply(SPECIES.length());
4699 
4700         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4701             for (int i = 0; i < a.length; i += SPECIES.length()) {
4702                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4703                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4704                 VectorMask<Byte> mv = av.compare(VectorOperators.LT, bv);
4705 
4706                 // Check results as part of computation.
4707                 for (int j = 0; j < SPECIES.length(); j++) {
4708                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
4709                 }
4710             }
4711         }
4712     }
4713 
4714     @Test(dataProvider = "byteCompareOpProvider")
4715     static void ltByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4716         byte[] a = fa.apply(SPECIES.length());
4717         byte[] b = fb.apply(SPECIES.length());
4718 
4719         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4720             for (int i = 0; i < a.length; i += SPECIES.length()) {
4721                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4722                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4723                 VectorMask<Byte> mv = av.lt(bv);
4724 
4725                 // Check results as part of computation.
4726                 for (int j = 0; j < SPECIES.length(); j++) {
4727                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
4728                 }
4729             }
4730         }
4731     }
4732 
4733     @Test(dataProvider = "byteCompareOpMaskProvider")
4734     static void LTByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
4735                                                 IntFunction<boolean[]> fm) {
4736         byte[] a = fa.apply(SPECIES.length());
4737         byte[] b = fb.apply(SPECIES.length());
4738         boolean[] mask = fm.apply(SPECIES.length());
4739 
4740         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4741 
4742         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4743             for (int i = 0; i < a.length; i += SPECIES.length()) {
4744                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4745                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4746                 VectorMask<Byte> mv = av.compare(VectorOperators.LT, bv, vmask);
4747 
4748                 // Check results as part of computation.
4749                 for (int j = 0; j < SPECIES.length(); j++) {
4750                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
4751                 }
4752             }
4753         }
4754     }
4755 
4756     @Test(dataProvider = "byteCompareOpProvider")
4757     static void GTByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4758         byte[] a = fa.apply(SPECIES.length());
4759         byte[] b = fb.apply(SPECIES.length());
4760 
4761         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4762             for (int i = 0; i < a.length; i += SPECIES.length()) {
4763                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4764                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4765                 VectorMask<Byte> mv = av.compare(VectorOperators.GT, bv);
4766 
4767                 // Check results as part of computation.
4768                 for (int j = 0; j < SPECIES.length(); j++) {
4769                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
4770                 }
4771             }
4772         }
4773     }
4774 
4775     @Test(dataProvider = "byteCompareOpMaskProvider")
4776     static void GTByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
4777                                                 IntFunction<boolean[]> fm) {
4778         byte[] a = fa.apply(SPECIES.length());
4779         byte[] b = fb.apply(SPECIES.length());
4780         boolean[] mask = fm.apply(SPECIES.length());
4781 
4782         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4783 
4784         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4785             for (int i = 0; i < a.length; i += SPECIES.length()) {
4786                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4787                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4788                 VectorMask<Byte> mv = av.compare(VectorOperators.GT, bv, vmask);
4789 
4790                 // Check results as part of computation.
4791                 for (int j = 0; j < SPECIES.length(); j++) {
4792                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
4793                 }
4794             }
4795         }
4796     }
4797 
4798     @Test(dataProvider = "byteCompareOpProvider")
4799     static void EQByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4800         byte[] a = fa.apply(SPECIES.length());
4801         byte[] b = fb.apply(SPECIES.length());
4802 
4803         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4804             for (int i = 0; i < a.length; i += SPECIES.length()) {
4805                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4806                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4807                 VectorMask<Byte> mv = av.compare(VectorOperators.EQ, bv);
4808 
4809                 // Check results as part of computation.
4810                 for (int j = 0; j < SPECIES.length(); j++) {
4811                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
4812                 }
4813             }
4814         }
4815     }
4816 
4817     @Test(dataProvider = "byteCompareOpProvider")
4818     static void eqByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4819         byte[] a = fa.apply(SPECIES.length());
4820         byte[] b = fb.apply(SPECIES.length());
4821 
4822         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4823             for (int i = 0; i < a.length; i += SPECIES.length()) {
4824                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4825                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4826                 VectorMask<Byte> mv = av.eq(bv);
4827 
4828                 // Check results as part of computation.
4829                 for (int j = 0; j < SPECIES.length(); j++) {
4830                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
4831                 }
4832             }
4833         }
4834     }
4835 
4836     @Test(dataProvider = "byteCompareOpMaskProvider")
4837     static void EQByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
4838                                                 IntFunction<boolean[]> fm) {
4839         byte[] a = fa.apply(SPECIES.length());
4840         byte[] b = fb.apply(SPECIES.length());
4841         boolean[] mask = fm.apply(SPECIES.length());
4842 
4843         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4844 
4845         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4846             for (int i = 0; i < a.length; i += SPECIES.length()) {
4847                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4848                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4849                 VectorMask<Byte> mv = av.compare(VectorOperators.EQ, bv, vmask);
4850 
4851                 // Check results as part of computation.
4852                 for (int j = 0; j < SPECIES.length(); j++) {
4853                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
4854                 }
4855             }
4856         }
4857     }
4858 
4859     @Test(dataProvider = "byteCompareOpProvider")
4860     static void NEByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4861         byte[] a = fa.apply(SPECIES.length());
4862         byte[] b = fb.apply(SPECIES.length());
4863 
4864         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4865             for (int i = 0; i < a.length; i += SPECIES.length()) {
4866                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4867                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4868                 VectorMask<Byte> mv = av.compare(VectorOperators.NE, bv);
4869 
4870                 // Check results as part of computation.
4871                 for (int j = 0; j < SPECIES.length(); j++) {
4872                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
4873                 }
4874             }
4875         }
4876     }
4877 
4878     @Test(dataProvider = "byteCompareOpMaskProvider")
4879     static void NEByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
4880                                                 IntFunction<boolean[]> fm) {
4881         byte[] a = fa.apply(SPECIES.length());
4882         byte[] b = fb.apply(SPECIES.length());
4883         boolean[] mask = fm.apply(SPECIES.length());
4884 
4885         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4886 
4887         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4888             for (int i = 0; i < a.length; i += SPECIES.length()) {
4889                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4890                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4891                 VectorMask<Byte> mv = av.compare(VectorOperators.NE, bv, vmask);
4892 
4893                 // Check results as part of computation.
4894                 for (int j = 0; j < SPECIES.length(); j++) {
4895                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
4896                 }
4897             }
4898         }
4899     }
4900 
4901     @Test(dataProvider = "byteCompareOpProvider")
4902     static void LEByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4903         byte[] a = fa.apply(SPECIES.length());
4904         byte[] b = fb.apply(SPECIES.length());
4905 
4906         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4907             for (int i = 0; i < a.length; i += SPECIES.length()) {
4908                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4909                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4910                 VectorMask<Byte> mv = av.compare(VectorOperators.LE, bv);
4911 
4912                 // Check results as part of computation.
4913                 for (int j = 0; j < SPECIES.length(); j++) {
4914                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
4915                 }
4916             }
4917         }
4918     }
4919 
4920     @Test(dataProvider = "byteCompareOpMaskProvider")
4921     static void LEByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
4922                                                 IntFunction<boolean[]> fm) {
4923         byte[] a = fa.apply(SPECIES.length());
4924         byte[] b = fb.apply(SPECIES.length());
4925         boolean[] mask = fm.apply(SPECIES.length());
4926 
4927         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4928 
4929         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4930             for (int i = 0; i < a.length; i += SPECIES.length()) {
4931                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4932                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4933                 VectorMask<Byte> mv = av.compare(VectorOperators.LE, bv, vmask);
4934 
4935                 // Check results as part of computation.
4936                 for (int j = 0; j < SPECIES.length(); j++) {
4937                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
4938                 }
4939             }
4940         }
4941     }
4942 
4943     @Test(dataProvider = "byteCompareOpProvider")
4944     static void GEByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4945         byte[] a = fa.apply(SPECIES.length());
4946         byte[] b = fb.apply(SPECIES.length());
4947 
4948         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4949             for (int i = 0; i < a.length; i += SPECIES.length()) {
4950                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4951                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4952                 VectorMask<Byte> mv = av.compare(VectorOperators.GE, bv);
4953 
4954                 // Check results as part of computation.
4955                 for (int j = 0; j < SPECIES.length(); j++) {
4956                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
4957                 }
4958             }
4959         }
4960     }
4961 
4962     @Test(dataProvider = "byteCompareOpMaskProvider")
4963     static void GEByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
4964                                                 IntFunction<boolean[]> fm) {
4965         byte[] a = fa.apply(SPECIES.length());
4966         byte[] b = fb.apply(SPECIES.length());
4967         boolean[] mask = fm.apply(SPECIES.length());
4968 
4969         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4970 
4971         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4972             for (int i = 0; i < a.length; i += SPECIES.length()) {
4973                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4974                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4975                 VectorMask<Byte> mv = av.compare(VectorOperators.GE, bv, vmask);
4976 
4977                 // Check results as part of computation.
4978                 for (int j = 0; j < SPECIES.length(); j++) {
4979                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
4980                 }
4981             }
4982         }
4983     }
4984 
4985     @Test(dataProvider = "byteCompareOpProvider")
4986     static void ULTByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
4987         byte[] a = fa.apply(SPECIES.length());
4988         byte[] b = fb.apply(SPECIES.length());
4989 
4990         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4991             for (int i = 0; i < a.length; i += SPECIES.length()) {
4992                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
4993                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
4994                 VectorMask<Byte> mv = av.compare(VectorOperators.ULT, bv);
4995 
4996                 // Check results as part of computation.
4997                 for (int j = 0; j < SPECIES.length(); j++) {
4998                     Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j]));
4999                 }
5000             }
5001         }
5002     }
5003 
5004     @Test(dataProvider = "byteCompareOpMaskProvider")
5005     static void ULTByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5006                                                 IntFunction<boolean[]> fm) {
5007         byte[] a = fa.apply(SPECIES.length());
5008         byte[] b = fb.apply(SPECIES.length());
5009         boolean[] mask = fm.apply(SPECIES.length());
5010 
5011         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5012 
5013         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5014             for (int i = 0; i < a.length; i += SPECIES.length()) {
5015                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5016                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5017                 VectorMask<Byte> mv = av.compare(VectorOperators.ULT, bv, vmask);
5018 
5019                 // Check results as part of computation.
5020                 for (int j = 0; j < SPECIES.length(); j++) {
5021                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j]));
5022                 }
5023             }
5024         }
5025     }
5026 
5027     @Test(dataProvider = "byteCompareOpProvider")
5028     static void UGTByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5029         byte[] a = fa.apply(SPECIES.length());
5030         byte[] b = fb.apply(SPECIES.length());
5031 
5032         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5033             for (int i = 0; i < a.length; i += SPECIES.length()) {
5034                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5035                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5036                 VectorMask<Byte> mv = av.compare(VectorOperators.UGT, bv);
5037 
5038                 // Check results as part of computation.
5039                 for (int j = 0; j < SPECIES.length(); j++) {
5040                     Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j]));
5041                 }
5042             }
5043         }
5044     }
5045 
5046     @Test(dataProvider = "byteCompareOpMaskProvider")
5047     static void UGTByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5048                                                 IntFunction<boolean[]> fm) {
5049         byte[] a = fa.apply(SPECIES.length());
5050         byte[] b = fb.apply(SPECIES.length());
5051         boolean[] mask = fm.apply(SPECIES.length());
5052 
5053         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5054 
5055         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5056             for (int i = 0; i < a.length; i += SPECIES.length()) {
5057                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5058                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5059                 VectorMask<Byte> mv = av.compare(VectorOperators.UGT, bv, vmask);
5060 
5061                 // Check results as part of computation.
5062                 for (int j = 0; j < SPECIES.length(); j++) {
5063                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j]));
5064                 }
5065             }
5066         }
5067     }
5068 
5069     @Test(dataProvider = "byteCompareOpProvider")
5070     static void ULEByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5071         byte[] a = fa.apply(SPECIES.length());
5072         byte[] b = fb.apply(SPECIES.length());
5073 
5074         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5075             for (int i = 0; i < a.length; i += SPECIES.length()) {
5076                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5077                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5078                 VectorMask<Byte> mv = av.compare(VectorOperators.ULE, bv);
5079 
5080                 // Check results as part of computation.
5081                 for (int j = 0; j < SPECIES.length(); j++) {
5082                     Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j]));
5083                 }
5084             }
5085         }
5086     }
5087 
5088     @Test(dataProvider = "byteCompareOpMaskProvider")
5089     static void ULEByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5090                                                 IntFunction<boolean[]> fm) {
5091         byte[] a = fa.apply(SPECIES.length());
5092         byte[] b = fb.apply(SPECIES.length());
5093         boolean[] mask = fm.apply(SPECIES.length());
5094 
5095         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5096 
5097         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5098             for (int i = 0; i < a.length; i += SPECIES.length()) {
5099                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5100                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5101                 VectorMask<Byte> mv = av.compare(VectorOperators.ULE, bv, vmask);
5102 
5103                 // Check results as part of computation.
5104                 for (int j = 0; j < SPECIES.length(); j++) {
5105                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j]));
5106                 }
5107             }
5108         }
5109     }
5110 
5111     @Test(dataProvider = "byteCompareOpProvider")
5112     static void UGEByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5113         byte[] a = fa.apply(SPECIES.length());
5114         byte[] b = fb.apply(SPECIES.length());
5115 
5116         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5117             for (int i = 0; i < a.length; i += SPECIES.length()) {
5118                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5119                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5120                 VectorMask<Byte> mv = av.compare(VectorOperators.UGE, bv);
5121 
5122                 // Check results as part of computation.
5123                 for (int j = 0; j < SPECIES.length(); j++) {
5124                     Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j]));
5125                 }
5126             }
5127         }
5128     }
5129 
5130     @Test(dataProvider = "byteCompareOpMaskProvider")
5131     static void UGEByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5132                                                 IntFunction<boolean[]> fm) {
5133         byte[] a = fa.apply(SPECIES.length());
5134         byte[] b = fb.apply(SPECIES.length());
5135         boolean[] mask = fm.apply(SPECIES.length());
5136 
5137         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5138 
5139         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5140             for (int i = 0; i < a.length; i += SPECIES.length()) {
5141                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5142                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5143                 VectorMask<Byte> mv = av.compare(VectorOperators.UGE, bv, vmask);
5144 
5145                 // Check results as part of computation.
5146                 for (int j = 0; j < SPECIES.length(); j++) {
5147                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j]));
5148                 }
5149             }
5150         }
5151     }
5152 
5153     @Test(dataProvider = "byteCompareOpProvider")
5154     static void LTByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5155         byte[] a = fa.apply(SPECIES.length());
5156         byte[] b = fb.apply(SPECIES.length());
5157 
5158         for (int i = 0; i < a.length; i += SPECIES.length()) {
5159             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5160             VectorMask<Byte> mv = av.compare(VectorOperators.LT, b[i]);
5161 
5162             // Check results as part of computation.
5163             for (int j = 0; j < SPECIES.length(); j++) {
5164                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
5165             }
5166         }
5167     }
5168 
5169     @Test(dataProvider = "byteCompareOpMaskProvider")
5170     static void LTByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa,
5171                                 IntFunction<byte[]> fb, IntFunction<boolean[]> fm) {
5172         byte[] a = fa.apply(SPECIES.length());
5173         byte[] b = fb.apply(SPECIES.length());
5174         boolean[] mask = fm.apply(SPECIES.length());
5175 
5176         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5177 
5178         for (int i = 0; i < a.length; i += SPECIES.length()) {
5179             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5180             VectorMask<Byte> mv = av.compare(VectorOperators.LT, b[i], vmask);
5181 
5182             // Check results as part of computation.
5183             for (int j = 0; j < SPECIES.length(); j++) {
5184                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
5185             }
5186         }
5187     }
5188 
5189     @Test(dataProvider = "byteCompareOpProvider")
5190     static void LTByte128VectorTestsBroadcastLongSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5191         byte[] a = fa.apply(SPECIES.length());
5192         byte[] b = fb.apply(SPECIES.length());
5193 
5194         for (int i = 0; i < a.length; i += SPECIES.length()) {
5195             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5196             VectorMask<Byte> mv = av.compare(VectorOperators.LT, (long)b[i]);
5197 
5198             // Check results as part of computation.
5199             for (int j = 0; j < SPECIES.length(); j++) {
5200                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i]));
5201             }
5202         }
5203     }
5204 
5205     @Test(dataProvider = "byteCompareOpMaskProvider")
5206     static void LTByte128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<byte[]> fa,
5207                                 IntFunction<byte[]> fb, IntFunction<boolean[]> fm) {
5208         byte[] a = fa.apply(SPECIES.length());
5209         byte[] b = fb.apply(SPECIES.length());
5210         boolean[] mask = fm.apply(SPECIES.length());
5211 
5212         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5213 
5214         for (int i = 0; i < a.length; i += SPECIES.length()) {
5215             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5216             VectorMask<Byte> mv = av.compare(VectorOperators.LT, (long)b[i], vmask);
5217 
5218             // Check results as part of computation.
5219             for (int j = 0; j < SPECIES.length(); j++) {
5220                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i])));
5221             }
5222         }
5223     }
5224 
5225     @Test(dataProvider = "byteCompareOpProvider")
5226     static void EQByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5227         byte[] a = fa.apply(SPECIES.length());
5228         byte[] b = fb.apply(SPECIES.length());
5229 
5230         for (int i = 0; i < a.length; i += SPECIES.length()) {
5231             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5232             VectorMask<Byte> mv = av.compare(VectorOperators.EQ, b[i]);
5233 
5234             // Check results as part of computation.
5235             for (int j = 0; j < SPECIES.length(); j++) {
5236                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
5237             }
5238         }
5239     }
5240 
5241     @Test(dataProvider = "byteCompareOpMaskProvider")
5242     static void EQByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa,
5243                                 IntFunction<byte[]> fb, IntFunction<boolean[]> fm) {
5244         byte[] a = fa.apply(SPECIES.length());
5245         byte[] b = fb.apply(SPECIES.length());
5246         boolean[] mask = fm.apply(SPECIES.length());
5247 
5248         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5249 
5250         for (int i = 0; i < a.length; i += SPECIES.length()) {
5251             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5252             VectorMask<Byte> mv = av.compare(VectorOperators.EQ, b[i], vmask);
5253 
5254             // Check results as part of computation.
5255             for (int j = 0; j < SPECIES.length(); j++) {
5256                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
5257             }
5258         }
5259     }
5260 
5261     @Test(dataProvider = "byteCompareOpProvider")
5262     static void EQByte128VectorTestsBroadcastLongSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5263         byte[] a = fa.apply(SPECIES.length());
5264         byte[] b = fb.apply(SPECIES.length());
5265 
5266         for (int i = 0; i < a.length; i += SPECIES.length()) {
5267             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5268             VectorMask<Byte> mv = av.compare(VectorOperators.EQ, (long)b[i]);
5269 
5270             // Check results as part of computation.
5271             for (int j = 0; j < SPECIES.length(); j++) {
5272                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i]));
5273             }
5274         }
5275     }
5276 
5277     @Test(dataProvider = "byteCompareOpMaskProvider")
5278     static void EQByte128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<byte[]> fa,
5279                                 IntFunction<byte[]> fb, IntFunction<boolean[]> fm) {
5280         byte[] a = fa.apply(SPECIES.length());
5281         byte[] b = fb.apply(SPECIES.length());
5282         boolean[] mask = fm.apply(SPECIES.length());
5283 
5284         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5285 
5286         for (int i = 0; i < a.length; i += SPECIES.length()) {
5287             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5288             VectorMask<Byte> mv = av.compare(VectorOperators.EQ, (long)b[i], vmask);
5289 
5290             // Check results as part of computation.
5291             for (int j = 0; j < SPECIES.length(); j++) {
5292                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i])));
5293             }
5294         }
5295     }
5296 
5297     static byte blend(byte a, byte b, boolean mask) {
5298         return mask ? b : a;
5299     }
5300 
5301     @Test(dataProvider = "byteBinaryOpMaskProvider")
5302     static void blendByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5303                                           IntFunction<boolean[]> fm) {
5304         byte[] a = fa.apply(SPECIES.length());
5305         byte[] b = fb.apply(SPECIES.length());
5306         byte[] r = fr.apply(SPECIES.length());
5307         boolean[] mask = fm.apply(SPECIES.length());
5308         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5309 
5310         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5311             for (int i = 0; i < a.length; i += SPECIES.length()) {
5312                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5313                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5314                 av.blend(bv, vmask).intoArray(r, i);
5315             }
5316         }
5317 
5318         assertArraysEquals(r, a, b, mask, Byte128VectorTests::blend);
5319     }
5320 
5321     @Test(dataProvider = "byteUnaryOpShuffleProvider")
5322     static void RearrangeByte128VectorTests(IntFunction<byte[]> fa,
5323                                            BiFunction<Integer,Integer,int[]> fs) {
5324         byte[] a = fa.apply(SPECIES.length());
5325         int[] order = fs.apply(a.length, SPECIES.length());
5326         byte[] r = fr.apply(SPECIES.length());
5327 
5328         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5329             for (int i = 0; i < a.length; i += SPECIES.length()) {
5330                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5331                 av.rearrange(VectorShuffle.fromArray(SPECIES, order, i)).intoArray(r, i);
5332             }
5333         }
5334 
5335         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
5336     }
5337 
5338     @Test(dataProvider = "byteUnaryOpShuffleMaskProvider")
5339     static void RearrangeByte128VectorTestsMaskedSmokeTest(IntFunction<byte[]> fa,
5340                                                           BiFunction<Integer,Integer,int[]> fs,
5341                                                           IntFunction<boolean[]> fm) {
5342         byte[] a = fa.apply(SPECIES.length());
5343         int[] order = fs.apply(a.length, SPECIES.length());
5344         byte[] r = fr.apply(SPECIES.length());
5345         boolean[] mask = fm.apply(SPECIES.length());
5346         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5347 
5348         for (int i = 0; i < a.length; i += SPECIES.length()) {
5349             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5350             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
5351         }
5352 
5353         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
5354     }
5355 
5356     @Test(dataProvider = "byteUnaryOpMaskProvider")
5357     static void compressByte128VectorTests(IntFunction<byte[]> fa,
5358                                                 IntFunction<boolean[]> fm) {
5359         byte[] a = fa.apply(SPECIES.length());
5360         byte[] r = fr.apply(SPECIES.length());
5361         boolean[] mask = fm.apply(SPECIES.length());
5362         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5363 
5364         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5365             for (int i = 0; i < a.length; i += SPECIES.length()) {
5366                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5367                 av.compress(vmask).intoArray(r, i);
5368             }
5369         }
5370 
5371         assertcompressArraysEquals(r, a, mask, SPECIES.length());
5372     }
5373 
5374     @Test(dataProvider = "byteUnaryOpMaskProvider")
5375     static void expandByte128VectorTests(IntFunction<byte[]> fa,
5376                                                 IntFunction<boolean[]> fm) {
5377         byte[] a = fa.apply(SPECIES.length());
5378         byte[] r = fr.apply(SPECIES.length());
5379         boolean[] mask = fm.apply(SPECIES.length());
5380         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5381 
5382         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5383             for (int i = 0; i < a.length; i += SPECIES.length()) {
5384                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5385                 av.expand(vmask).intoArray(r, i);
5386             }
5387         }
5388 
5389         assertexpandArraysEquals(r, a, mask, SPECIES.length());
5390     }
5391 
5392     @Test(dataProvider = "byteUnaryOpProvider")
5393     static void getByte128VectorTests(IntFunction<byte[]> fa) {
5394         byte[] a = fa.apply(SPECIES.length());
5395         byte[] r = fr.apply(SPECIES.length());
5396 
5397         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5398             for (int i = 0; i < a.length; i += SPECIES.length()) {
5399                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5400                 int num_lanes = SPECIES.length();
5401                 // Manually unroll because full unroll happens after intrinsification.
5402                 // Unroll is needed because get intrinsic requires for index to be a known constant.
5403                 if (num_lanes == 1) {
5404                     r[i]=av.lane(0);
5405                 } else if (num_lanes == 2) {
5406                     r[i]=av.lane(0);
5407                     r[i+1]=av.lane(1);
5408                 } else if (num_lanes == 4) {
5409                     r[i]=av.lane(0);
5410                     r[i+1]=av.lane(1);
5411                     r[i+2]=av.lane(2);
5412                     r[i+3]=av.lane(3);
5413                 } else if (num_lanes == 8) {
5414                     r[i]=av.lane(0);
5415                     r[i+1]=av.lane(1);
5416                     r[i+2]=av.lane(2);
5417                     r[i+3]=av.lane(3);
5418                     r[i+4]=av.lane(4);
5419                     r[i+5]=av.lane(5);
5420                     r[i+6]=av.lane(6);
5421                     r[i+7]=av.lane(7);
5422                 } else if (num_lanes == 16) {
5423                     r[i]=av.lane(0);
5424                     r[i+1]=av.lane(1);
5425                     r[i+2]=av.lane(2);
5426                     r[i+3]=av.lane(3);
5427                     r[i+4]=av.lane(4);
5428                     r[i+5]=av.lane(5);
5429                     r[i+6]=av.lane(6);
5430                     r[i+7]=av.lane(7);
5431                     r[i+8]=av.lane(8);
5432                     r[i+9]=av.lane(9);
5433                     r[i+10]=av.lane(10);
5434                     r[i+11]=av.lane(11);
5435                     r[i+12]=av.lane(12);
5436                     r[i+13]=av.lane(13);
5437                     r[i+14]=av.lane(14);
5438                     r[i+15]=av.lane(15);
5439                 } else if (num_lanes == 32) {
5440                     r[i]=av.lane(0);
5441                     r[i+1]=av.lane(1);
5442                     r[i+2]=av.lane(2);
5443                     r[i+3]=av.lane(3);
5444                     r[i+4]=av.lane(4);
5445                     r[i+5]=av.lane(5);
5446                     r[i+6]=av.lane(6);
5447                     r[i+7]=av.lane(7);
5448                     r[i+8]=av.lane(8);
5449                     r[i+9]=av.lane(9);
5450                     r[i+10]=av.lane(10);
5451                     r[i+11]=av.lane(11);
5452                     r[i+12]=av.lane(12);
5453                     r[i+13]=av.lane(13);
5454                     r[i+14]=av.lane(14);
5455                     r[i+15]=av.lane(15);
5456                     r[i+16]=av.lane(16);
5457                     r[i+17]=av.lane(17);
5458                     r[i+18]=av.lane(18);
5459                     r[i+19]=av.lane(19);
5460                     r[i+20]=av.lane(20);
5461                     r[i+21]=av.lane(21);
5462                     r[i+22]=av.lane(22);
5463                     r[i+23]=av.lane(23);
5464                     r[i+24]=av.lane(24);
5465                     r[i+25]=av.lane(25);
5466                     r[i+26]=av.lane(26);
5467                     r[i+27]=av.lane(27);
5468                     r[i+28]=av.lane(28);
5469                     r[i+29]=av.lane(29);
5470                     r[i+30]=av.lane(30);
5471                     r[i+31]=av.lane(31);
5472                 } else if (num_lanes == 64) {
5473                     r[i]=av.lane(0);
5474                     r[i+1]=av.lane(1);
5475                     r[i+2]=av.lane(2);
5476                     r[i+3]=av.lane(3);
5477                     r[i+4]=av.lane(4);
5478                     r[i+5]=av.lane(5);
5479                     r[i+6]=av.lane(6);
5480                     r[i+7]=av.lane(7);
5481                     r[i+8]=av.lane(8);
5482                     r[i+9]=av.lane(9);
5483                     r[i+10]=av.lane(10);
5484                     r[i+11]=av.lane(11);
5485                     r[i+12]=av.lane(12);
5486                     r[i+13]=av.lane(13);
5487                     r[i+14]=av.lane(14);
5488                     r[i+15]=av.lane(15);
5489                     r[i+16]=av.lane(16);
5490                     r[i+17]=av.lane(17);
5491                     r[i+18]=av.lane(18);
5492                     r[i+19]=av.lane(19);
5493                     r[i+20]=av.lane(20);
5494                     r[i+21]=av.lane(21);
5495                     r[i+22]=av.lane(22);
5496                     r[i+23]=av.lane(23);
5497                     r[i+24]=av.lane(24);
5498                     r[i+25]=av.lane(25);
5499                     r[i+26]=av.lane(26);
5500                     r[i+27]=av.lane(27);
5501                     r[i+28]=av.lane(28);
5502                     r[i+29]=av.lane(29);
5503                     r[i+30]=av.lane(30);
5504                     r[i+31]=av.lane(31);
5505                     r[i+32]=av.lane(32);
5506                     r[i+33]=av.lane(33);
5507                     r[i+34]=av.lane(34);
5508                     r[i+35]=av.lane(35);
5509                     r[i+36]=av.lane(36);
5510                     r[i+37]=av.lane(37);
5511                     r[i+38]=av.lane(38);
5512                     r[i+39]=av.lane(39);
5513                     r[i+40]=av.lane(40);
5514                     r[i+41]=av.lane(41);
5515                     r[i+42]=av.lane(42);
5516                     r[i+43]=av.lane(43);
5517                     r[i+44]=av.lane(44);
5518                     r[i+45]=av.lane(45);
5519                     r[i+46]=av.lane(46);
5520                     r[i+47]=av.lane(47);
5521                     r[i+48]=av.lane(48);
5522                     r[i+49]=av.lane(49);
5523                     r[i+50]=av.lane(50);
5524                     r[i+51]=av.lane(51);
5525                     r[i+52]=av.lane(52);
5526                     r[i+53]=av.lane(53);
5527                     r[i+54]=av.lane(54);
5528                     r[i+55]=av.lane(55);
5529                     r[i+56]=av.lane(56);
5530                     r[i+57]=av.lane(57);
5531                     r[i+58]=av.lane(58);
5532                     r[i+59]=av.lane(59);
5533                     r[i+60]=av.lane(60);
5534                     r[i+61]=av.lane(61);
5535                     r[i+62]=av.lane(62);
5536                     r[i+63]=av.lane(63);
5537                 } else {
5538                     for (int j = 0; j < SPECIES.length(); j++) {
5539                         r[i+j]=av.lane(j);
5540                     }
5541                 }
5542             }
5543         }
5544 
5545         assertArraysStrictlyEquals(r, a);
5546     }
5547 
5548     @Test(dataProvider = "byteUnaryOpProvider")
5549     static void BroadcastByte128VectorTests(IntFunction<byte[]> fa) {
5550         byte[] a = fa.apply(SPECIES.length());
5551         byte[] r = new byte[a.length];
5552 
5553         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5554             for (int i = 0; i < a.length; i += SPECIES.length()) {
5555                 ByteVector.broadcast(SPECIES, a[i]).intoArray(r, i);
5556             }
5557         }
5558 
5559         assertBroadcastArraysEquals(r, a);
5560     }
5561 
5562     @Test(dataProvider = "byteUnaryOpProvider")
5563     static void ZeroByte128VectorTests(IntFunction<byte[]> fa) {
5564         byte[] a = fa.apply(SPECIES.length());
5565         byte[] r = new byte[a.length];
5566 
5567         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5568             for (int i = 0; i < a.length; i += SPECIES.length()) {
5569                 ByteVector.zero(SPECIES).intoArray(a, i);
5570             }
5571         }
5572 
5573         Assert.assertEquals(a, r);
5574     }
5575 
5576     static byte[] sliceUnary(byte[] a, int origin, int idx) {
5577         byte[] res = new byte[SPECIES.length()];
5578         for (int i = 0; i < SPECIES.length(); i++){
5579             if(i+origin < SPECIES.length())
5580                 res[i] = a[idx+i+origin];
5581             else
5582                 res[i] = (byte)0;
5583         }
5584         return res;
5585     }
5586 
5587     @Test(dataProvider = "byteUnaryOpProvider")
5588     static void sliceUnaryByte128VectorTests(IntFunction<byte[]> fa) {
5589         byte[] a = fa.apply(SPECIES.length());
5590         byte[] r = new byte[a.length];
5591         int origin = RAND.nextInt(SPECIES.length());
5592         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5593             for (int i = 0; i < a.length; i += SPECIES.length()) {
5594                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5595                 av.slice(origin).intoArray(r, i);
5596             }
5597         }
5598 
5599         assertArraysEquals(r, a, origin, Byte128VectorTests::sliceUnary);
5600     }
5601 
5602     static byte[] sliceBinary(byte[] a, byte[] b, int origin, int idx) {
5603         byte[] res = new byte[SPECIES.length()];
5604         for (int i = 0, j = 0; i < SPECIES.length(); i++){
5605             if(i+origin < SPECIES.length())
5606                 res[i] = a[idx+i+origin];
5607             else {
5608                 res[i] = b[idx+j];
5609                 j++;
5610             }
5611         }
5612         return res;
5613     }
5614 
5615     @Test(dataProvider = "byteBinaryOpProvider")
5616     static void sliceBinaryByte128VectorTestsBinary(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5617         byte[] a = fa.apply(SPECIES.length());
5618         byte[] b = fb.apply(SPECIES.length());
5619         byte[] r = new byte[a.length];
5620         int origin = RAND.nextInt(SPECIES.length());
5621         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5622             for (int i = 0; i < a.length; i += SPECIES.length()) {
5623                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5624                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5625                 av.slice(origin, bv).intoArray(r, i);
5626             }
5627         }
5628 
5629         assertArraysEquals(r, a, b, origin, Byte128VectorTests::sliceBinary);
5630     }
5631 
5632     static byte[] slice(byte[] a, byte[] b, int origin, boolean[] mask, int idx) {
5633         byte[] res = new byte[SPECIES.length()];
5634         for (int i = 0, j = 0; i < SPECIES.length(); i++){
5635             if(i+origin < SPECIES.length())
5636                 res[i] = mask[i] ? a[idx+i+origin] : (byte)0;
5637             else {
5638                 res[i] = mask[i] ? b[idx+j] : (byte)0;
5639                 j++;
5640             }
5641         }
5642         return res;
5643     }
5644 
5645     @Test(dataProvider = "byteBinaryOpMaskProvider")
5646     static void sliceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5647     IntFunction<boolean[]> fm) {
5648         byte[] a = fa.apply(SPECIES.length());
5649         byte[] b = fb.apply(SPECIES.length());
5650         boolean[] mask = fm.apply(SPECIES.length());
5651         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5652 
5653         byte[] r = new byte[a.length];
5654         int origin = RAND.nextInt(SPECIES.length());
5655         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5656             for (int i = 0; i < a.length; i += SPECIES.length()) {
5657                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5658                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5659                 av.slice(origin, bv, vmask).intoArray(r, i);
5660             }
5661         }
5662 
5663         assertArraysEquals(r, a, b, origin, mask, Byte128VectorTests::slice);
5664     }
5665 
5666     static byte[] unsliceUnary(byte[] a, int origin, int idx) {
5667         byte[] res = new byte[SPECIES.length()];
5668         for (int i = 0, j = 0; i < SPECIES.length(); i++){
5669             if(i < origin)
5670                 res[i] = (byte)0;
5671             else {
5672                 res[i] = a[idx+j];
5673                 j++;
5674             }
5675         }
5676         return res;
5677     }
5678 
5679     @Test(dataProvider = "byteUnaryOpProvider")
5680     static void unsliceUnaryByte128VectorTests(IntFunction<byte[]> fa) {
5681         byte[] a = fa.apply(SPECIES.length());
5682         byte[] r = new byte[a.length];
5683         int origin = RAND.nextInt(SPECIES.length());
5684         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5685             for (int i = 0; i < a.length; i += SPECIES.length()) {
5686                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5687                 av.unslice(origin).intoArray(r, i);
5688             }
5689         }
5690 
5691         assertArraysEquals(r, a, origin, Byte128VectorTests::unsliceUnary);
5692     }
5693 
5694     static byte[] unsliceBinary(byte[] a, byte[] b, int origin, int part, int idx) {
5695         byte[] res = new byte[SPECIES.length()];
5696         for (int i = 0, j = 0; i < SPECIES.length(); i++){
5697             if (part == 0) {
5698                 if (i < origin)
5699                     res[i] = b[idx+i];
5700                 else {
5701                     res[i] = a[idx+j];
5702                     j++;
5703                 }
5704             } else if (part == 1) {
5705                 if (i < origin)
5706                     res[i] = a[idx+SPECIES.length()-origin+i];
5707                 else {
5708                     res[i] = b[idx+origin+j];
5709                     j++;
5710                 }
5711             }
5712         }
5713         return res;
5714     }
5715 
5716     @Test(dataProvider = "byteBinaryOpProvider")
5717     static void unsliceBinaryByte128VectorTestsBinary(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
5718         byte[] a = fa.apply(SPECIES.length());
5719         byte[] b = fb.apply(SPECIES.length());
5720         byte[] r = new byte[a.length];
5721         int origin = RAND.nextInt(SPECIES.length());
5722         int part = RAND.nextInt(2);
5723         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5724             for (int i = 0; i < a.length; i += SPECIES.length()) {
5725                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5726                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5727                 av.unslice(origin, bv, part).intoArray(r, i);
5728             }
5729         }
5730 
5731         assertArraysEquals(r, a, b, origin, part, Byte128VectorTests::unsliceBinary);
5732     }
5733 
5734     static byte[] unslice(byte[] a, byte[] b, int origin, int part, boolean[] mask, int idx) {
5735         byte[] res = new byte[SPECIES.length()];
5736         for (int i = 0, j = 0; i < SPECIES.length(); i++){
5737             if(i+origin < SPECIES.length())
5738                 res[i] = b[idx+i+origin];
5739             else {
5740                 res[i] = b[idx+j];
5741                 j++;
5742             }
5743         }
5744         for (int i = 0; i < SPECIES.length(); i++){
5745             res[i] = mask[i] ? a[idx+i] : res[i];
5746         }
5747         byte[] res1 = new byte[SPECIES.length()];
5748         if (part == 0) {
5749             for (int i = 0, j = 0; i < SPECIES.length(); i++){
5750                 if (i < origin)
5751                     res1[i] = b[idx+i];
5752                 else {
5753                    res1[i] = res[j];
5754                    j++;
5755                 }
5756             }
5757         } else if (part == 1) {
5758             for (int i = 0, j = 0; i < SPECIES.length(); i++){
5759                 if (i < origin)
5760                     res1[i] = res[SPECIES.length()-origin+i];
5761                 else {
5762                     res1[i] = b[idx+origin+j];
5763                     j++;
5764                 }
5765             }
5766         }
5767         return res1;
5768     }
5769 
5770     @Test(dataProvider = "byteBinaryOpMaskProvider")
5771     static void unsliceByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5772     IntFunction<boolean[]> fm) {
5773         byte[] a = fa.apply(SPECIES.length());
5774         byte[] b = fb.apply(SPECIES.length());
5775         boolean[] mask = fm.apply(SPECIES.length());
5776         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5777         byte[] r = new byte[a.length];
5778         int origin = RAND.nextInt(SPECIES.length());
5779         int part = RAND.nextInt(2);
5780         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5781             for (int i = 0; i < a.length; i += SPECIES.length()) {
5782                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5783                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5784                 av.unslice(origin, bv, part, vmask).intoArray(r, i);
5785             }
5786         }
5787 
5788         assertArraysEquals(r, a, b, origin, part, mask, Byte128VectorTests::unslice);
5789     }
5790 
5791     static byte BITWISE_BLEND(byte a, byte b, byte c) {
5792         return (byte)((a&~(c))|(b&c));
5793     }
5794 
5795     static byte bitwiseBlend(byte a, byte b, byte c) {
5796         return (byte)((a&~(c))|(b&c));
5797     }
5798 
5799     @Test(dataProvider = "byteTernaryOpProvider")
5800     static void BITWISE_BLENDByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5801         byte[] a = fa.apply(SPECIES.length());
5802         byte[] b = fb.apply(SPECIES.length());
5803         byte[] c = fc.apply(SPECIES.length());
5804         byte[] r = fr.apply(SPECIES.length());
5805 
5806         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5807             for (int i = 0; i < a.length; i += SPECIES.length()) {
5808                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5809                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5810                 ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
5811                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv).intoArray(r, i);
5812             }
5813         }
5814 
5815         assertArraysEquals(r, a, b, c, Byte128VectorTests::BITWISE_BLEND);
5816     }
5817 
5818     @Test(dataProvider = "byteTernaryOpProvider")
5819     static void bitwiseBlendByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5820         byte[] a = fa.apply(SPECIES.length());
5821         byte[] b = fb.apply(SPECIES.length());
5822         byte[] c = fc.apply(SPECIES.length());
5823         byte[] r = fr.apply(SPECIES.length());
5824 
5825         for (int i = 0; i < a.length; i += SPECIES.length()) {
5826             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5827             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5828             ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
5829             av.bitwiseBlend(bv, cv).intoArray(r, i);
5830         }
5831 
5832         assertArraysEquals(r, a, b, c, Byte128VectorTests::bitwiseBlend);
5833     }
5834 
5835     @Test(dataProvider = "byteTernaryOpMaskProvider")
5836     static void BITWISE_BLENDByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5837                                           IntFunction<byte[]> fc, IntFunction<boolean[]> fm) {
5838         byte[] a = fa.apply(SPECIES.length());
5839         byte[] b = fb.apply(SPECIES.length());
5840         byte[] c = fc.apply(SPECIES.length());
5841         byte[] r = fr.apply(SPECIES.length());
5842         boolean[] mask = fm.apply(SPECIES.length());
5843         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5844 
5845         for (int ic = 0; ic < INVOC_COUNT; ic++) {
5846             for (int i = 0; i < a.length; i += SPECIES.length()) {
5847                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5848                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5849                 ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
5850                 av.lanewise(VectorOperators.BITWISE_BLEND, bv, cv, vmask).intoArray(r, i);
5851             }
5852         }
5853 
5854         assertArraysEquals(r, a, b, c, mask, Byte128VectorTests::BITWISE_BLEND);
5855     }
5856 
5857     @Test(dataProvider = "byteTernaryOpProvider")
5858     static void BITWISE_BLENDByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5859         byte[] a = fa.apply(SPECIES.length());
5860         byte[] b = fb.apply(SPECIES.length());
5861         byte[] c = fc.apply(SPECIES.length());
5862         byte[] r = fr.apply(SPECIES.length());
5863 
5864         for (int i = 0; i < a.length; i += SPECIES.length()) {
5865             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5866             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5867             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i]).intoArray(r, i);
5868         }
5869         assertBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::BITWISE_BLEND);
5870     }
5871 
5872     @Test(dataProvider = "byteTernaryOpProvider")
5873     static void BITWISE_BLENDByte128VectorTestsAltBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5874         byte[] a = fa.apply(SPECIES.length());
5875         byte[] b = fb.apply(SPECIES.length());
5876         byte[] c = fc.apply(SPECIES.length());
5877         byte[] r = fr.apply(SPECIES.length());
5878 
5879         for (int i = 0; i < a.length; i += SPECIES.length()) {
5880             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5881             ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
5882             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv).intoArray(r, i);
5883         }
5884         assertAltBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::BITWISE_BLEND);
5885     }
5886 
5887     @Test(dataProvider = "byteTernaryOpProvider")
5888     static void bitwiseBlendByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5889         byte[] a = fa.apply(SPECIES.length());
5890         byte[] b = fb.apply(SPECIES.length());
5891         byte[] c = fc.apply(SPECIES.length());
5892         byte[] r = fr.apply(SPECIES.length());
5893 
5894         for (int i = 0; i < a.length; i += SPECIES.length()) {
5895             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5896             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5897             av.bitwiseBlend(bv, c[i]).intoArray(r, i);
5898         }
5899         assertBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::bitwiseBlend);
5900     }
5901 
5902     @Test(dataProvider = "byteTernaryOpProvider")
5903     static void bitwiseBlendByte128VectorTestsAltBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5904         byte[] a = fa.apply(SPECIES.length());
5905         byte[] b = fb.apply(SPECIES.length());
5906         byte[] c = fc.apply(SPECIES.length());
5907         byte[] r = fr.apply(SPECIES.length());
5908 
5909         for (int i = 0; i < a.length; i += SPECIES.length()) {
5910             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5911             ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
5912             av.bitwiseBlend(b[i], cv).intoArray(r, i);
5913         }
5914         assertAltBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::bitwiseBlend);
5915     }
5916 
5917     @Test(dataProvider = "byteTernaryOpMaskProvider")
5918     static void BITWISE_BLENDByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5919                                           IntFunction<byte[]> fc, IntFunction<boolean[]> fm) {
5920         byte[] a = fa.apply(SPECIES.length());
5921         byte[] b = fb.apply(SPECIES.length());
5922         byte[] c = fc.apply(SPECIES.length());
5923         byte[] r = fr.apply(SPECIES.length());
5924         boolean[] mask = fm.apply(SPECIES.length());
5925         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5926 
5927         for (int i = 0; i < a.length; i += SPECIES.length()) {
5928             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5929             ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
5930             av.lanewise(VectorOperators.BITWISE_BLEND, bv, c[i], vmask).intoArray(r, i);
5931         }
5932 
5933         assertBroadcastArraysEquals(r, a, b, c, mask, Byte128VectorTests::BITWISE_BLEND);
5934     }
5935 
5936     @Test(dataProvider = "byteTernaryOpMaskProvider")
5937     static void BITWISE_BLENDByte128VectorTestsAltBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5938                                           IntFunction<byte[]> fc, IntFunction<boolean[]> fm) {
5939         byte[] a = fa.apply(SPECIES.length());
5940         byte[] b = fb.apply(SPECIES.length());
5941         byte[] c = fc.apply(SPECIES.length());
5942         byte[] r = fr.apply(SPECIES.length());
5943         boolean[] mask = fm.apply(SPECIES.length());
5944         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5945 
5946         for (int i = 0; i < a.length; i += SPECIES.length()) {
5947             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5948             ByteVector cv = ByteVector.fromArray(SPECIES, c, i);
5949             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv, vmask).intoArray(r, i);
5950         }
5951 
5952         assertAltBroadcastArraysEquals(r, a, b, c, mask, Byte128VectorTests::BITWISE_BLEND);
5953     }
5954 
5955     @Test(dataProvider = "byteTernaryOpProvider")
5956     static void BITWISE_BLENDByte128VectorTestsDoubleBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5957         byte[] a = fa.apply(SPECIES.length());
5958         byte[] b = fb.apply(SPECIES.length());
5959         byte[] c = fc.apply(SPECIES.length());
5960         byte[] r = fr.apply(SPECIES.length());
5961 
5962         for (int i = 0; i < a.length; i += SPECIES.length()) {
5963             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5964             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i]).intoArray(r, i);
5965         }
5966 
5967         assertDoubleBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::BITWISE_BLEND);
5968     }
5969 
5970     @Test(dataProvider = "byteTernaryOpProvider")
5971     static void bitwiseBlendByte128VectorTestsDoubleBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
5972         byte[] a = fa.apply(SPECIES.length());
5973         byte[] b = fb.apply(SPECIES.length());
5974         byte[] c = fc.apply(SPECIES.length());
5975         byte[] r = fr.apply(SPECIES.length());
5976 
5977         for (int i = 0; i < a.length; i += SPECIES.length()) {
5978             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5979             av.bitwiseBlend(b[i], c[i]).intoArray(r, i);
5980         }
5981 
5982         assertDoubleBroadcastArraysEquals(r, a, b, c, Byte128VectorTests::bitwiseBlend);
5983     }
5984 
5985     @Test(dataProvider = "byteTernaryOpMaskProvider")
5986     static void BITWISE_BLENDByte128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
5987                                           IntFunction<byte[]> fc, IntFunction<boolean[]> fm) {
5988         byte[] a = fa.apply(SPECIES.length());
5989         byte[] b = fb.apply(SPECIES.length());
5990         byte[] c = fc.apply(SPECIES.length());
5991         byte[] r = fr.apply(SPECIES.length());
5992         boolean[] mask = fm.apply(SPECIES.length());
5993         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
5994 
5995         for (int i = 0; i < a.length; i += SPECIES.length()) {
5996             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
5997             av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i], vmask).intoArray(r, i);
5998         }
5999 
6000         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Byte128VectorTests::BITWISE_BLEND);
6001     }
6002 
6003     static byte NEG(byte a) {
6004         return (byte)(-((byte)a));
6005     }
6006 
6007     static byte neg(byte a) {
6008         return (byte)(-((byte)a));
6009     }
6010 
6011     @Test(dataProvider = "byteUnaryOpProvider")
6012     static void NEGByte128VectorTests(IntFunction<byte[]> fa) {
6013         byte[] a = fa.apply(SPECIES.length());
6014         byte[] r = fr.apply(SPECIES.length());
6015 
6016         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6017             for (int i = 0; i < a.length; i += SPECIES.length()) {
6018                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6019                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
6020             }
6021         }
6022 
6023         assertArraysEquals(r, a, Byte128VectorTests::NEG);
6024     }
6025 
6026     @Test(dataProvider = "byteUnaryOpProvider")
6027     static void negByte128VectorTests(IntFunction<byte[]> fa) {
6028         byte[] a = fa.apply(SPECIES.length());
6029         byte[] r = fr.apply(SPECIES.length());
6030 
6031         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6032             for (int i = 0; i < a.length; i += SPECIES.length()) {
6033                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6034                 av.neg().intoArray(r, i);
6035             }
6036         }
6037 
6038         assertArraysEquals(r, a, Byte128VectorTests::neg);
6039     }
6040 
6041     @Test(dataProvider = "byteUnaryOpMaskProvider")
6042     static void NEGMaskedByte128VectorTests(IntFunction<byte[]> fa,
6043                                                 IntFunction<boolean[]> fm) {
6044         byte[] a = fa.apply(SPECIES.length());
6045         byte[] r = fr.apply(SPECIES.length());
6046         boolean[] mask = fm.apply(SPECIES.length());
6047         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6048 
6049         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6050             for (int i = 0; i < a.length; i += SPECIES.length()) {
6051                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6052                 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i);
6053             }
6054         }
6055 
6056         assertArraysEquals(r, a, mask, Byte128VectorTests::NEG);
6057     }
6058 
6059     static byte ABS(byte a) {
6060         return (byte)(Math.abs((byte)a));
6061     }
6062 
6063     static byte abs(byte a) {
6064         return (byte)(Math.abs((byte)a));
6065     }
6066 
6067     @Test(dataProvider = "byteUnaryOpProvider")
6068     static void ABSByte128VectorTests(IntFunction<byte[]> fa) {
6069         byte[] a = fa.apply(SPECIES.length());
6070         byte[] r = fr.apply(SPECIES.length());
6071 
6072         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6073             for (int i = 0; i < a.length; i += SPECIES.length()) {
6074                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6075                 av.lanewise(VectorOperators.ABS).intoArray(r, i);
6076             }
6077         }
6078 
6079         assertArraysEquals(r, a, Byte128VectorTests::ABS);
6080     }
6081 
6082     @Test(dataProvider = "byteUnaryOpProvider")
6083     static void absByte128VectorTests(IntFunction<byte[]> fa) {
6084         byte[] a = fa.apply(SPECIES.length());
6085         byte[] r = fr.apply(SPECIES.length());
6086 
6087         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6088             for (int i = 0; i < a.length; i += SPECIES.length()) {
6089                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6090                 av.abs().intoArray(r, i);
6091             }
6092         }
6093 
6094         assertArraysEquals(r, a, Byte128VectorTests::abs);
6095     }
6096 
6097     @Test(dataProvider = "byteUnaryOpMaskProvider")
6098     static void ABSMaskedByte128VectorTests(IntFunction<byte[]> fa,
6099                                                 IntFunction<boolean[]> fm) {
6100         byte[] a = fa.apply(SPECIES.length());
6101         byte[] r = fr.apply(SPECIES.length());
6102         boolean[] mask = fm.apply(SPECIES.length());
6103         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6104 
6105         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6106             for (int i = 0; i < a.length; i += SPECIES.length()) {
6107                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6108                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
6109             }
6110         }
6111 
6112         assertArraysEquals(r, a, mask, Byte128VectorTests::ABS);
6113     }
6114 
6115     static byte NOT(byte a) {
6116         return (byte)(~((byte)a));
6117     }
6118 
6119     static byte not(byte a) {
6120         return (byte)(~((byte)a));
6121     }
6122 
6123     @Test(dataProvider = "byteUnaryOpProvider")
6124     static void NOTByte128VectorTests(IntFunction<byte[]> fa) {
6125         byte[] a = fa.apply(SPECIES.length());
6126         byte[] r = fr.apply(SPECIES.length());
6127 
6128         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6129             for (int i = 0; i < a.length; i += SPECIES.length()) {
6130                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6131                 av.lanewise(VectorOperators.NOT).intoArray(r, i);
6132             }
6133         }
6134 
6135         assertArraysEquals(r, a, Byte128VectorTests::NOT);
6136     }
6137 
6138     @Test(dataProvider = "byteUnaryOpProvider")
6139     static void notByte128VectorTests(IntFunction<byte[]> fa) {
6140         byte[] a = fa.apply(SPECIES.length());
6141         byte[] r = fr.apply(SPECIES.length());
6142 
6143         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6144             for (int i = 0; i < a.length; i += SPECIES.length()) {
6145                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6146                 av.not().intoArray(r, i);
6147             }
6148         }
6149 
6150         assertArraysEquals(r, a, Byte128VectorTests::not);
6151     }
6152 
6153     @Test(dataProvider = "byteUnaryOpMaskProvider")
6154     static void NOTMaskedByte128VectorTests(IntFunction<byte[]> fa,
6155                                                 IntFunction<boolean[]> fm) {
6156         byte[] a = fa.apply(SPECIES.length());
6157         byte[] r = fr.apply(SPECIES.length());
6158         boolean[] mask = fm.apply(SPECIES.length());
6159         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6160 
6161         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6162             for (int i = 0; i < a.length; i += SPECIES.length()) {
6163                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6164                 av.lanewise(VectorOperators.NOT, vmask).intoArray(r, i);
6165             }
6166         }
6167 
6168         assertArraysEquals(r, a, mask, Byte128VectorTests::NOT);
6169     }
6170 
6171     static byte ZOMO(byte a) {
6172         return (byte)((a==0?0:-1));
6173     }
6174 
6175     @Test(dataProvider = "byteUnaryOpProvider")
6176     static void ZOMOByte128VectorTests(IntFunction<byte[]> fa) {
6177         byte[] a = fa.apply(SPECIES.length());
6178         byte[] r = fr.apply(SPECIES.length());
6179 
6180         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6181             for (int i = 0; i < a.length; i += SPECIES.length()) {
6182                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6183                 av.lanewise(VectorOperators.ZOMO).intoArray(r, i);
6184             }
6185         }
6186 
6187         assertArraysEquals(r, a, Byte128VectorTests::ZOMO);
6188     }
6189 
6190     @Test(dataProvider = "byteUnaryOpMaskProvider")
6191     static void ZOMOMaskedByte128VectorTests(IntFunction<byte[]> fa,
6192                                                 IntFunction<boolean[]> fm) {
6193         byte[] a = fa.apply(SPECIES.length());
6194         byte[] r = fr.apply(SPECIES.length());
6195         boolean[] mask = fm.apply(SPECIES.length());
6196         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6197 
6198         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6199             for (int i = 0; i < a.length; i += SPECIES.length()) {
6200                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6201                 av.lanewise(VectorOperators.ZOMO, vmask).intoArray(r, i);
6202             }
6203         }
6204 
6205         assertArraysEquals(r, a, mask, Byte128VectorTests::ZOMO);
6206     }
6207 
6208     static byte BIT_COUNT(byte a) {
6209         return (byte)(Integer.bitCount((int)a & 0xFF));
6210     }
6211 
6212     @Test(dataProvider = "byteUnaryOpProvider")
6213     static void BIT_COUNTByte128VectorTests(IntFunction<byte[]> fa) {
6214         byte[] a = fa.apply(SPECIES.length());
6215         byte[] r = fr.apply(SPECIES.length());
6216 
6217         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6218             for (int i = 0; i < a.length; i += SPECIES.length()) {
6219                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6220                 av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
6221             }
6222         }
6223 
6224         assertArraysEquals(r, a, Byte128VectorTests::BIT_COUNT);
6225     }
6226 
6227     @Test(dataProvider = "byteUnaryOpMaskProvider")
6228     static void BIT_COUNTMaskedByte128VectorTests(IntFunction<byte[]> fa,
6229                                                 IntFunction<boolean[]> fm) {
6230         byte[] a = fa.apply(SPECIES.length());
6231         byte[] r = fr.apply(SPECIES.length());
6232         boolean[] mask = fm.apply(SPECIES.length());
6233         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6234 
6235         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6236             for (int i = 0; i < a.length; i += SPECIES.length()) {
6237                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6238                 av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
6239             }
6240         }
6241 
6242         assertArraysEquals(r, a, mask, Byte128VectorTests::BIT_COUNT);
6243     }
6244 
6245     static byte TRAILING_ZEROS_COUNT(byte a) {
6246         return (byte)(TRAILING_ZEROS_COUNT_scalar(a));
6247     }
6248 
6249     @Test(dataProvider = "byteUnaryOpProvider")
6250     static void TRAILING_ZEROS_COUNTByte128VectorTests(IntFunction<byte[]> fa) {
6251         byte[] a = fa.apply(SPECIES.length());
6252         byte[] r = fr.apply(SPECIES.length());
6253 
6254         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6255             for (int i = 0; i < a.length; i += SPECIES.length()) {
6256                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6257                 av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
6258             }
6259         }
6260 
6261         assertArraysEquals(r, a, Byte128VectorTests::TRAILING_ZEROS_COUNT);
6262     }
6263 
6264     @Test(dataProvider = "byteUnaryOpMaskProvider")
6265     static void TRAILING_ZEROS_COUNTMaskedByte128VectorTests(IntFunction<byte[]> fa,
6266                                                 IntFunction<boolean[]> fm) {
6267         byte[] a = fa.apply(SPECIES.length());
6268         byte[] r = fr.apply(SPECIES.length());
6269         boolean[] mask = fm.apply(SPECIES.length());
6270         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6271 
6272         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6273             for (int i = 0; i < a.length; i += SPECIES.length()) {
6274                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6275                 av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
6276             }
6277         }
6278 
6279         assertArraysEquals(r, a, mask, Byte128VectorTests::TRAILING_ZEROS_COUNT);
6280     }
6281 
6282     static byte LEADING_ZEROS_COUNT(byte a) {
6283         return (byte)(LEADING_ZEROS_COUNT_scalar(a));
6284     }
6285 
6286     @Test(dataProvider = "byteUnaryOpProvider")
6287     static void LEADING_ZEROS_COUNTByte128VectorTests(IntFunction<byte[]> fa) {
6288         byte[] a = fa.apply(SPECIES.length());
6289         byte[] r = fr.apply(SPECIES.length());
6290 
6291         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6292             for (int i = 0; i < a.length; i += SPECIES.length()) {
6293                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6294                 av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
6295             }
6296         }
6297 
6298         assertArraysEquals(r, a, Byte128VectorTests::LEADING_ZEROS_COUNT);
6299     }
6300 
6301     @Test(dataProvider = "byteUnaryOpMaskProvider")
6302     static void LEADING_ZEROS_COUNTMaskedByte128VectorTests(IntFunction<byte[]> fa,
6303                                                 IntFunction<boolean[]> fm) {
6304         byte[] a = fa.apply(SPECIES.length());
6305         byte[] r = fr.apply(SPECIES.length());
6306         boolean[] mask = fm.apply(SPECIES.length());
6307         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6308 
6309         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6310             for (int i = 0; i < a.length; i += SPECIES.length()) {
6311                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6312                 av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
6313             }
6314         }
6315 
6316         assertArraysEquals(r, a, mask, Byte128VectorTests::LEADING_ZEROS_COUNT);
6317     }
6318 
6319     static byte REVERSE(byte a) {
6320         return (byte)(REVERSE_scalar(a));
6321     }
6322 
6323     @Test(dataProvider = "byteUnaryOpProvider")
6324     static void REVERSEByte128VectorTests(IntFunction<byte[]> fa) {
6325         byte[] a = fa.apply(SPECIES.length());
6326         byte[] r = fr.apply(SPECIES.length());
6327 
6328         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6329             for (int i = 0; i < a.length; i += SPECIES.length()) {
6330                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6331                 av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
6332             }
6333         }
6334 
6335         assertArraysEquals(r, a, Byte128VectorTests::REVERSE);
6336     }
6337 
6338     @Test(dataProvider = "byteUnaryOpMaskProvider")
6339     static void REVERSEMaskedByte128VectorTests(IntFunction<byte[]> fa,
6340                                                 IntFunction<boolean[]> fm) {
6341         byte[] a = fa.apply(SPECIES.length());
6342         byte[] r = fr.apply(SPECIES.length());
6343         boolean[] mask = fm.apply(SPECIES.length());
6344         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6345 
6346         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6347             for (int i = 0; i < a.length; i += SPECIES.length()) {
6348                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6349                 av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
6350             }
6351         }
6352 
6353         assertArraysEquals(r, a, mask, Byte128VectorTests::REVERSE);
6354     }
6355 
6356     static byte REVERSE_BYTES(byte a) {
6357         return (byte)(a);
6358     }
6359 
6360     @Test(dataProvider = "byteUnaryOpProvider")
6361     static void REVERSE_BYTESByte128VectorTests(IntFunction<byte[]> fa) {
6362         byte[] a = fa.apply(SPECIES.length());
6363         byte[] r = fr.apply(SPECIES.length());
6364 
6365         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6366             for (int i = 0; i < a.length; i += SPECIES.length()) {
6367                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6368                 av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
6369             }
6370         }
6371 
6372         assertArraysEquals(r, a, Byte128VectorTests::REVERSE_BYTES);
6373     }
6374 
6375     @Test(dataProvider = "byteUnaryOpMaskProvider")
6376     static void REVERSE_BYTESMaskedByte128VectorTests(IntFunction<byte[]> fa,
6377                                                 IntFunction<boolean[]> fm) {
6378         byte[] a = fa.apply(SPECIES.length());
6379         byte[] r = fr.apply(SPECIES.length());
6380         boolean[] mask = fm.apply(SPECIES.length());
6381         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6382 
6383         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6384             for (int i = 0; i < a.length; i += SPECIES.length()) {
6385                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6386                 av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
6387             }
6388         }
6389 
6390         assertArraysEquals(r, a, mask, Byte128VectorTests::REVERSE_BYTES);
6391     }
6392 
6393     @Test(dataProvider = "byteCompareOpProvider")
6394     static void ltByte128VectorTestsBroadcastSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
6395         byte[] a = fa.apply(SPECIES.length());
6396         byte[] b = fb.apply(SPECIES.length());
6397 
6398         for (int i = 0; i < a.length; i += SPECIES.length()) {
6399             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6400             VectorMask<Byte> mv = av.lt(b[i]);
6401 
6402             // Check results as part of computation.
6403             for (int j = 0; j < SPECIES.length(); j++) {
6404                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
6405             }
6406         }
6407     }
6408 
6409     @Test(dataProvider = "byteCompareOpProvider")
6410     static void eqByte128VectorTestsBroadcastMaskedSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb) {
6411         byte[] a = fa.apply(SPECIES.length());
6412         byte[] b = fb.apply(SPECIES.length());
6413 
6414         for (int i = 0; i < a.length; i += SPECIES.length()) {
6415             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6416             VectorMask<Byte> mv = av.eq(b[i]);
6417 
6418             // Check results as part of computation.
6419             for (int j = 0; j < SPECIES.length(); j++) {
6420                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
6421             }
6422         }
6423     }
6424 
6425     @Test(dataProvider = "byteUnaryOpProvider")
6426     static void toIntArrayByte128VectorTestsSmokeTest(IntFunction<byte[]> fa) {
6427         byte[] a = fa.apply(SPECIES.length());
6428 
6429         for (int i = 0; i < a.length; i += SPECIES.length()) {
6430             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6431             int[] r = av.toIntArray();
6432             assertArraysEquals(r, a, i);
6433         }
6434     }
6435 
6436     @Test(dataProvider = "byteUnaryOpProvider")
6437     static void toLongArrayByte128VectorTestsSmokeTest(IntFunction<byte[]> fa) {
6438         byte[] a = fa.apply(SPECIES.length());
6439 
6440         for (int i = 0; i < a.length; i += SPECIES.length()) {
6441             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6442             long[] r = av.toLongArray();
6443             assertArraysEquals(r, a, i);
6444         }
6445     }
6446 
6447     @Test(dataProvider = "byteUnaryOpProvider")
6448     static void toDoubleArrayByte128VectorTestsSmokeTest(IntFunction<byte[]> fa) {
6449         byte[] a = fa.apply(SPECIES.length());
6450 
6451         for (int i = 0; i < a.length; i += SPECIES.length()) {
6452             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6453             double[] r = av.toDoubleArray();
6454             assertArraysEquals(r, a, i);
6455         }
6456     }
6457 
6458     @Test(dataProvider = "byteUnaryOpProvider")
6459     static void toStringByte128VectorTestsSmokeTest(IntFunction<byte[]> fa) {
6460         byte[] a = fa.apply(SPECIES.length());
6461 
6462         for (int i = 0; i < a.length; i += SPECIES.length()) {
6463             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6464             String str = av.toString();
6465 
6466             byte subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
6467             Assert.assertTrue(str.equals(Arrays.toString(subarr)), "at index " + i + ", string should be = " + Arrays.toString(subarr) + ", but is = " + str);
6468         }
6469     }
6470 
6471     @Test(dataProvider = "byteUnaryOpProvider")
6472     static void hashCodeByte128VectorTestsSmokeTest(IntFunction<byte[]> fa) {
6473         byte[] a = fa.apply(SPECIES.length());
6474 
6475         for (int i = 0; i < a.length; i += SPECIES.length()) {
6476             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6477             int hash = av.hashCode();
6478 
6479             byte subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
6480             int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr));
6481             Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash);
6482         }
6483     }
6484 
6485     @Test(dataProvider = "byteUnaryOpProvider")
6486     static void reinterpretAsBytesByte128VectorTestsSmokeTest(IntFunction<byte[]> fa) {
6487         byte[] a = fa.apply(SPECIES.length());
6488         byte[] r = new byte[a.length];
6489 
6490         for (int i = 0; i < a.length; i += SPECIES.length()) {
6491             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6492             av.reinterpretAsBytes().intoArray(r, i);
6493         }
6494         assertArraysEquals(r, a, 0);
6495     }
6496 
6497     static long ADDReduceLong(byte[] a, int idx) {
6498         byte res = 0;
6499         for (int i = idx; i < (idx + SPECIES.length()); i++) {
6500             res += a[i];
6501         }
6502 
6503         return (long)res;
6504     }
6505 
6506     static long ADDReduceAllLong(byte[] a) {
6507         long res = 0;
6508         for (int i = 0; i < a.length; i += SPECIES.length()) {
6509             res += ADDReduceLong(a, i);
6510         }
6511 
6512         return res;
6513     }
6514 
6515     @Test(dataProvider = "byteUnaryOpProvider")
6516     static void ADDReduceLongByte128VectorTests(IntFunction<byte[]> fa) {
6517         byte[] a = fa.apply(SPECIES.length());
6518         long[] r = lfr.apply(SPECIES.length());
6519         long ra = 0;
6520 
6521         for (int i = 0; i < a.length; i += SPECIES.length()) {
6522             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6523             r[i] = av.reduceLanesToLong(VectorOperators.ADD);
6524         }
6525 
6526         ra = 0;
6527         for (int i = 0; i < a.length; i ++) {
6528             ra += r[i];
6529         }
6530 
6531         assertReductionLongArraysEquals(r, ra, a,
6532                 Byte128VectorTests::ADDReduceLong, Byte128VectorTests::ADDReduceAllLong);
6533     }
6534 
6535     static long ADDReduceLongMasked(byte[] a, int idx, boolean[] mask) {
6536         byte res = 0;
6537         for (int i = idx; i < (idx + SPECIES.length()); i++) {
6538             if(mask[i % SPECIES.length()])
6539                 res += a[i];
6540         }
6541 
6542         return (long)res;
6543     }
6544 
6545     static long ADDReduceAllLongMasked(byte[] a, boolean[] mask) {
6546         long res = 0;
6547         for (int i = 0; i < a.length; i += SPECIES.length()) {
6548             res += ADDReduceLongMasked(a, i, mask);
6549         }
6550 
6551         return res;
6552     }
6553 
6554     @Test(dataProvider = "byteUnaryOpMaskProvider")
6555     static void ADDReduceLongByte128VectorTestsMasked(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
6556         byte[] a = fa.apply(SPECIES.length());
6557         long[] r = lfr.apply(SPECIES.length());
6558         boolean[] mask = fm.apply(SPECIES.length());
6559         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6560         long ra = 0;
6561 
6562         for (int i = 0; i < a.length; i += SPECIES.length()) {
6563             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6564             r[i] = av.reduceLanesToLong(VectorOperators.ADD, vmask);
6565         }
6566 
6567         ra = 0;
6568         for (int i = 0; i < a.length; i ++) {
6569             ra += r[i];
6570         }
6571 
6572         assertReductionLongArraysEqualsMasked(r, ra, a, mask,
6573                 Byte128VectorTests::ADDReduceLongMasked, Byte128VectorTests::ADDReduceAllLongMasked);
6574     }
6575 
6576     @Test(dataProvider = "byteUnaryOpProvider")
6577     static void BroadcastLongByte128VectorTestsSmokeTest(IntFunction<byte[]> fa) {
6578         byte[] a = fa.apply(SPECIES.length());
6579         byte[] r = new byte[a.length];
6580 
6581         for (int i = 0; i < a.length; i += SPECIES.length()) {
6582             ByteVector.broadcast(SPECIES, (long)a[i]).intoArray(r, i);
6583         }
6584         assertBroadcastArraysEquals(r, a);
6585     }
6586 
6587     @Test(dataProvider = "byteBinaryOpMaskProvider")
6588     static void blendByte128VectorTestsBroadcastLongSmokeTest(IntFunction<byte[]> fa, IntFunction<byte[]> fb,
6589                                           IntFunction<boolean[]> fm) {
6590         byte[] a = fa.apply(SPECIES.length());
6591         byte[] b = fb.apply(SPECIES.length());
6592         byte[] r = fr.apply(SPECIES.length());
6593         boolean[] mask = fm.apply(SPECIES.length());
6594         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6595 
6596         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6597             for (int i = 0; i < a.length; i += SPECIES.length()) {
6598                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6599                 av.blend((long)b[i], vmask).intoArray(r, i);
6600             }
6601         }
6602         assertBroadcastLongArraysEquals(r, a, b, mask, Byte128VectorTests::blend);
6603     }
6604 
6605 
6606     @Test(dataProvider = "byteUnaryOpSelectFromProvider")
6607     static void SelectFromByte128VectorTests(IntFunction<byte[]> fa,
6608                                            BiFunction<Integer,Integer,byte[]> fs) {
6609         byte[] a = fa.apply(SPECIES.length());
6610         byte[] order = fs.apply(a.length, SPECIES.length());
6611         byte[] r = fr.apply(SPECIES.length());
6612 
6613         for (int i = 0; i < a.length; i += SPECIES.length()) {
6614             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6615             ByteVector bv = ByteVector.fromArray(SPECIES, order, i);
6616             bv.selectFrom(av).intoArray(r, i);
6617         }
6618 
6619         assertSelectFromArraysEquals(r, a, order, SPECIES.length());
6620     }
6621 
6622     @Test(dataProvider = "byteSelectFromTwoVectorOpProvider")
6623     static void SelectFromTwoVectorByte128VectorTests(IntFunction<byte[]> fa, IntFunction<byte[]> fb, IntFunction<byte[]> fc) {
6624         byte[] a = fa.apply(SPECIES.length());
6625         byte[] b = fb.apply(SPECIES.length());
6626         byte[] idx = fc.apply(SPECIES.length());
6627         byte[] r = fr.apply(SPECIES.length());
6628 
6629         for (int ic = 0; ic < INVOC_COUNT; ic++) {
6630             for (int i = 0; i < idx.length; i += SPECIES.length()) {
6631                 ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6632                 ByteVector bv = ByteVector.fromArray(SPECIES, b, i);
6633                 ByteVector idxv = ByteVector.fromArray(SPECIES, idx, i);
6634                 idxv.selectFrom(av, bv).intoArray(r, i);
6635             }
6636         }
6637         assertSelectFromTwoVectorEquals(r, idx, a, b, SPECIES.length());
6638     }
6639 
6640     @Test(dataProvider = "byteUnaryOpSelectFromMaskProvider")
6641     static void SelectFromByte128VectorTestsMaskedSmokeTest(IntFunction<byte[]> fa,
6642                                                            BiFunction<Integer,Integer,byte[]> fs,
6643                                                            IntFunction<boolean[]> fm) {
6644         byte[] a = fa.apply(SPECIES.length());
6645         byte[] order = fs.apply(a.length, SPECIES.length());
6646         byte[] r = fr.apply(SPECIES.length());
6647         boolean[] mask = fm.apply(SPECIES.length());
6648         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
6649 
6650         for (int i = 0; i < a.length; i += SPECIES.length()) {
6651             ByteVector av = ByteVector.fromArray(SPECIES, a, i);
6652             ByteVector bv = ByteVector.fromArray(SPECIES, order, i);
6653             bv.selectFrom(av, vmask).intoArray(r, i);
6654         }
6655 
6656         assertSelectFromArraysEquals(r, a, order, mask, SPECIES.length());
6657     }
6658 
6659     @Test(dataProvider = "shuffleProvider")
6660     static void shuffleMiscellaneousByte128VectorTestsSmokeTest(BiFunction<Integer,Integer,int[]> fs) {
6661         int[] a = fs.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
6662 
6663         for (int i = 0; i < a.length; i += SPECIES.length()) {
6664             var shuffle = VectorShuffle.fromArray(SPECIES, a, i);
6665             int hash = shuffle.hashCode();
6666             int length = shuffle.length();
6667 
6668             int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
6669             int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr));
6670             Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash);
6671             Assert.assertEquals(length, SPECIES.length());
6672         }
6673     }
6674 
6675     @Test(dataProvider = "shuffleProvider")
6676     static void shuffleToStringByte128VectorTestsSmokeTest(BiFunction<Integer,Integer,int[]> fs) {
6677         int[] a = fs.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
6678 
6679         for (int i = 0; i < a.length; i += SPECIES.length()) {
6680             var shuffle = VectorShuffle.fromArray(SPECIES, a, i);
6681             String str = shuffle.toString();
6682 
6683             int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
6684             Assert.assertTrue(str.equals("Shuffle" + Arrays.toString(subarr)), "at index " +
6685                 i + ", string should be = " + Arrays.toString(subarr) + ", but is = " + str);
6686         }
6687     }
6688 
6689     @Test(dataProvider = "shuffleCompareOpProvider")
6690     static void shuffleEqualsByte128VectorTestsSmokeTest(BiFunction<Integer,Integer,int[]> fa, BiFunction<Integer,Integer,int[]> fb) {
6691         int[] a = fa.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
6692         int[] b = fb.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
6693 
6694         for (int i = 0; i < a.length; i += SPECIES.length()) {
6695             var av = VectorShuffle.fromArray(SPECIES, a, i);
6696             var bv = VectorShuffle.fromArray(SPECIES, b, i);
6697             boolean eq = av.equals(bv);
6698             int to = i + SPECIES.length();
6699             Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to));
6700         }
6701     }
6702 
6703     @Test(dataProvider = "maskCompareOpProvider")
6704     static void maskEqualsByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
6705         boolean[] a = fa.apply(SPECIES.length());
6706         boolean[] b = fb.apply(SPECIES.length());
6707 
6708         for (int i = 0; i < a.length; i += SPECIES.length()) {
6709             var av = SPECIES.loadMask(a, i);
6710             var bv = SPECIES.loadMask(b, i);
6711             boolean equals = av.equals(bv);
6712             int to = i + SPECIES.length();
6713             Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to));
6714         }
6715     }
6716 
6717     static boolean band(boolean a, boolean b) {
6718         return a & b;
6719     }
6720 
6721     @Test(dataProvider = "maskCompareOpProvider")
6722     static void maskAndByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
6723         boolean[] a = fa.apply(SPECIES.length());
6724         boolean[] b = fb.apply(SPECIES.length());
6725         boolean[] r = new boolean[a.length];
6726 
6727         for (int i = 0; i < a.length; i += SPECIES.length()) {
6728             var av = SPECIES.loadMask(a, i);
6729             var bv = SPECIES.loadMask(b, i);
6730             var cv = av.and(bv);
6731             cv.intoArray(r, i);
6732         }
6733         assertArraysEquals(r, a, b, Byte128VectorTests::band);
6734     }
6735 
6736     static boolean bor(boolean a, boolean b) {
6737         return a | b;
6738     }
6739 
6740     @Test(dataProvider = "maskCompareOpProvider")
6741     static void maskOrByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
6742         boolean[] a = fa.apply(SPECIES.length());
6743         boolean[] b = fb.apply(SPECIES.length());
6744         boolean[] r = new boolean[a.length];
6745 
6746         for (int i = 0; i < a.length; i += SPECIES.length()) {
6747             var av = SPECIES.loadMask(a, i);
6748             var bv = SPECIES.loadMask(b, i);
6749             var cv = av.or(bv);
6750             cv.intoArray(r, i);
6751         }
6752         assertArraysEquals(r, a, b, Byte128VectorTests::bor);
6753     }
6754 
6755     static boolean bxor(boolean a, boolean b) {
6756         return a != b;
6757     }
6758 
6759     @Test(dataProvider = "maskCompareOpProvider")
6760     static void maskXorByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
6761         boolean[] a = fa.apply(SPECIES.length());
6762         boolean[] b = fb.apply(SPECIES.length());
6763         boolean[] r = new boolean[a.length];
6764 
6765         for (int i = 0; i < a.length; i += SPECIES.length()) {
6766             var av = SPECIES.loadMask(a, i);
6767             var bv = SPECIES.loadMask(b, i);
6768             var cv = av.xor(bv);
6769             cv.intoArray(r, i);
6770         }
6771         assertArraysEquals(r, a, b, Byte128VectorTests::bxor);
6772     }
6773 
6774     static boolean bandNot(boolean a, boolean b) {
6775         return a & !b;
6776     }
6777 
6778     @Test(dataProvider = "maskCompareOpProvider")
6779     static void maskAndNotByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
6780         boolean[] a = fa.apply(SPECIES.length());
6781         boolean[] b = fb.apply(SPECIES.length());
6782         boolean[] r = new boolean[a.length];
6783 
6784         for (int i = 0; i < a.length; i += SPECIES.length()) {
6785             var av = SPECIES.loadMask(a, i);
6786             var bv = SPECIES.loadMask(b, i);
6787             var cv = av.andNot(bv);
6788             cv.intoArray(r, i);
6789         }
6790         assertArraysEquals(r, a, b, Byte128VectorTests::bandNot);
6791     }
6792 
6793     static boolean beq(boolean a, boolean b) {
6794         return (a == b);
6795     }
6796 
6797     @Test(dataProvider = "maskCompareOpProvider")
6798     static void maskEqByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
6799         boolean[] a = fa.apply(SPECIES.length());
6800         boolean[] b = fb.apply(SPECIES.length());
6801         boolean[] r = new boolean[a.length];
6802 
6803         for (int i = 0; i < a.length; i += SPECIES.length()) {
6804             var av = SPECIES.loadMask(a, i);
6805             var bv = SPECIES.loadMask(b, i);
6806             var cv = av.eq(bv);
6807             cv.intoArray(r, i);
6808         }
6809         assertArraysEquals(r, a, b, Byte128VectorTests::beq);
6810     }
6811 
6812     @Test(dataProvider = "maskProvider")
6813     static void maskHashCodeByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
6814         boolean[] a = fa.apply(SPECIES.length());
6815 
6816         for (int i = 0; i < a.length; i += SPECIES.length()) {
6817             var vmask = SPECIES.loadMask(a, i);
6818             int hash = vmask.hashCode();
6819 
6820             boolean subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
6821             int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr));
6822             Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash);
6823         }
6824     }
6825 
6826     static int maskTrueCount(boolean[] a, int idx) {
6827         int trueCount = 0;
6828         for (int i = idx; i < idx + SPECIES.length(); i++) {
6829             trueCount += a[i] ? 1 : 0;
6830         }
6831         return trueCount;
6832     }
6833 
6834     @Test(dataProvider = "maskProvider")
6835     static void maskTrueCountByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
6836         boolean[] a = fa.apply(SPECIES.length());
6837         int[] r = new int[a.length];
6838 
6839         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
6840             for (int i = 0; i < a.length; i += SPECIES.length()) {
6841                 var vmask = SPECIES.loadMask(a, i);
6842                 r[i] = vmask.trueCount();
6843             }
6844         }
6845 
6846         assertMaskReductionArraysEquals(r, a, Byte128VectorTests::maskTrueCount);
6847     }
6848 
6849     static int maskLastTrue(boolean[] a, int idx) {
6850         int i = idx + SPECIES.length() - 1;
6851         for (; i >= idx; i--) {
6852             if (a[i]) {
6853                 break;
6854             }
6855         }
6856         return i - idx;
6857     }
6858 
6859     @Test(dataProvider = "maskProvider")
6860     static void maskLastTrueByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
6861         boolean[] a = fa.apply(SPECIES.length());
6862         int[] r = new int[a.length];
6863 
6864         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
6865             for (int i = 0; i < a.length; i += SPECIES.length()) {
6866                 var vmask = SPECIES.loadMask(a, i);
6867                 r[i] = vmask.lastTrue();
6868             }
6869         }
6870 
6871         assertMaskReductionArraysEquals(r, a, Byte128VectorTests::maskLastTrue);
6872     }
6873 
6874     static int maskFirstTrue(boolean[] a, int idx) {
6875         int i = idx;
6876         for (; i < idx + SPECIES.length(); i++) {
6877             if (a[i]) {
6878                 break;
6879             }
6880         }
6881         return i - idx;
6882     }
6883 
6884     @Test(dataProvider = "maskProvider")
6885     static void maskFirstTrueByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
6886         boolean[] a = fa.apply(SPECIES.length());
6887         int[] r = new int[a.length];
6888 
6889         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
6890             for (int i = 0; i < a.length; i += SPECIES.length()) {
6891                 var vmask = SPECIES.loadMask(a, i);
6892                 r[i] = vmask.firstTrue();
6893             }
6894         }
6895 
6896         assertMaskReductionArraysEquals(r, a, Byte128VectorTests::maskFirstTrue);
6897     }
6898 
6899     @Test(dataProvider = "maskProvider")
6900     static void maskCompressByte128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
6901         int trueCount = 0;
6902         boolean[] a = fa.apply(SPECIES.length());
6903 
6904         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
6905             for (int i = 0; i < a.length; i += SPECIES.length()) {
6906                 var vmask = SPECIES.loadMask(a, i);
6907                 trueCount = vmask.trueCount();
6908                 var rmask = vmask.compress();
6909                 for (int j = 0; j < SPECIES.length(); j++)  {
6910                     Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
6911                 }
6912             }
6913         }
6914     }
6915 
6916     @DataProvider
6917     public static Object[][] longMaskProvider() {
6918         return new Object[][]{
6919                 {0xFFFFFFFFFFFFFFFFL},
6920                 {0x0000000000000000L},
6921                 {0x5555555555555555L},
6922                 {0x0123456789abcdefL},
6923         };
6924     }
6925 
6926     @Test(dataProvider = "longMaskProvider")
6927     static void maskFromToLongByte128VectorTestsSmokeTest(long inputLong) {
6928         var vmask = VectorMask.fromLong(SPECIES, inputLong);
6929         long outputLong = vmask.toLong();
6930         Assert.assertEquals(outputLong, (inputLong & (((0xFFFFFFFFFFFFFFFFL >>> (64 - SPECIES.length()))))));
6931     }
6932 
6933     @DataProvider
6934     public static Object[][] offsetProvider() {
6935         return new Object[][]{
6936                 {0},
6937                 {-1},
6938                 {+1},
6939                 {+2},
6940                 {-2},
6941         };
6942     }
6943 
6944     @Test(dataProvider = "offsetProvider")
6945     static void indexInRangeByte128VectorTestsSmokeTest(int offset) {
6946         int limit = SPECIES.length() * BUFFER_REPS;
6947         for (int i = 0; i < limit; i += SPECIES.length()) {
6948             var actualMask = SPECIES.indexInRange(i + offset, limit);
6949             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
6950             assert(actualMask.equals(expectedMask));
6951             for (int j = 0; j < SPECIES.length(); j++)  {
6952                 int index = i + j + offset;
6953                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
6954             }
6955         }
6956     }
6957 
6958     @Test(dataProvider = "offsetProvider")
6959     static void indexInRangeLongByte128VectorTestsSmokeTest(int offset) {
6960         long limit = SPECIES.length() * BUFFER_REPS;
6961         for (long i = 0; i < limit; i += SPECIES.length()) {
6962             var actualMask = SPECIES.indexInRange(i + offset, limit);
6963             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
6964             assert(actualMask.equals(expectedMask));
6965             for (int j = 0; j < SPECIES.length(); j++)  {
6966                 long index = i + j + offset;
6967                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
6968             }
6969         }
6970     }
6971 
6972     @DataProvider
6973     public static Object[][] lengthProvider() {
6974         return new Object[][]{
6975                 {0},
6976                 {1},
6977                 {32},
6978                 {37},
6979                 {1024},
6980                 {1024+1},
6981                 {1024+5},
6982         };
6983     }
6984 
6985     @Test(dataProvider = "lengthProvider")
6986     static void loopBoundByte128VectorTestsSmokeTest(int length) {
6987         int actualLoopBound = SPECIES.loopBound(length);
6988         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
6989         Assert.assertEquals(actualLoopBound, expectedLoopBound);
6990     }
6991 
6992     @Test(dataProvider = "lengthProvider")
6993     static void loopBoundLongByte128VectorTestsSmokeTest(int _length) {
6994         long length = _length;
6995         long actualLoopBound = SPECIES.loopBound(length);
6996         long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
6997         Assert.assertEquals(actualLoopBound, expectedLoopBound);
6998     }
6999 
7000     @Test
7001     static void ElementSizeByte128VectorTestsSmokeTest() {
7002         ByteVector av = ByteVector.zero(SPECIES);
7003         int elsize = av.elementSize();
7004         Assert.assertEquals(elsize, Byte.SIZE);
7005     }
7006 
7007     @Test
7008     static void VectorShapeByte128VectorTestsSmokeTest() {
7009         ByteVector av = ByteVector.zero(SPECIES);
7010         VectorShape vsh = av.shape();
7011         assert(vsh.equals(VectorShape.S_128_BIT));
7012     }
7013 
7014     @Test
7015     static void ShapeWithLanesByte128VectorTestsSmokeTest() {
7016         ByteVector av = ByteVector.zero(SPECIES);
7017         VectorShape vsh = av.shape();
7018         VectorSpecies species = vsh.withLanes(byte.class);
7019         assert(species.equals(SPECIES));
7020     }
7021 
7022     @Test
7023     static void ElementTypeByte128VectorTestsSmokeTest() {
7024         ByteVector av = ByteVector.zero(SPECIES);
7025         assert(av.species().elementType() == byte.class);
7026     }
7027 
7028     @Test
7029     static void SpeciesElementSizeByte128VectorTestsSmokeTest() {
7030         ByteVector av = ByteVector.zero(SPECIES);
7031         assert(av.species().elementSize() == Byte.SIZE);
7032     }
7033 
7034     @Test
7035     static void VectorTypeByte128VectorTestsSmokeTest() {
7036         ByteVector av = ByteVector.zero(SPECIES);
7037         assert(av.species().vectorType() == av.getClass());
7038     }
7039 
7040     @Test
7041     static void WithLanesByte128VectorTestsSmokeTest() {
7042         ByteVector av = ByteVector.zero(SPECIES);
7043         VectorSpecies species = av.species().withLanes(byte.class);
7044         assert(species.equals(SPECIES));
7045     }
7046 
7047     @Test
7048     static void WithShapeByte128VectorTestsSmokeTest() {
7049         ByteVector av = ByteVector.zero(SPECIES);
7050         VectorShape vsh = av.shape();
7051         VectorSpecies species = av.species().withShape(vsh);
7052         assert(species.equals(SPECIES));
7053     }
7054 
7055     @Test
7056     static void MaskAllTrueByte128VectorTestsSmokeTest() {
7057         for (int ic = 0; ic < INVOC_COUNT; ic++) {
7058           Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
7059         }
7060     }
7061 }