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