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