1 /*
   2  * Copyright (c) 2018, 2021, 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  * @modules jdk.incubator.vector
  27  * @run testng/othervm -ea -esa -Xbatch -XX:-TieredCompilation Float128VectorTests
  28  */
  29 
  30 // -- This file was mechanically generated: Do not edit! -- //
  31 
  32 import jdk.incubator.vector.VectorShape;
  33 import jdk.incubator.vector.VectorSpecies;
  34 import jdk.incubator.vector.VectorShuffle;
  35 import jdk.incubator.vector.VectorMask;
  36 import jdk.incubator.vector.VectorOperators;
  37 import jdk.incubator.vector.Vector;
  38 
  39 import jdk.incubator.vector.FloatVector;
  40 
  41 import org.testng.Assert;
  42 import org.testng.annotations.DataProvider;
  43 import org.testng.annotations.Test;
  44 
  45 import java.lang.Integer;
  46 import java.util.List;
  47 import java.util.Arrays;
  48 import java.util.function.BiFunction;
  49 import java.util.function.IntFunction;
  50 import java.util.Objects;
  51 import java.util.stream.Collectors;
  52 import java.util.stream.Stream;
  53 
  54 @Test
  55 public class Float128VectorTests extends AbstractVectorTest {
  56 
  57     static final VectorSpecies<Float> SPECIES =
  58                 FloatVector.SPECIES_128;
  59 
  60     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  61 
  62 
  63     static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
  64 
  65     interface FUnOp {
  66         float apply(float a);
  67     }
  68 
  69     static void assertArraysEquals(float[] r, float[] a, FUnOp f) {
  70         int i = 0;
  71         try {
  72             for (; i < a.length; i++) {
  73                 Assert.assertEquals(r[i], f.apply(a[i]));
  74             }
  75         } catch (AssertionError e) {
  76             Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
  77         }
  78     }
  79 
  80     interface FUnArrayOp {
  81         float[] apply(float a);
  82     }
  83 
  84     static void assertArraysEquals(float[] r, float[] a, FUnArrayOp f) {
  85         int i = 0;
  86         try {
  87             for (; i < a.length; i += SPECIES.length()) {
  88                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
  89                   f.apply(a[i]));
  90             }
  91         } catch (AssertionError e) {
  92             float[] ref = f.apply(a[i]);
  93             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
  94             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
  95               + ", res: " + Arrays.toString(res)
  96               + "), at index #" + i);
  97         }
  98     }
  99 
 100     static void assertArraysEquals(float[] r, float[] a, boolean[] mask, FUnOp f) {
 101         int i = 0;
 102         try {
 103             for (; i < a.length; i++) {
 104                 Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]);
 105             }
 106         } catch (AssertionError e) {
 107             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()]);
 108         }
 109     }
 110 
 111     interface FReductionOp {
 112         float apply(float[] a, int idx);
 113     }
 114 
 115     interface FReductionAllOp {
 116         float apply(float[] a);
 117     }
 118 
 119     static void assertReductionArraysEquals(float[] r, float rc, float[] a,
 120                                             FReductionOp f, FReductionAllOp fa) {
 121         int i = 0;
 122         try {
 123             Assert.assertEquals(rc, fa.apply(a));
 124             for (; i < a.length; i += SPECIES.length()) {
 125                 Assert.assertEquals(r[i], f.apply(a, i));
 126             }
 127         } catch (AssertionError e) {
 128             Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!");
 129             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 130         }
 131     }
 132 
 133     interface FReductionMaskedOp {
 134         float apply(float[] a, int idx, boolean[] mask);
 135     }
 136 
 137     interface FReductionAllMaskedOp {
 138         float apply(float[] a, boolean[] mask);
 139     }
 140 
 141     static void assertReductionArraysEqualsMasked(float[] r, float rc, float[] a, boolean[] mask,
 142                                             FReductionMaskedOp f, FReductionAllMaskedOp fa) {
 143         int i = 0;
 144         try {
 145             Assert.assertEquals(rc, fa.apply(a, mask));
 146             for (; i < a.length; i += SPECIES.length()) {
 147                 Assert.assertEquals(r[i], f.apply(a, i, mask));
 148             }
 149         } catch (AssertionError e) {
 150             Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!");
 151             Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i);
 152         }
 153     }
 154 
 155     interface FReductionOpLong {
 156         long apply(float[] a, int idx);
 157     }
 158 
 159     interface FReductionAllOpLong {
 160         long apply(float[] a);
 161     }
 162 
 163     static void assertReductionLongArraysEquals(long[] r, long rc, float[] a,
 164                                             FReductionOpLong f, FReductionAllOpLong fa) {
 165         int i = 0;
 166         try {
 167             Assert.assertEquals(rc, fa.apply(a));
 168             for (; i < a.length; i += SPECIES.length()) {
 169                 Assert.assertEquals(r[i], f.apply(a, i));
 170             }
 171         } catch (AssertionError e) {
 172             Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!");
 173             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 174         }
 175     }
 176 
 177     interface FReductionMaskedOpLong {
 178         long apply(float[] a, int idx, boolean[] mask);
 179     }
 180 
 181     interface FReductionAllMaskedOpLong {
 182         long apply(float[] a, boolean[] mask);
 183     }
 184 
 185     static void assertReductionLongArraysEqualsMasked(long[] r, long rc, float[] a, boolean[] mask,
 186                                             FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) {
 187         int i = 0;
 188         try {
 189             Assert.assertEquals(rc, fa.apply(a, mask));
 190             for (; i < a.length; i += SPECIES.length()) {
 191                 Assert.assertEquals(r[i], f.apply(a, i, mask));
 192             }
 193         } catch (AssertionError e) {
 194             Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!");
 195             Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i);
 196         }
 197     }
 198 
 199     interface FBoolReductionOp {
 200         boolean apply(boolean[] a, int idx);
 201     }
 202 
 203     static void assertReductionBoolArraysEquals(boolean[] r, boolean[] a, FBoolReductionOp f) {
 204         int i = 0;
 205         try {
 206             for (; i < a.length; i += SPECIES.length()) {
 207                 Assert.assertEquals(r[i], f.apply(a, i));
 208             }
 209         } catch (AssertionError e) {
 210             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 211         }
 212     }
 213 
 214     interface FMaskReductionOp {
 215         int apply(boolean[] a, int idx);
 216     }
 217 
 218     static void assertMaskReductionArraysEquals(int[] r, boolean[] a, FMaskReductionOp f) {
 219         int i = 0;
 220         try {
 221             for (; i < a.length; i += SPECIES.length()) {
 222                 Assert.assertEquals(r[i], f.apply(a, i));
 223             }
 224         } catch (AssertionError e) {
 225             Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i);
 226         }
 227     }
 228 
 229     static void assertInsertArraysEquals(float[] r, float[] a, float element, int index) {
 230         int i = 0;
 231         try {
 232             for (; i < a.length; i += 1) {
 233                 if(i%SPECIES.length() == index) {
 234                     Assert.assertEquals(r[i], element);
 235                 } else {
 236                     Assert.assertEquals(r[i], a[i]);
 237                 }
 238             }
 239         } catch (AssertionError e) {
 240             if (i%SPECIES.length() == index) {
 241                 Assert.assertEquals(r[i], element, "at index #" + i);
 242             } else {
 243                 Assert.assertEquals(r[i], a[i], "at index #" + i);
 244             }
 245         }
 246     }
 247 
 248     static void assertRearrangeArraysEquals(float[] r, float[] a, int[] order, int vector_len) {
 249         int i = 0, j = 0;
 250         try {
 251             for (; i < a.length; i += vector_len) {
 252                 for (j = 0; j < vector_len; j++) {
 253                     Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 254                 }
 255             }
 256         } catch (AssertionError e) {
 257             int idx = i + j;
 258             Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]);
 259         }
 260     }
 261 
 262     static void assertSelectFromArraysEquals(float[] r, float[] a, float[] order, int vector_len) {
 263         int i = 0, j = 0;
 264         try {
 265             for (; i < a.length; i += vector_len) {
 266                 for (j = 0; j < vector_len; j++) {
 267                     Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 268                 }
 269             }
 270         } catch (AssertionError e) {
 271             int idx = i + j;
 272             Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]);
 273         }
 274     }
 275 
 276     static void assertRearrangeArraysEquals(float[] r, float[] a, int[] order, boolean[] mask, int vector_len) {
 277         int i = 0, j = 0;
 278         try {
 279             for (; i < a.length; i += vector_len) {
 280                 for (j = 0; j < vector_len; j++) {
 281                     if (mask[j % SPECIES.length()])
 282                          Assert.assertEquals(r[i+j], a[i+order[i+j]]);
 283                     else
 284                          Assert.assertEquals(r[i+j], (float)0);
 285                 }
 286             }
 287         } catch (AssertionError e) {
 288             int idx = i + j;
 289             if (mask[j % SPECIES.length()])
 290                 Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 291             else
 292                 Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 293         }
 294     }
 295 
 296     static void assertSelectFromArraysEquals(float[] r, float[] a, float[] order, boolean[] mask, int vector_len) {
 297         int i = 0, j = 0;
 298         try {
 299             for (; i < a.length; i += vector_len) {
 300                 for (j = 0; j < vector_len; j++) {
 301                     if (mask[j % SPECIES.length()])
 302                          Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]);
 303                     else
 304                          Assert.assertEquals(r[i+j], (float)0);
 305                 }
 306             }
 307         } catch (AssertionError e) {
 308             int idx = i + j;
 309             if (mask[j % SPECIES.length()])
 310                 Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 311             else
 312                 Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]);
 313         }
 314     }
 315 
 316     static void assertBroadcastArraysEquals(float[] r, float[] a) {
 317         int i = 0;
 318         for (; i < a.length; i += SPECIES.length()) {
 319             int idx = i;
 320             for (int j = idx; j < (idx + SPECIES.length()); j++)
 321                 a[j]=a[idx];
 322         }
 323 
 324         try {
 325             for (i = 0; i < a.length; i++) {
 326                 Assert.assertEquals(r[i], a[i]);
 327             }
 328         } catch (AssertionError e) {
 329             Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]);
 330         }
 331     }
 332 
 333     interface FBinOp {
 334         float apply(float a, float b);
 335     }
 336 
 337     interface FBinMaskOp {
 338         float apply(float a, float b, boolean m);
 339 
 340         static FBinMaskOp lift(FBinOp f) {
 341             return (a, b, m) -> m ? f.apply(a, b) : a;
 342         }
 343     }
 344 
 345     static void assertArraysEquals(float[] r, float[] a, float[] b, FBinOp f) {
 346         int i = 0;
 347         try {
 348             for (; i < a.length; i++) {
 349                 Assert.assertEquals(r[i], f.apply(a[i], b[i]));
 350             }
 351         } catch (AssertionError e) {
 352             Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i);
 353         }
 354     }
 355 
 356     static void assertBroadcastArraysEquals(float[] r, float[] a, float[] b, FBinOp f) {
 357         int i = 0;
 358         try {
 359             for (; i < a.length; i++) {
 360                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]));
 361             }
 362         } catch (AssertionError e) {
 363             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]),
 364                                 "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i);
 365         }
 366     }
 367 
 368     static void assertBroadcastLongArraysEquals(float[] r, float[] a, float[] b, FBinOp f) {
 369         int i = 0;
 370         try {
 371             for (; i < a.length; i++) {
 372                 Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])));
 373             }
 374         } catch (AssertionError e) {
 375             Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])),
 376                                 "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i);
 377         }
 378     }
 379 
 380     static void assertArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinOp f) {
 381         assertArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 382     }
 383 
 384     static void assertArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinMaskOp f) {
 385         int i = 0;
 386         try {
 387             for (; i < a.length; i++) {
 388                 Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]));
 389             }
 390         } catch (AssertionError err) {
 391             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()]);
 392         }
 393     }
 394 
 395     static void assertBroadcastArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinOp f) {
 396         assertBroadcastArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 397     }
 398 
 399     static void assertBroadcastArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinMaskOp f) {
 400         int i = 0;
 401         try {
 402             for (; i < a.length; i++) {
 403                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]));
 404             }
 405         } catch (AssertionError err) {
 406             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 407                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] +
 408                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 409                                 mask[i % SPECIES.length()]);
 410         }
 411     }
 412 
 413     static void assertBroadcastLongArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinOp f) {
 414         assertBroadcastLongArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 415     }
 416 
 417     static void assertBroadcastLongArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinMaskOp f) {
 418         int i = 0;
 419         try {
 420             for (; i < a.length; i++) {
 421                 Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]));
 422             }
 423         } catch (AssertionError err) {
 424             Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]),
 425                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] +
 426                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 427                                 mask[i % SPECIES.length()]);
 428         }
 429     }
 430 
 431     static void assertShiftArraysEquals(float[] r, float[] a, float[] b, FBinOp f) {
 432         int i = 0;
 433         int j = 0;
 434         try {
 435             for (; j < a.length; j += SPECIES.length()) {
 436                 for (i = 0; i < SPECIES.length(); i++) {
 437                     Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]));
 438                 }
 439             }
 440         } catch (AssertionError e) {
 441             Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j);
 442         }
 443     }
 444 
 445     static void assertShiftArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinOp f) {
 446         assertShiftArraysEquals(r, a, b, mask, FBinMaskOp.lift(f));
 447     }
 448 
 449     static void assertShiftArraysEquals(float[] r, float[] a, float[] b, boolean[] mask, FBinMaskOp f) {
 450         int i = 0;
 451         int j = 0;
 452         try {
 453             for (; j < a.length; j += SPECIES.length()) {
 454                 for (i = 0; i < SPECIES.length(); i++) {
 455                     Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]));
 456                 }
 457             }
 458         } catch (AssertionError err) {
 459             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]);
 460         }
 461     }
 462 
 463     interface FTernOp {
 464         float apply(float a, float b, float c);
 465     }
 466 
 467     interface FTernMaskOp {
 468         float apply(float a, float b, float c, boolean m);
 469 
 470         static FTernMaskOp lift(FTernOp f) {
 471             return (a, b, c, m) -> m ? f.apply(a, b, c) : a;
 472         }
 473     }
 474 
 475     static void assertArraysEquals(float[] r, float[] a, float[] b, float[] c, FTernOp f) {
 476         int i = 0;
 477         try {
 478             for (; i < a.length; i++) {
 479                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]));
 480             }
 481         } catch (AssertionError e) {
 482             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]);
 483         }
 484     }
 485 
 486     static void assertArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask, FTernOp f) {
 487         assertArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 488     }
 489 
 490     static void assertArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask, FTernMaskOp f) {
 491         int i = 0;
 492         try {
 493             for (; i < a.length; i++) {
 494                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]));
 495             }
 496         } catch (AssertionError err) {
 497             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = "
 498               + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]);
 499         }
 500     }
 501 
 502     static void assertBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, FTernOp f) {
 503         int i = 0;
 504         try {
 505             for (; i < a.length; i++) {
 506                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]));
 507             }
 508         } catch (AssertionError e) {
 509             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" +
 510                                 i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " +
 511                                 c[(i / SPECIES.length()) * SPECIES.length()]);
 512         }
 513     }
 514 
 515     static void assertAltBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, FTernOp f) {
 516         int i = 0;
 517         try {
 518             for (; i < a.length; i++) {
 519                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]));
 520             }
 521         } catch (AssertionError e) {
 522             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" +
 523                                 i + ", input1 = " + a[i] + ", input2 = " +
 524                                 b[(i / SPECIES.length()) * SPECIES.length()] + ",  input3 = " + c[i]);
 525         }
 526     }
 527 
 528     static void assertBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask,
 529                                             FTernOp f) {
 530         assertBroadcastArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 531     }
 532 
 533     static void assertBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask,
 534                                             FTernMaskOp f) {
 535         int i = 0;
 536         try {
 537             for (; i < a.length; i++) {
 538                 Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()],
 539                                     mask[i % SPECIES.length()]));
 540             }
 541         } catch (AssertionError err) {
 542             Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()],
 543                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " +
 544                                 b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 545                                 mask[i % SPECIES.length()]);
 546         }
 547     }
 548 
 549     static void assertAltBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask,
 550                                             FTernOp f) {
 551         assertAltBroadcastArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 552     }
 553 
 554     static void assertAltBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask,
 555                                             FTernMaskOp f) {
 556         int i = 0;
 557         try {
 558             for (; i < a.length; i++) {
 559                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i],
 560                                     mask[i % SPECIES.length()]));
 561             }
 562         } catch (AssertionError err) {
 563             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i],
 564                                 mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] +
 565                                 ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] +
 566                                 ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]);
 567         }
 568     }
 569 
 570     static void assertDoubleBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, FTernOp f) {
 571         int i = 0;
 572         try {
 573             for (; i < a.length; i++) {
 574                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 575                                     c[(i / SPECIES.length()) * SPECIES.length()]));
 576             }
 577         } catch (AssertionError e) {
 578             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 579                                 c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i]
 580                                 + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " +
 581                                 c[(i / SPECIES.length()) * SPECIES.length()]);
 582         }
 583     }
 584 
 585     static void assertDoubleBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask,
 586                                                   FTernOp f) {
 587         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, FTernMaskOp.lift(f));
 588     }
 589 
 590     static void assertDoubleBroadcastArraysEquals(float[] r, float[] a, float[] b, float[] c, boolean[] mask,
 591                                                   FTernMaskOp f) {
 592         int i = 0;
 593         try {
 594             for (; i < a.length; i++) {
 595                 Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 596                                     c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]));
 597             }
 598         } catch (AssertionError err) {
 599             Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()],
 600                                 c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #"
 601                                 + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] +
 602                                 ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " +
 603                                 mask[i % SPECIES.length()]);
 604         }
 605     }
 606 
 607 
 608     static boolean isWithin1Ulp(float actual, float expected) {
 609         if (Float.isNaN(expected) && !Float.isNaN(actual)) {
 610             return false;
 611         } else if (!Float.isNaN(expected) && Float.isNaN(actual)) {
 612             return false;
 613         }
 614 
 615         float low = Math.nextDown(expected);
 616         float high = Math.nextUp(expected);
 617 
 618         if (Float.compare(low, expected) > 0) {
 619             return false;
 620         }
 621 
 622         if (Float.compare(high, expected) < 0) {
 623             return false;
 624         }
 625 
 626         return true;
 627     }
 628 
 629     static void assertArraysEqualsWithinOneUlp(float[] r, float[] a, FUnOp mathf, FUnOp strictmathf) {
 630         int i = 0;
 631         try {
 632             // Check that result is within 1 ulp of strict math or equivalent to math implementation.
 633             for (; i < a.length; i++) {
 634                 Assert.assertTrue(Float.compare(r[i], mathf.apply(a[i])) == 0 ||
 635                                     isWithin1Ulp(r[i], strictmathf.apply(a[i])));
 636             }
 637         } catch (AssertionError e) {
 638             Assert.assertTrue(Float.compare(r[i], mathf.apply(a[i])) == 0, "at index #" + i + ", input = " + a[i] + ", actual = " + r[i] + ", expected = " + mathf.apply(a[i]));
 639             Assert.assertTrue(isWithin1Ulp(r[i], strictmathf.apply(a[i])), "at index #" + i + ", input = " + a[i] + ", actual = " + r[i] + ", expected (within 1 ulp) = " + strictmathf.apply(a[i]));
 640         }
 641     }
 642 
 643     static void assertArraysEqualsWithinOneUlp(float[] r, float[] a, float[] b, FBinOp mathf, FBinOp strictmathf) {
 644         int i = 0;
 645         try {
 646             // Check that result is within 1 ulp of strict math or equivalent to math implementation.
 647             for (; i < a.length; i++) {
 648                 Assert.assertTrue(Float.compare(r[i], mathf.apply(a[i], b[i])) == 0 ||
 649                                     isWithin1Ulp(r[i], strictmathf.apply(a[i], b[i])));
 650             }
 651         } catch (AssertionError e) {
 652             Assert.assertTrue(Float.compare(r[i], mathf.apply(a[i], b[i])) == 0, "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", actual = " + r[i] + ", expected = " + mathf.apply(a[i], b[i]));
 653             Assert.assertTrue(isWithin1Ulp(r[i], strictmathf.apply(a[i], b[i])), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", actual = " + r[i] + ", expected (within 1 ulp) = " + strictmathf.apply(a[i], b[i]));
 654         }
 655     }
 656 
 657     static void assertBroadcastArraysEqualsWithinOneUlp(float[] r, float[] a, float[] b,
 658                                                         FBinOp mathf, FBinOp strictmathf) {
 659         int i = 0;
 660         try {
 661             // Check that result is within 1 ulp of strict math or equivalent to math implementation.
 662             for (; i < a.length; i++) {
 663                 Assert.assertTrue(Float.compare(r[i],
 664                                   mathf.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])) == 0 ||
 665                                   isWithin1Ulp(r[i],
 666                                   strictmathf.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])));
 667             }
 668         } catch (AssertionError e) {
 669             Assert.assertTrue(Float.compare(r[i],
 670                               mathf.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])) == 0,
 671                               "at index #" + i + ", input1 = " + a[i] + ", input2 = " +
 672                               b[(i / SPECIES.length()) * SPECIES.length()] + ", actual = " + r[i] +
 673                               ", expected = " + mathf.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]));
 674             Assert.assertTrue(isWithin1Ulp(r[i],
 675                               strictmathf.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])),
 676                              "at index #" + i + ", input1 = " + a[i] + ", input2 = " +
 677                              b[(i / SPECIES.length()) * SPECIES.length()] + ", actual = " + r[i] +
 678                              ", expected (within 1 ulp) = " + strictmathf.apply(a[i],
 679                              b[(i / SPECIES.length()) * SPECIES.length()]));
 680         }
 681     }
 682 
 683     interface FBinArrayOp {
 684         float apply(float[] a, int b);
 685     }
 686 
 687     static void assertArraysEquals(float[] r, float[] a, FBinArrayOp f) {
 688         int i = 0;
 689         try {
 690             for (; i < a.length; i++) {
 691                 Assert.assertEquals(r[i], f.apply(a, i));
 692             }
 693         } catch (AssertionError e) {
 694             Assert.assertEquals(r[i], f.apply(a,i), "at index #" + i);
 695         }
 696     }
 697 
 698     interface FGatherScatterOp {
 699         float[] apply(float[] a, int ix, int[] b, int iy);
 700     }
 701 
 702     static void assertArraysEquals(float[] r, float[] a, int[] b, FGatherScatterOp f) {
 703         int i = 0;
 704         try {
 705             for (; i < a.length; i += SPECIES.length()) {
 706                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 707                   f.apply(a, i, b, i));
 708             }
 709         } catch (AssertionError e) {
 710             float[] ref = f.apply(a, i, b, i);
 711             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 712             Assert.assertEquals(res, ref,
 713               "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: "
 714               + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length()))
 715               + ", b: "
 716               + Arrays.toString(Arrays.copyOfRange(b, i, i+SPECIES.length()))
 717               + " at index #" + i);
 718         }
 719     }
 720 
 721     interface FGatherMaskedOp {
 722         float[] apply(float[] a, int ix, boolean[] mask, int[] b, int iy);
 723     }
 724 
 725     interface FScatterMaskedOp {
 726         float[] apply(float[] r, float[] a, int ix, boolean[] mask, int[] b, int iy);
 727     }
 728 
 729     static void assertArraysEquals(float[] r, float[] a, int[] b, boolean[] mask, FGatherMaskedOp f) {
 730         int i = 0;
 731         try {
 732             for (; i < a.length; i += SPECIES.length()) {
 733                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 734                   f.apply(a, i, mask, b, i));
 735             }
 736         } catch (AssertionError e) {
 737             float[] ref = f.apply(a, i, mask, b, i);
 738             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 739             Assert.assertEquals(res, ref,
 740               "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: "
 741               + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length()))
 742               + ", b: "
 743               + Arrays.toString(Arrays.copyOfRange(b, i, i+SPECIES.length()))
 744               + ", mask: "
 745               + Arrays.toString(mask)
 746               + " at index #" + i);
 747         }
 748     }
 749 
 750     static void assertArraysEquals(float[] r, float[] a, int[] b, boolean[] mask, FScatterMaskedOp f) {
 751         int i = 0;
 752         try {
 753             for (; i < a.length; i += SPECIES.length()) {
 754                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 755                   f.apply(r, a, i, mask, b, i));
 756             }
 757         } catch (AssertionError e) {
 758             float[] ref = f.apply(r, a, i, mask, b, i);
 759             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 760             Assert.assertEquals(res, ref,
 761               "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: "
 762               + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length()))
 763               + ", b: "
 764               + Arrays.toString(Arrays.copyOfRange(b, i, i+SPECIES.length()))
 765               + ", r: "
 766               + Arrays.toString(Arrays.copyOfRange(r, i, i+SPECIES.length()))
 767               + ", mask: "
 768               + Arrays.toString(mask)
 769               + " at index #" + i);
 770         }
 771     }
 772 
 773     interface FLaneOp {
 774         float[] apply(float[] a, int origin, int idx);
 775     }
 776 
 777     static void assertArraysEquals(float[] r, float[] a, int origin, FLaneOp f) {
 778         int i = 0;
 779         try {
 780             for (; i < a.length; i += SPECIES.length()) {
 781                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 782                   f.apply(a, origin, i));
 783             }
 784         } catch (AssertionError e) {
 785             float[] ref = f.apply(a, origin, i);
 786             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 787             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 788               + ", res: " + Arrays.toString(res)
 789               + "), at index #" + i);
 790         }
 791     }
 792 
 793     interface FLaneBop {
 794         float[] apply(float[] a, float[] b, int origin, int idx);
 795     }
 796 
 797     static void assertArraysEquals(float[] r, float[] a, float[] b, int origin, FLaneBop f) {
 798         int i = 0;
 799         try {
 800             for (; i < a.length; i += SPECIES.length()) {
 801                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 802                   f.apply(a, b, origin, i));
 803             }
 804         } catch (AssertionError e) {
 805             float[] ref = f.apply(a, b, origin, i);
 806             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 807             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 808               + ", res: " + Arrays.toString(res)
 809               + "), at index #" + i
 810               + ", at origin #" + origin);
 811         }
 812     }
 813 
 814     interface FLaneMaskedBop {
 815         float[] apply(float[] a, float[] b, int origin, boolean[] mask, int idx);
 816     }
 817 
 818     static void assertArraysEquals(float[] r, float[] a, float[] b, int origin, boolean[] mask, FLaneMaskedBop f) {
 819         int i = 0;
 820         try {
 821             for (; i < a.length; i += SPECIES.length()) {
 822                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 823                   f.apply(a, b, origin, mask, i));
 824             }
 825         } catch (AssertionError e) {
 826             float[] ref = f.apply(a, b, origin, mask, i);
 827             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 828             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 829               + ", res: " + Arrays.toString(res)
 830               + "), at index #" + i
 831               + ", at origin #" + origin);
 832         }
 833     }
 834 
 835     interface FLanePartBop {
 836         float[] apply(float[] a, float[] b, int origin, int part, int idx);
 837     }
 838 
 839     static void assertArraysEquals(float[] r, float[] a, float[] b, int origin, int part, FLanePartBop f) {
 840         int i = 0;
 841         try {
 842             for (; i < a.length; i += SPECIES.length()) {
 843                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 844                   f.apply(a, b, origin, part, i));
 845             }
 846         } catch (AssertionError e) {
 847             float[] ref = f.apply(a, b, origin, part, i);
 848             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 849             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 850               + ", res: " + Arrays.toString(res)
 851               + "), at index #" + i
 852               + ", at origin #" + origin
 853               + ", with part #" + part);
 854         }
 855     }
 856 
 857     interface FLanePartMaskedBop {
 858         float[] apply(float[] a, float[] b, int origin, int part, boolean[] mask, int idx);
 859     }
 860 
 861     static void assertArraysEquals(float[] r, float[] a, float[] b, int origin, int part, boolean[] mask, FLanePartMaskedBop f) {
 862         int i = 0;
 863         try {
 864             for (; i < a.length; i += SPECIES.length()) {
 865                 Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()),
 866                   f.apply(a, b, origin, part, mask, i));
 867             }
 868         } catch (AssertionError e) {
 869             float[] ref = f.apply(a, b, origin, part, mask, i);
 870             float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length());
 871             Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref)
 872               + ", res: " + Arrays.toString(res)
 873               + "), at index #" + i
 874               + ", at origin #" + origin
 875               + ", with part #" + part);
 876         }
 877     }
 878 
 879     static int intCornerCaseValue(int i) {
 880         switch(i % 5) {
 881             case 0:
 882                 return Integer.MAX_VALUE;
 883             case 1:
 884                 return Integer.MIN_VALUE;
 885             case 2:
 886                 return Integer.MIN_VALUE;
 887             case 3:
 888                 return Integer.MAX_VALUE;
 889             default:
 890                 return (int)0;
 891         }
 892     }
 893 
 894     static final List<IntFunction<float[]>> INT_FLOAT_GENERATORS = List.of(
 895             withToString("float[-i * 5]", (int s) -> {
 896                 return fill(s * BUFFER_REPS,
 897                             i -> (float)(-i * 5));
 898             }),
 899             withToString("float[i * 5]", (int s) -> {
 900                 return fill(s * BUFFER_REPS,
 901                             i -> (float)(i * 5));
 902             }),
 903             withToString("float[i + 1]", (int s) -> {
 904                 return fill(s * BUFFER_REPS,
 905                             i -> (((float)(i + 1) == 0) ? 1 : (float)(i + 1)));
 906             }),
 907             withToString("float[intCornerCaseValue(i)]", (int s) -> {
 908                 return fill(s * BUFFER_REPS,
 909                             i -> (float)intCornerCaseValue(i));
 910             })
 911     );
 912 
 913     static void assertArraysEquals(int[] r, float[] a, int offs) {
 914         int i = 0;
 915         try {
 916             for (; i < r.length; i++) {
 917                 Assert.assertEquals(r[i], (int)(a[i+offs]));
 918             }
 919         } catch (AssertionError e) {
 920             Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 921         }
 922     }
 923 
 924     static long longCornerCaseValue(int i) {
 925         switch(i % 5) {
 926             case 0:
 927                 return Long.MAX_VALUE;
 928             case 1:
 929                 return Long.MIN_VALUE;
 930             case 2:
 931                 return Long.MIN_VALUE;
 932             case 3:
 933                 return Long.MAX_VALUE;
 934             default:
 935                 return (long)0;
 936         }
 937     }
 938 
 939     static final List<IntFunction<float[]>> LONG_FLOAT_GENERATORS = List.of(
 940             withToString("float[-i * 5]", (int s) -> {
 941                 return fill(s * BUFFER_REPS,
 942                             i -> (float)(-i * 5));
 943             }),
 944             withToString("float[i * 5]", (int s) -> {
 945                 return fill(s * BUFFER_REPS,
 946                             i -> (float)(i * 5));
 947             }),
 948             withToString("float[i + 1]", (int s) -> {
 949                 return fill(s * BUFFER_REPS,
 950                             i -> (((float)(i + 1) == 0) ? 1 : (float)(i + 1)));
 951             }),
 952             withToString("float[cornerCaseValue(i)]", (int s) -> {
 953                 return fill(s * BUFFER_REPS,
 954                             i -> (float)longCornerCaseValue(i));
 955             })
 956     );
 957 
 958 
 959     static void assertArraysEquals(long[] r, float[] a, int offs) {
 960         int i = 0;
 961         try {
 962             for (; i < r.length; i++) {
 963                 Assert.assertEquals(r[i], (long)(a[i+offs]));
 964             }
 965         } catch (AssertionError e) {
 966             Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 967         }
 968     }
 969 
 970     static void assertArraysEquals(double[] r, float[] a, int offs) {
 971         int i = 0;
 972         try {
 973             for (; i < r.length; i++) {
 974                 Assert.assertEquals(r[i], (double)(a[i+offs]));
 975             }
 976         } catch (AssertionError e) {
 977             Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
 978         }
 979     }
 980 
 981 
 982     static int bits(float e) {
 983         return  Float.floatToIntBits(e);
 984     }
 985 
 986     static final List<IntFunction<float[]>> FLOAT_GENERATORS = List.of(
 987             withToString("float[-i * 5]", (int s) -> {
 988                 return fill(s * BUFFER_REPS,
 989                             i -> (float)(-i * 5));
 990             }),
 991             withToString("float[i * 5]", (int s) -> {
 992                 return fill(s * BUFFER_REPS,
 993                             i -> (float)(i * 5));
 994             }),
 995             withToString("float[i + 1]", (int s) -> {
 996                 return fill(s * BUFFER_REPS,
 997                             i -> (((float)(i + 1) == 0) ? 1 : (float)(i + 1)));
 998             }),
 999             withToString("float[cornerCaseValue(i)]", (int s) -> {
1000                 return fill(s * BUFFER_REPS,
1001                             i -> cornerCaseValue(i));
1002             })
1003     );
1004 
1005     // Create combinations of pairs
1006     // @@@ Might be sensitive to order e.g. div by 0
1007     static final List<List<IntFunction<float[]>>> FLOAT_GENERATOR_PAIRS =
1008         Stream.of(FLOAT_GENERATORS.get(0)).
1009                 flatMap(fa -> FLOAT_GENERATORS.stream().skip(1).map(fb -> List.of(fa, fb))).
1010                 collect(Collectors.toList());
1011 
1012     @DataProvider
1013     public Object[][] boolUnaryOpProvider() {
1014         return BOOL_ARRAY_GENERATORS.stream().
1015                 map(f -> new Object[]{f}).
1016                 toArray(Object[][]::new);
1017     }
1018 
1019     static final List<List<IntFunction<float[]>>> FLOAT_GENERATOR_TRIPLES =
1020         FLOAT_GENERATOR_PAIRS.stream().
1021                 flatMap(pair -> FLOAT_GENERATORS.stream().map(f -> List.of(pair.get(0), pair.get(1), f))).
1022                 collect(Collectors.toList());
1023 
1024     @DataProvider
1025     public Object[][] floatBinaryOpProvider() {
1026         return FLOAT_GENERATOR_PAIRS.stream().map(List::toArray).
1027                 toArray(Object[][]::new);
1028     }
1029 
1030     @DataProvider
1031     public Object[][] floatIndexedOpProvider() {
1032         return FLOAT_GENERATOR_PAIRS.stream().map(List::toArray).
1033                 toArray(Object[][]::new);
1034     }
1035 
1036     @DataProvider
1037     public Object[][] floatBinaryOpMaskProvider() {
1038         return BOOLEAN_MASK_GENERATORS.stream().
1039                 flatMap(fm -> FLOAT_GENERATOR_PAIRS.stream().map(lfa -> {
1040                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1041                 })).
1042                 toArray(Object[][]::new);
1043     }
1044 
1045     @DataProvider
1046     public Object[][] floatTernaryOpProvider() {
1047         return FLOAT_GENERATOR_TRIPLES.stream().map(List::toArray).
1048                 toArray(Object[][]::new);
1049     }
1050 
1051     @DataProvider
1052     public Object[][] floatTernaryOpMaskProvider() {
1053         return BOOLEAN_MASK_GENERATORS.stream().
1054                 flatMap(fm -> FLOAT_GENERATOR_TRIPLES.stream().map(lfa -> {
1055                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1056                 })).
1057                 toArray(Object[][]::new);
1058     }
1059 
1060     @DataProvider
1061     public Object[][] floatUnaryOpProvider() {
1062         return FLOAT_GENERATORS.stream().
1063                 map(f -> new Object[]{f}).
1064                 toArray(Object[][]::new);
1065     }
1066 
1067     @DataProvider
1068     public Object[][] floatUnaryOpMaskProvider() {
1069         return BOOLEAN_MASK_GENERATORS.stream().
1070                 flatMap(fm -> FLOAT_GENERATORS.stream().map(fa -> {
1071                     return new Object[] {fa, fm};
1072                 })).
1073                 toArray(Object[][]::new);
1074     }
1075 
1076     @DataProvider
1077     public Object[][] floattoIntUnaryOpProvider() {
1078         return INT_FLOAT_GENERATORS.stream().
1079                 map(f -> new Object[]{f}).
1080                 toArray(Object[][]::new);
1081     }
1082 
1083     @DataProvider
1084     public Object[][] floattoLongUnaryOpProvider() {
1085         return LONG_FLOAT_GENERATORS.stream().
1086                 map(f -> new Object[]{f}).
1087                 toArray(Object[][]::new);
1088     }
1089 
1090     @DataProvider
1091     public Object[][] maskProvider() {
1092         return BOOLEAN_MASK_GENERATORS.stream().
1093                 map(f -> new Object[]{f}).
1094                 toArray(Object[][]::new);
1095     }
1096 
1097     @DataProvider
1098     public Object[][] maskCompareOpProvider() {
1099         return BOOLEAN_MASK_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
1100                 toArray(Object[][]::new);
1101     }
1102 
1103     @DataProvider
1104     public Object[][] shuffleProvider() {
1105         return INT_SHUFFLE_GENERATORS.stream().
1106                 map(f -> new Object[]{f}).
1107                 toArray(Object[][]::new);
1108     }
1109 
1110     @DataProvider
1111     public Object[][] shuffleCompareOpProvider() {
1112         return INT_SHUFFLE_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
1113                 toArray(Object[][]::new);
1114     }
1115 
1116     @DataProvider
1117     public Object[][] floatUnaryOpShuffleProvider() {
1118         return INT_SHUFFLE_GENERATORS.stream().
1119                 flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1120                     return new Object[] {fa, fs};
1121                 })).
1122                 toArray(Object[][]::new);
1123     }
1124 
1125     @DataProvider
1126     public Object[][] floatUnaryOpShuffleMaskProvider() {
1127         return BOOLEAN_MASK_GENERATORS.stream().
1128                 flatMap(fm -> INT_SHUFFLE_GENERATORS.stream().
1129                     flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1130                         return new Object[] {fa, fs, fm};
1131                 }))).
1132                 toArray(Object[][]::new);
1133     }
1134 
1135     static final List<BiFunction<Integer,Integer,float[]>> FLOAT_SHUFFLE_GENERATORS = List.of(
1136             withToStringBi("shuffle[random]", (Integer l, Integer m) -> {
1137                 float[] a = new float[l];
1138                 int upper = m;
1139                 for (int i = 0; i < 1; i++) {
1140                     a[i] = (float)RAND.nextInt(upper);
1141                 }
1142                 return a;
1143             })
1144     );
1145 
1146     @DataProvider
1147     public Object[][] floatUnaryOpSelectFromProvider() {
1148         return FLOAT_SHUFFLE_GENERATORS.stream().
1149                 flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1150                     return new Object[] {fa, fs};
1151                 })).
1152                 toArray(Object[][]::new);
1153     }
1154 
1155     @DataProvider
1156     public Object[][] floatUnaryOpSelectFromMaskProvider() {
1157         return BOOLEAN_MASK_GENERATORS.stream().
1158                 flatMap(fm -> FLOAT_SHUFFLE_GENERATORS.stream().
1159                     flatMap(fs -> FLOAT_GENERATORS.stream().map(fa -> {
1160                         return new Object[] {fa, fs, fm};
1161                 }))).
1162                 toArray(Object[][]::new);
1163     }
1164 
1165 
1166     static final List<IntFunction<float[]>> FLOAT_COMPARE_GENERATORS = List.of(
1167             withToString("float[i]", (int s) -> {
1168                 return fill(s * BUFFER_REPS,
1169                             i -> (float)i);
1170             }),
1171             withToString("float[i - length / 2]", (int s) -> {
1172                 return fill(s * BUFFER_REPS,
1173                             i -> (float)(i - (s * BUFFER_REPS / 2)));
1174             }),
1175             withToString("float[i + 1]", (int s) -> {
1176                 return fill(s * BUFFER_REPS,
1177                             i -> (float)(i + 1));
1178             }),
1179             withToString("float[i - 2]", (int s) -> {
1180                 return fill(s * BUFFER_REPS,
1181                             i -> (float)(i - 2));
1182             }),
1183             withToString("float[zigZag(i)]", (int s) -> {
1184                 return fill(s * BUFFER_REPS,
1185                             i -> i%3 == 0 ? (float)i : (i%3 == 1 ? (float)(i + 1) : (float)(i - 2)));
1186             }),
1187             withToString("float[cornerCaseValue(i)]", (int s) -> {
1188                 return fill(s * BUFFER_REPS,
1189                             i -> cornerCaseValue(i));
1190             })
1191     );
1192 
1193     static final List<List<IntFunction<float[]>>> FLOAT_TEST_GENERATOR_ARGS =
1194         FLOAT_COMPARE_GENERATORS.stream().
1195                 map(fa -> List.of(fa)).
1196                 collect(Collectors.toList());
1197 
1198     @DataProvider
1199     public Object[][] floatTestOpProvider() {
1200         return FLOAT_TEST_GENERATOR_ARGS.stream().map(List::toArray).
1201                 toArray(Object[][]::new);
1202     }
1203 
1204     @DataProvider
1205     public Object[][] floatTestOpMaskProvider() {
1206         return BOOLEAN_MASK_GENERATORS.stream().
1207                 flatMap(fm -> FLOAT_TEST_GENERATOR_ARGS.stream().map(lfa -> {
1208                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1209                 })).
1210                 toArray(Object[][]::new);
1211     }
1212 
1213     static final List<List<IntFunction<float[]>>> FLOAT_COMPARE_GENERATOR_PAIRS =
1214         FLOAT_COMPARE_GENERATORS.stream().
1215                 flatMap(fa -> FLOAT_COMPARE_GENERATORS.stream().map(fb -> List.of(fa, fb))).
1216                 collect(Collectors.toList());
1217 
1218     @DataProvider
1219     public Object[][] floatCompareOpProvider() {
1220         return FLOAT_COMPARE_GENERATOR_PAIRS.stream().map(List::toArray).
1221                 toArray(Object[][]::new);
1222     }
1223 
1224     @DataProvider
1225     public Object[][] floatCompareOpMaskProvider() {
1226         return BOOLEAN_MASK_GENERATORS.stream().
1227                 flatMap(fm -> FLOAT_COMPARE_GENERATOR_PAIRS.stream().map(lfa -> {
1228                     return Stream.concat(lfa.stream(), Stream.of(fm)).toArray();
1229                 })).
1230                 toArray(Object[][]::new);
1231     }
1232 
1233     interface ToFloatF {
1234         float apply(int i);
1235     }
1236 
1237     static float[] fill(int s , ToFloatF f) {
1238         return fill(new float[s], f);
1239     }
1240 
1241     static float[] fill(float[] a, ToFloatF f) {
1242         for (int i = 0; i < a.length; i++) {
1243             a[i] = f.apply(i);
1244         }
1245         return a;
1246     }
1247 
1248     static float cornerCaseValue(int i) {
1249         switch(i % 7) {
1250             case 0:
1251                 return Float.MAX_VALUE;
1252             case 1:
1253                 return Float.MIN_VALUE;
1254             case 2:
1255                 return Float.NEGATIVE_INFINITY;
1256             case 3:
1257                 return Float.POSITIVE_INFINITY;
1258             case 4:
1259                 return Float.NaN;
1260             case 5:
1261                 return (float)0.0;
1262             default:
1263                 return (float)-0.0;
1264         }
1265     }
1266 
1267     static float get(float[] a, int i) {
1268         return (float) a[i];
1269     }
1270 
1271     static final IntFunction<float[]> fr = (vl) -> {
1272         int length = BUFFER_REPS * vl;
1273         return new float[length];
1274     };
1275 
1276     static final IntFunction<boolean[]> fmr = (vl) -> {
1277         int length = BUFFER_REPS * vl;
1278         return new boolean[length];
1279     };
1280 
1281     static final IntFunction<long[]> lfr = (vl) -> {
1282         int length = BUFFER_REPS * vl;
1283         return new long[length];
1284     };
1285 
1286 
1287     static boolean eq(float a, float b) {
1288         return a == b;
1289     }
1290 
1291     static boolean neq(float a, float b) {
1292         return a != b;
1293     }
1294 
1295     static boolean lt(float a, float b) {
1296         return a < b;
1297     }
1298 
1299     static boolean le(float a, float b) {
1300         return a <= b;
1301     }
1302 
1303     static boolean gt(float a, float b) {
1304         return a > b;
1305     }
1306 
1307     static boolean ge(float a, float b) {
1308         return a >= b;
1309     }
1310 
1311 
1312     @Test
1313     static void smokeTest1() {
1314         FloatVector three = FloatVector.broadcast(SPECIES, (byte)-3);
1315         FloatVector three2 = (FloatVector) SPECIES.broadcast(-3);
1316         assert(three.eq(three2).allTrue());
1317         FloatVector three3 = three2.broadcast(1).broadcast(-3);
1318         assert(three.eq(three3).allTrue());
1319         int scale = 2;
1320         Class<?> ETYPE = float.class;
1321         if (ETYPE == double.class || ETYPE == long.class)
1322             scale = 1000000;
1323         else if (ETYPE == byte.class && SPECIES.length() >= 64)
1324             scale = 1;
1325         FloatVector higher = three.addIndex(scale);
1326         VectorMask<Float> m = three.compare(VectorOperators.LE, higher);
1327         assert(m.allTrue());
1328         m = higher.min((float)-1).test(VectorOperators.IS_NEGATIVE);
1329         assert(m.allTrue());
1330         m = higher.test(VectorOperators.IS_FINITE);
1331         assert(m.allTrue());
1332         float max = higher.reduceLanes(VectorOperators.MAX);
1333         assert(max == -3 + scale * (SPECIES.length()-1));
1334     }
1335 
1336     private static float[]
1337     bothToArray(FloatVector a, FloatVector b) {
1338         float[] r = new float[a.length() + b.length()];
1339         a.intoArray(r, 0);
1340         b.intoArray(r, a.length());
1341         return r;
1342     }
1343 
1344     @Test
1345     static void smokeTest2() {
1346         // Do some zipping and shuffling.
1347         FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1);
1348         FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector();
1349         Assert.assertEquals(io, io2);
1350         FloatVector a = io.add((float)1); //[1,2]
1351         FloatVector b = a.neg();  //[-1,-2]
1352         float[] abValues = bothToArray(a,b); //[1,2,-1,-2]
1353         VectorShuffle<Float> zip0 = VectorShuffle.makeZip(SPECIES, 0);
1354         VectorShuffle<Float> zip1 = VectorShuffle.makeZip(SPECIES, 1);
1355         FloatVector zab0 = a.rearrange(zip0,b); //[1,-1]
1356         FloatVector zab1 = a.rearrange(zip1,b); //[2,-2]
1357         float[] zabValues = bothToArray(zab0, zab1); //[1,-1,2,-2]
1358         // manually zip
1359         float[] manual = new float[zabValues.length];
1360         for (int i = 0; i < manual.length; i += 2) {
1361             manual[i+0] = abValues[i/2];
1362             manual[i+1] = abValues[a.length() + i/2];
1363         }
1364         Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual));
1365         VectorShuffle<Float> unz0 = VectorShuffle.makeUnzip(SPECIES, 0);
1366         VectorShuffle<Float> unz1 = VectorShuffle.makeUnzip(SPECIES, 1);
1367         FloatVector uab0 = zab0.rearrange(unz0,zab1);
1368         FloatVector uab1 = zab0.rearrange(unz1,zab1);
1369         float[] abValues1 = bothToArray(uab0, uab1);
1370         Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1));
1371     }
1372 
1373     static void iotaShuffle() {
1374         FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1);
1375         FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector();
1376         Assert.assertEquals(io, io2);
1377     }
1378 
1379     @Test
1380     // Test all shuffle related operations.
1381     static void shuffleTest() {
1382         // To test backend instructions, make sure that C2 is used.
1383         for (int loop = 0; loop < INVOC_COUNT * INVOC_COUNT; loop++) {
1384             iotaShuffle();
1385         }
1386     }
1387 
1388     @Test
1389     void viewAsIntegeralLanesTest() {
1390         Vector<?> asIntegral = SPECIES.zero().viewAsIntegralLanes();
1391         VectorSpecies<?> asIntegralSpecies = asIntegral.species();
1392         Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType());
1393         Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape());
1394         Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length());
1395         Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES);
1396     }
1397 
1398     @Test
1399     void viewAsFloatingLanesTest() {
1400         Vector<?> asFloating = SPECIES.zero().viewAsFloatingLanes();
1401         Assert.assertEquals(asFloating.species(), SPECIES);
1402     }
1403 
1404     static float ADD(float a, float b) {
1405         return (float)(a + b);
1406     }
1407 
1408     @Test(dataProvider = "floatBinaryOpProvider")
1409     static void ADDFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1410         float[] a = fa.apply(SPECIES.length());
1411         float[] b = fb.apply(SPECIES.length());
1412         float[] r = fr.apply(SPECIES.length());
1413 
1414         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1415             for (int i = 0; i < a.length; i += SPECIES.length()) {
1416                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1417                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1418                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
1419             }
1420         }
1421 
1422         assertArraysEquals(r, a, b, Float128VectorTests::ADD);
1423     }
1424     static float add(float a, float b) {
1425         return (float)(a + b);
1426     }
1427 
1428     @Test(dataProvider = "floatBinaryOpProvider")
1429     static void addFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1430         float[] a = fa.apply(SPECIES.length());
1431         float[] b = fb.apply(SPECIES.length());
1432         float[] r = fr.apply(SPECIES.length());
1433 
1434         for (int i = 0; i < a.length; i += SPECIES.length()) {
1435             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1436             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1437             av.add(bv).intoArray(r, i);
1438         }
1439 
1440         assertArraysEquals(r, a, b, Float128VectorTests::add);
1441     }
1442 
1443     @Test(dataProvider = "floatBinaryOpMaskProvider")
1444     static void ADDFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1445                                           IntFunction<boolean[]> fm) {
1446         float[] a = fa.apply(SPECIES.length());
1447         float[] b = fb.apply(SPECIES.length());
1448         float[] r = fr.apply(SPECIES.length());
1449         boolean[] mask = fm.apply(SPECIES.length());
1450         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1451 
1452         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1453             for (int i = 0; i < a.length; i += SPECIES.length()) {
1454                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1455                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1456                 av.lanewise(VectorOperators.ADD, bv, vmask).intoArray(r, i);
1457             }
1458         }
1459 
1460         assertArraysEquals(r, a, b, mask, Float128VectorTests::ADD);
1461     }
1462 
1463     @Test(dataProvider = "floatBinaryOpMaskProvider")
1464     static void addFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1465                                           IntFunction<boolean[]> fm) {
1466         float[] a = fa.apply(SPECIES.length());
1467         float[] b = fb.apply(SPECIES.length());
1468         float[] r = fr.apply(SPECIES.length());
1469         boolean[] mask = fm.apply(SPECIES.length());
1470         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1471 
1472         for (int i = 0; i < a.length; i += SPECIES.length()) {
1473             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1474             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1475             av.add(bv, vmask).intoArray(r, i);
1476         }
1477 
1478         assertArraysEquals(r, a, b, mask, Float128VectorTests::add);
1479     }
1480     static float SUB(float a, float b) {
1481         return (float)(a - b);
1482     }
1483 
1484     @Test(dataProvider = "floatBinaryOpProvider")
1485     static void SUBFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1486         float[] a = fa.apply(SPECIES.length());
1487         float[] b = fb.apply(SPECIES.length());
1488         float[] r = fr.apply(SPECIES.length());
1489 
1490         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1491             for (int i = 0; i < a.length; i += SPECIES.length()) {
1492                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1493                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1494                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
1495             }
1496         }
1497 
1498         assertArraysEquals(r, a, b, Float128VectorTests::SUB);
1499     }
1500     static float sub(float a, float b) {
1501         return (float)(a - b);
1502     }
1503 
1504     @Test(dataProvider = "floatBinaryOpProvider")
1505     static void subFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1506         float[] a = fa.apply(SPECIES.length());
1507         float[] b = fb.apply(SPECIES.length());
1508         float[] r = fr.apply(SPECIES.length());
1509 
1510         for (int i = 0; i < a.length; i += SPECIES.length()) {
1511             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1512             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1513             av.sub(bv).intoArray(r, i);
1514         }
1515 
1516         assertArraysEquals(r, a, b, Float128VectorTests::sub);
1517     }
1518 
1519     @Test(dataProvider = "floatBinaryOpMaskProvider")
1520     static void SUBFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1521                                           IntFunction<boolean[]> fm) {
1522         float[] a = fa.apply(SPECIES.length());
1523         float[] b = fb.apply(SPECIES.length());
1524         float[] r = fr.apply(SPECIES.length());
1525         boolean[] mask = fm.apply(SPECIES.length());
1526         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1527 
1528         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1529             for (int i = 0; i < a.length; i += SPECIES.length()) {
1530                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1531                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1532                 av.lanewise(VectorOperators.SUB, bv, vmask).intoArray(r, i);
1533             }
1534         }
1535 
1536         assertArraysEquals(r, a, b, mask, Float128VectorTests::SUB);
1537     }
1538 
1539     @Test(dataProvider = "floatBinaryOpMaskProvider")
1540     static void subFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1541                                           IntFunction<boolean[]> fm) {
1542         float[] a = fa.apply(SPECIES.length());
1543         float[] b = fb.apply(SPECIES.length());
1544         float[] r = fr.apply(SPECIES.length());
1545         boolean[] mask = fm.apply(SPECIES.length());
1546         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1547 
1548         for (int i = 0; i < a.length; i += SPECIES.length()) {
1549             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1550             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1551             av.sub(bv, vmask).intoArray(r, i);
1552         }
1553 
1554         assertArraysEquals(r, a, b, mask, Float128VectorTests::sub);
1555     }
1556     static float MUL(float a, float b) {
1557         return (float)(a * b);
1558     }
1559 
1560     @Test(dataProvider = "floatBinaryOpProvider")
1561     static void MULFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1562         float[] a = fa.apply(SPECIES.length());
1563         float[] b = fb.apply(SPECIES.length());
1564         float[] r = fr.apply(SPECIES.length());
1565 
1566         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1567             for (int i = 0; i < a.length; i += SPECIES.length()) {
1568                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1569                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1570                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
1571             }
1572         }
1573 
1574         assertArraysEquals(r, a, b, Float128VectorTests::MUL);
1575     }
1576     static float mul(float a, float b) {
1577         return (float)(a * b);
1578     }
1579 
1580     @Test(dataProvider = "floatBinaryOpProvider")
1581     static void mulFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1582         float[] a = fa.apply(SPECIES.length());
1583         float[] b = fb.apply(SPECIES.length());
1584         float[] r = fr.apply(SPECIES.length());
1585 
1586         for (int i = 0; i < a.length; i += SPECIES.length()) {
1587             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1588             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1589             av.mul(bv).intoArray(r, i);
1590         }
1591 
1592         assertArraysEquals(r, a, b, Float128VectorTests::mul);
1593     }
1594 
1595     @Test(dataProvider = "floatBinaryOpMaskProvider")
1596     static void MULFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1597                                           IntFunction<boolean[]> fm) {
1598         float[] a = fa.apply(SPECIES.length());
1599         float[] b = fb.apply(SPECIES.length());
1600         float[] r = fr.apply(SPECIES.length());
1601         boolean[] mask = fm.apply(SPECIES.length());
1602         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1603 
1604         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1605             for (int i = 0; i < a.length; i += SPECIES.length()) {
1606                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1607                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1608                 av.lanewise(VectorOperators.MUL, bv, vmask).intoArray(r, i);
1609             }
1610         }
1611 
1612         assertArraysEquals(r, a, b, mask, Float128VectorTests::MUL);
1613     }
1614 
1615     @Test(dataProvider = "floatBinaryOpMaskProvider")
1616     static void mulFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1617                                           IntFunction<boolean[]> fm) {
1618         float[] a = fa.apply(SPECIES.length());
1619         float[] b = fb.apply(SPECIES.length());
1620         float[] r = fr.apply(SPECIES.length());
1621         boolean[] mask = fm.apply(SPECIES.length());
1622         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1623 
1624         for (int i = 0; i < a.length; i += SPECIES.length()) {
1625             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1626             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1627             av.mul(bv, vmask).intoArray(r, i);
1628         }
1629 
1630         assertArraysEquals(r, a, b, mask, Float128VectorTests::mul);
1631     }
1632 
1633     static float DIV(float a, float b) {
1634         return (float)(a / b);
1635     }
1636 
1637     @Test(dataProvider = "floatBinaryOpProvider")
1638     static void DIVFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1639         float[] a = fa.apply(SPECIES.length());
1640         float[] b = fb.apply(SPECIES.length());
1641         float[] r = fr.apply(SPECIES.length());
1642 
1643         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1644             for (int i = 0; i < a.length; i += SPECIES.length()) {
1645                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1646                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1647                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
1648             }
1649         }
1650 
1651         assertArraysEquals(r, a, b, Float128VectorTests::DIV);
1652     }
1653     static float div(float a, float b) {
1654         return (float)(a / b);
1655     }
1656 
1657     @Test(dataProvider = "floatBinaryOpProvider")
1658     static void divFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1659         float[] a = fa.apply(SPECIES.length());
1660         float[] b = fb.apply(SPECIES.length());
1661         float[] r = fr.apply(SPECIES.length());
1662 
1663         for (int i = 0; i < a.length; i += SPECIES.length()) {
1664             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1665             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1666             av.div(bv).intoArray(r, i);
1667         }
1668 
1669         assertArraysEquals(r, a, b, Float128VectorTests::div);
1670     }
1671 
1672 
1673 
1674     @Test(dataProvider = "floatBinaryOpMaskProvider")
1675     static void DIVFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1676                                           IntFunction<boolean[]> fm) {
1677         float[] a = fa.apply(SPECIES.length());
1678         float[] b = fb.apply(SPECIES.length());
1679         float[] r = fr.apply(SPECIES.length());
1680         boolean[] mask = fm.apply(SPECIES.length());
1681         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1682 
1683         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1684             for (int i = 0; i < a.length; i += SPECIES.length()) {
1685                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1686                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1687                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
1688             }
1689         }
1690 
1691         assertArraysEquals(r, a, b, mask, Float128VectorTests::DIV);
1692     }
1693 
1694     @Test(dataProvider = "floatBinaryOpMaskProvider")
1695     static void divFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1696                                           IntFunction<boolean[]> fm) {
1697         float[] a = fa.apply(SPECIES.length());
1698         float[] b = fb.apply(SPECIES.length());
1699         float[] r = fr.apply(SPECIES.length());
1700         boolean[] mask = fm.apply(SPECIES.length());
1701         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1702 
1703         for (int i = 0; i < a.length; i += SPECIES.length()) {
1704             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1705             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1706             av.div(bv, vmask).intoArray(r, i);
1707         }
1708 
1709         assertArraysEquals(r, a, b, mask, Float128VectorTests::div);
1710     }
1711 
1712 
1713 
1714     static float FIRST_NONZERO(float a, float b) {
1715         return (float)(Double.doubleToLongBits(a)!=0?a:b);
1716     }
1717 
1718     @Test(dataProvider = "floatBinaryOpProvider")
1719     static void FIRST_NONZEROFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1720         float[] a = fa.apply(SPECIES.length());
1721         float[] b = fb.apply(SPECIES.length());
1722         float[] r = fr.apply(SPECIES.length());
1723 
1724         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1725             for (int i = 0; i < a.length; i += SPECIES.length()) {
1726                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1727                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1728                 av.lanewise(VectorOperators.FIRST_NONZERO, bv).intoArray(r, i);
1729             }
1730         }
1731 
1732         assertArraysEquals(r, a, b, Float128VectorTests::FIRST_NONZERO);
1733     }
1734 
1735     @Test(dataProvider = "floatBinaryOpMaskProvider")
1736     static void FIRST_NONZEROFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
1737                                           IntFunction<boolean[]> fm) {
1738         float[] a = fa.apply(SPECIES.length());
1739         float[] b = fb.apply(SPECIES.length());
1740         float[] r = fr.apply(SPECIES.length());
1741         boolean[] mask = fm.apply(SPECIES.length());
1742         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1743 
1744         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1745             for (int i = 0; i < a.length; i += SPECIES.length()) {
1746                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1747                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1748                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
1749             }
1750         }
1751 
1752         assertArraysEquals(r, a, b, mask, Float128VectorTests::FIRST_NONZERO);
1753     }
1754 
1755 
1756 
1757 
1758 
1759 
1760 
1761 
1762 
1763     @Test(dataProvider = "floatBinaryOpProvider")
1764     static void addFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1765         float[] a = fa.apply(SPECIES.length());
1766         float[] b = fb.apply(SPECIES.length());
1767         float[] r = fr.apply(SPECIES.length());
1768 
1769         for (int i = 0; i < a.length; i += SPECIES.length()) {
1770             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1771             av.add(b[i]).intoArray(r, i);
1772         }
1773 
1774         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::add);
1775     }
1776 
1777     @Test(dataProvider = "floatBinaryOpMaskProvider")
1778     static void addFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1779                                           IntFunction<boolean[]> fm) {
1780         float[] a = fa.apply(SPECIES.length());
1781         float[] b = fb.apply(SPECIES.length());
1782         float[] r = fr.apply(SPECIES.length());
1783         boolean[] mask = fm.apply(SPECIES.length());
1784         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1785 
1786         for (int i = 0; i < a.length; i += SPECIES.length()) {
1787             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1788             av.add(b[i], vmask).intoArray(r, i);
1789         }
1790 
1791         assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::add);
1792     }
1793 
1794     @Test(dataProvider = "floatBinaryOpProvider")
1795     static void subFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1796         float[] a = fa.apply(SPECIES.length());
1797         float[] b = fb.apply(SPECIES.length());
1798         float[] r = fr.apply(SPECIES.length());
1799 
1800         for (int i = 0; i < a.length; i += SPECIES.length()) {
1801             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1802             av.sub(b[i]).intoArray(r, i);
1803         }
1804 
1805         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::sub);
1806     }
1807 
1808     @Test(dataProvider = "floatBinaryOpMaskProvider")
1809     static void subFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1810                                           IntFunction<boolean[]> fm) {
1811         float[] a = fa.apply(SPECIES.length());
1812         float[] b = fb.apply(SPECIES.length());
1813         float[] r = fr.apply(SPECIES.length());
1814         boolean[] mask = fm.apply(SPECIES.length());
1815         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1816 
1817         for (int i = 0; i < a.length; i += SPECIES.length()) {
1818             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1819             av.sub(b[i], vmask).intoArray(r, i);
1820         }
1821 
1822         assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::sub);
1823     }
1824 
1825     @Test(dataProvider = "floatBinaryOpProvider")
1826     static void mulFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1827         float[] a = fa.apply(SPECIES.length());
1828         float[] b = fb.apply(SPECIES.length());
1829         float[] r = fr.apply(SPECIES.length());
1830 
1831         for (int i = 0; i < a.length; i += SPECIES.length()) {
1832             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1833             av.mul(b[i]).intoArray(r, i);
1834         }
1835 
1836         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::mul);
1837     }
1838 
1839     @Test(dataProvider = "floatBinaryOpMaskProvider")
1840     static void mulFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1841                                           IntFunction<boolean[]> fm) {
1842         float[] a = fa.apply(SPECIES.length());
1843         float[] b = fb.apply(SPECIES.length());
1844         float[] r = fr.apply(SPECIES.length());
1845         boolean[] mask = fm.apply(SPECIES.length());
1846         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1847 
1848         for (int i = 0; i < a.length; i += SPECIES.length()) {
1849             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1850             av.mul(b[i], vmask).intoArray(r, i);
1851         }
1852 
1853         assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::mul);
1854     }
1855 
1856 
1857     @Test(dataProvider = "floatBinaryOpProvider")
1858     static void divFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1859         float[] a = fa.apply(SPECIES.length());
1860         float[] b = fb.apply(SPECIES.length());
1861         float[] r = fr.apply(SPECIES.length());
1862 
1863         for (int i = 0; i < a.length; i += SPECIES.length()) {
1864             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1865             av.div(b[i]).intoArray(r, i);
1866         }
1867 
1868         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::div);
1869     }
1870 
1871 
1872 
1873     @Test(dataProvider = "floatBinaryOpMaskProvider")
1874     static void divFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1875                                           IntFunction<boolean[]> fm) {
1876         float[] a = fa.apply(SPECIES.length());
1877         float[] b = fb.apply(SPECIES.length());
1878         float[] r = fr.apply(SPECIES.length());
1879         boolean[] mask = fm.apply(SPECIES.length());
1880         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1881 
1882         for (int i = 0; i < a.length; i += SPECIES.length()) {
1883             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1884             av.div(b[i], vmask).intoArray(r, i);
1885         }
1886 
1887         assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::div);
1888     }
1889 
1890 
1891 
1892 
1893 
1894 
1895 
1896 
1897 
1898 
1899     @Test(dataProvider = "floatBinaryOpProvider")
1900     static void ADDFloat128VectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1901         float[] a = fa.apply(SPECIES.length());
1902         float[] b = fb.apply(SPECIES.length());
1903         float[] r = fr.apply(SPECIES.length());
1904 
1905         for (int i = 0; i < a.length; i += SPECIES.length()) {
1906             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1907             av.lanewise(VectorOperators.ADD, (long)b[i]).intoArray(r, i);
1908         }
1909 
1910         assertBroadcastLongArraysEquals(r, a, b, Float128VectorTests::ADD);
1911     }
1912 
1913     @Test(dataProvider = "floatBinaryOpMaskProvider")
1914     static void ADDFloat128VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
1915                                           IntFunction<boolean[]> fm) {
1916         float[] a = fa.apply(SPECIES.length());
1917         float[] b = fb.apply(SPECIES.length());
1918         float[] r = fr.apply(SPECIES.length());
1919         boolean[] mask = fm.apply(SPECIES.length());
1920         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1921 
1922         for (int i = 0; i < a.length; i += SPECIES.length()) {
1923             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1924             av.lanewise(VectorOperators.ADD, (long)b[i], vmask).intoArray(r, i);
1925         }
1926 
1927         assertBroadcastLongArraysEquals(r, a, b, mask, Float128VectorTests::ADD);
1928     }
1929 
1930 
1931 
1932 
1933 
1934 
1935 
1936 
1937 
1938 
1939 
1940 
1941 
1942 
1943 
1944 
1945 
1946 
1947 
1948 
1949 
1950 
1951 
1952 
1953 
1954 
1955 
1956 
1957 
1958 
1959 
1960 
1961 
1962 
1963 
1964 
1965 
1966 
1967 
1968 
1969 
1970 
1971 
1972 
1973     static float MIN(float a, float b) {
1974         return (float)(Math.min(a, b));
1975     }
1976 
1977     @Test(dataProvider = "floatBinaryOpProvider")
1978     static void MINFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1979         float[] a = fa.apply(SPECIES.length());
1980         float[] b = fb.apply(SPECIES.length());
1981         float[] r = fr.apply(SPECIES.length());
1982 
1983         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1984             for (int i = 0; i < a.length; i += SPECIES.length()) {
1985                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
1986                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
1987                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
1988             }
1989         }
1990 
1991         assertArraysEquals(r, a, b, Float128VectorTests::MIN);
1992     }
1993     static float min(float a, float b) {
1994         return (float)(Math.min(a, b));
1995     }
1996 
1997     @Test(dataProvider = "floatBinaryOpProvider")
1998     static void minFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
1999         float[] a = fa.apply(SPECIES.length());
2000         float[] b = fb.apply(SPECIES.length());
2001         float[] r = fr.apply(SPECIES.length());
2002 
2003         for (int i = 0; i < a.length; i += SPECIES.length()) {
2004             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2005             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2006             av.min(bv).intoArray(r, i);
2007         }
2008 
2009         assertArraysEquals(r, a, b, Float128VectorTests::min);
2010     }
2011     static float MAX(float a, float b) {
2012         return (float)(Math.max(a, b));
2013     }
2014 
2015     @Test(dataProvider = "floatBinaryOpProvider")
2016     static void MAXFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2017         float[] a = fa.apply(SPECIES.length());
2018         float[] b = fb.apply(SPECIES.length());
2019         float[] r = fr.apply(SPECIES.length());
2020 
2021         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2022             for (int i = 0; i < a.length; i += SPECIES.length()) {
2023                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2024                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2025                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
2026             }
2027         }
2028 
2029         assertArraysEquals(r, a, b, Float128VectorTests::MAX);
2030     }
2031     static float max(float a, float b) {
2032         return (float)(Math.max(a, b));
2033     }
2034 
2035     @Test(dataProvider = "floatBinaryOpProvider")
2036     static void maxFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2037         float[] a = fa.apply(SPECIES.length());
2038         float[] b = fb.apply(SPECIES.length());
2039         float[] r = fr.apply(SPECIES.length());
2040 
2041         for (int i = 0; i < a.length; i += SPECIES.length()) {
2042             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2043             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2044             av.max(bv).intoArray(r, i);
2045         }
2046 
2047         assertArraysEquals(r, a, b, Float128VectorTests::max);
2048     }
2049 
2050     @Test(dataProvider = "floatBinaryOpProvider")
2051     static void MINFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2052         float[] a = fa.apply(SPECIES.length());
2053         float[] b = fb.apply(SPECIES.length());
2054         float[] r = fr.apply(SPECIES.length());
2055 
2056         for (int i = 0; i < a.length; i += SPECIES.length()) {
2057             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2058             av.lanewise(VectorOperators.MIN, b[i]).intoArray(r, i);
2059         }
2060 
2061         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::MIN);
2062     }
2063 
2064     @Test(dataProvider = "floatBinaryOpProvider")
2065     static void minFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2066         float[] a = fa.apply(SPECIES.length());
2067         float[] b = fb.apply(SPECIES.length());
2068         float[] r = fr.apply(SPECIES.length());
2069 
2070         for (int i = 0; i < a.length; i += SPECIES.length()) {
2071             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2072             av.min(b[i]).intoArray(r, i);
2073         }
2074 
2075         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::min);
2076     }
2077 
2078     @Test(dataProvider = "floatBinaryOpProvider")
2079     static void MAXFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2080         float[] a = fa.apply(SPECIES.length());
2081         float[] b = fb.apply(SPECIES.length());
2082         float[] r = fr.apply(SPECIES.length());
2083 
2084         for (int i = 0; i < a.length; i += SPECIES.length()) {
2085             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2086             av.lanewise(VectorOperators.MAX, b[i]).intoArray(r, i);
2087         }
2088 
2089         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::MAX);
2090     }
2091 
2092     @Test(dataProvider = "floatBinaryOpProvider")
2093     static void maxFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2094         float[] a = fa.apply(SPECIES.length());
2095         float[] b = fb.apply(SPECIES.length());
2096         float[] r = fr.apply(SPECIES.length());
2097 
2098         for (int i = 0; i < a.length; i += SPECIES.length()) {
2099             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2100             av.max(b[i]).intoArray(r, i);
2101         }
2102 
2103         assertBroadcastArraysEquals(r, a, b, Float128VectorTests::max);
2104     }
2105 
2106 
2107 
2108 
2109 
2110 
2111 
2112 
2113 
2114 
2115 
2116 
2117     static float ADDReduce(float[] a, int idx) {
2118         float res = 0;
2119         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2120             res += a[i];
2121         }
2122 
2123         return res;
2124     }
2125 
2126     static float ADDReduceAll(float[] a) {
2127         float res = 0;
2128         for (int i = 0; i < a.length; i += SPECIES.length()) {
2129             res += ADDReduce(a, i);
2130         }
2131 
2132         return res;
2133     }
2134     @Test(dataProvider = "floatUnaryOpProvider")
2135     static void ADDReduceFloat128VectorTests(IntFunction<float[]> fa) {
2136         float[] a = fa.apply(SPECIES.length());
2137         float[] r = fr.apply(SPECIES.length());
2138         float ra = 0;
2139 
2140         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2141             for (int i = 0; i < a.length; i += SPECIES.length()) {
2142                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2143                 r[i] = av.reduceLanes(VectorOperators.ADD);
2144             }
2145         }
2146 
2147         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2148             ra = 0;
2149             for (int i = 0; i < a.length; i += SPECIES.length()) {
2150                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2151                 ra += av.reduceLanes(VectorOperators.ADD);
2152             }
2153         }
2154 
2155         assertReductionArraysEquals(r, ra, a,
2156                 Float128VectorTests::ADDReduce, Float128VectorTests::ADDReduceAll);
2157     }
2158     static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
2159         float res = 0;
2160         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2161             if (mask[i % SPECIES.length()])
2162                 res += a[i];
2163         }
2164 
2165         return res;
2166     }
2167 
2168     static float ADDReduceAllMasked(float[] a, boolean[] mask) {
2169         float res = 0;
2170         for (int i = 0; i < a.length; i += SPECIES.length()) {
2171             res += ADDReduceMasked(a, i, mask);
2172         }
2173 
2174         return res;
2175     }
2176     @Test(dataProvider = "floatUnaryOpMaskProvider")
2177     static void ADDReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2178         float[] a = fa.apply(SPECIES.length());
2179         float[] r = fr.apply(SPECIES.length());
2180         boolean[] mask = fm.apply(SPECIES.length());
2181         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2182         float ra = 0;
2183 
2184         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2185             for (int i = 0; i < a.length; i += SPECIES.length()) {
2186                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2187                 r[i] = av.reduceLanes(VectorOperators.ADD, vmask);
2188             }
2189         }
2190 
2191         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2192             ra = 0;
2193             for (int i = 0; i < a.length; i += SPECIES.length()) {
2194                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2195                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
2196             }
2197         }
2198 
2199         assertReductionArraysEqualsMasked(r, ra, a, mask,
2200                 Float128VectorTests::ADDReduceMasked, Float128VectorTests::ADDReduceAllMasked);
2201     }
2202     static float MULReduce(float[] a, int idx) {
2203         float res = 1;
2204         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2205             res *= a[i];
2206         }
2207 
2208         return res;
2209     }
2210 
2211     static float MULReduceAll(float[] a) {
2212         float res = 1;
2213         for (int i = 0; i < a.length; i += SPECIES.length()) {
2214             res *= MULReduce(a, i);
2215         }
2216 
2217         return res;
2218     }
2219     @Test(dataProvider = "floatUnaryOpProvider")
2220     static void MULReduceFloat128VectorTests(IntFunction<float[]> fa) {
2221         float[] a = fa.apply(SPECIES.length());
2222         float[] r = fr.apply(SPECIES.length());
2223         float ra = 1;
2224 
2225         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2226             for (int i = 0; i < a.length; i += SPECIES.length()) {
2227                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2228                 r[i] = av.reduceLanes(VectorOperators.MUL);
2229             }
2230         }
2231 
2232         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2233             ra = 1;
2234             for (int i = 0; i < a.length; i += SPECIES.length()) {
2235                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2236                 ra *= av.reduceLanes(VectorOperators.MUL);
2237             }
2238         }
2239 
2240         assertReductionArraysEquals(r, ra, a,
2241                 Float128VectorTests::MULReduce, Float128VectorTests::MULReduceAll);
2242     }
2243     static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
2244         float res = 1;
2245         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2246             if (mask[i % SPECIES.length()])
2247                 res *= a[i];
2248         }
2249 
2250         return res;
2251     }
2252 
2253     static float MULReduceAllMasked(float[] a, boolean[] mask) {
2254         float res = 1;
2255         for (int i = 0; i < a.length; i += SPECIES.length()) {
2256             res *= MULReduceMasked(a, i, mask);
2257         }
2258 
2259         return res;
2260     }
2261     @Test(dataProvider = "floatUnaryOpMaskProvider")
2262     static void MULReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2263         float[] a = fa.apply(SPECIES.length());
2264         float[] r = fr.apply(SPECIES.length());
2265         boolean[] mask = fm.apply(SPECIES.length());
2266         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2267         float ra = 1;
2268 
2269         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2270             for (int i = 0; i < a.length; i += SPECIES.length()) {
2271                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2272                 r[i] = av.reduceLanes(VectorOperators.MUL, vmask);
2273             }
2274         }
2275 
2276         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2277             ra = 1;
2278             for (int i = 0; i < a.length; i += SPECIES.length()) {
2279                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2280                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
2281             }
2282         }
2283 
2284         assertReductionArraysEqualsMasked(r, ra, a, mask,
2285                 Float128VectorTests::MULReduceMasked, Float128VectorTests::MULReduceAllMasked);
2286     }
2287     static float MINReduce(float[] a, int idx) {
2288         float res = Float.POSITIVE_INFINITY;
2289         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2290             res = (float)Math.min(res, a[i]);
2291         }
2292 
2293         return res;
2294     }
2295 
2296     static float MINReduceAll(float[] a) {
2297         float res = Float.POSITIVE_INFINITY;
2298         for (int i = 0; i < a.length; i++) {
2299             res = (float)Math.min(res, a[i]);
2300         }
2301 
2302         return res;
2303     }
2304     @Test(dataProvider = "floatUnaryOpProvider")
2305     static void MINReduceFloat128VectorTests(IntFunction<float[]> fa) {
2306         float[] a = fa.apply(SPECIES.length());
2307         float[] r = fr.apply(SPECIES.length());
2308         float ra = Float.POSITIVE_INFINITY;
2309 
2310         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2311             for (int i = 0; i < a.length; i += SPECIES.length()) {
2312                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2313                 r[i] = av.reduceLanes(VectorOperators.MIN);
2314             }
2315         }
2316 
2317         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2318             ra = Float.POSITIVE_INFINITY;
2319             for (int i = 0; i < a.length; i += SPECIES.length()) {
2320                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2321                 ra = (float)Math.min(ra, av.reduceLanes(VectorOperators.MIN));
2322             }
2323         }
2324 
2325         assertReductionArraysEquals(r, ra, a,
2326                 Float128VectorTests::MINReduce, Float128VectorTests::MINReduceAll);
2327     }
2328     static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
2329         float res = Float.POSITIVE_INFINITY;
2330         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2331             if(mask[i % SPECIES.length()])
2332                 res = (float)Math.min(res, a[i]);
2333         }
2334 
2335         return res;
2336     }
2337 
2338     static float MINReduceAllMasked(float[] a, boolean[] mask) {
2339         float res = Float.POSITIVE_INFINITY;
2340         for (int i = 0; i < a.length; i++) {
2341             if(mask[i % SPECIES.length()])
2342                 res = (float)Math.min(res, a[i]);
2343         }
2344 
2345         return res;
2346     }
2347     @Test(dataProvider = "floatUnaryOpMaskProvider")
2348     static void MINReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2349         float[] a = fa.apply(SPECIES.length());
2350         float[] r = fr.apply(SPECIES.length());
2351         boolean[] mask = fm.apply(SPECIES.length());
2352         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2353         float ra = Float.POSITIVE_INFINITY;
2354 
2355         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2356             for (int i = 0; i < a.length; i += SPECIES.length()) {
2357                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2358                 r[i] = av.reduceLanes(VectorOperators.MIN, vmask);
2359             }
2360         }
2361 
2362         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2363             ra = Float.POSITIVE_INFINITY;
2364             for (int i = 0; i < a.length; i += SPECIES.length()) {
2365                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2366                 ra = (float)Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
2367             }
2368         }
2369 
2370         assertReductionArraysEqualsMasked(r, ra, a, mask,
2371                 Float128VectorTests::MINReduceMasked, Float128VectorTests::MINReduceAllMasked);
2372     }
2373     static float MAXReduce(float[] a, int idx) {
2374         float res = Float.NEGATIVE_INFINITY;
2375         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2376             res = (float)Math.max(res, a[i]);
2377         }
2378 
2379         return res;
2380     }
2381 
2382     static float MAXReduceAll(float[] a) {
2383         float res = Float.NEGATIVE_INFINITY;
2384         for (int i = 0; i < a.length; i++) {
2385             res = (float)Math.max(res, a[i]);
2386         }
2387 
2388         return res;
2389     }
2390     @Test(dataProvider = "floatUnaryOpProvider")
2391     static void MAXReduceFloat128VectorTests(IntFunction<float[]> fa) {
2392         float[] a = fa.apply(SPECIES.length());
2393         float[] r = fr.apply(SPECIES.length());
2394         float ra = Float.NEGATIVE_INFINITY;
2395 
2396         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2397             for (int i = 0; i < a.length; i += SPECIES.length()) {
2398                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2399                 r[i] = av.reduceLanes(VectorOperators.MAX);
2400             }
2401         }
2402 
2403         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2404             ra = Float.NEGATIVE_INFINITY;
2405             for (int i = 0; i < a.length; i += SPECIES.length()) {
2406                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2407                 ra = (float)Math.max(ra, av.reduceLanes(VectorOperators.MAX));
2408             }
2409         }
2410 
2411         assertReductionArraysEquals(r, ra, a,
2412                 Float128VectorTests::MAXReduce, Float128VectorTests::MAXReduceAll);
2413     }
2414     static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
2415         float res = Float.NEGATIVE_INFINITY;
2416         for (int i = idx; i < (idx + SPECIES.length()); i++) {
2417             if(mask[i % SPECIES.length()])
2418                 res = (float)Math.max(res, a[i]);
2419         }
2420 
2421         return res;
2422     }
2423 
2424     static float MAXReduceAllMasked(float[] a, boolean[] mask) {
2425         float res = Float.NEGATIVE_INFINITY;
2426         for (int i = 0; i < a.length; i++) {
2427             if(mask[i % SPECIES.length()])
2428                 res = (float)Math.max(res, a[i]);
2429         }
2430 
2431         return res;
2432     }
2433     @Test(dataProvider = "floatUnaryOpMaskProvider")
2434     static void MAXReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
2435         float[] a = fa.apply(SPECIES.length());
2436         float[] r = fr.apply(SPECIES.length());
2437         boolean[] mask = fm.apply(SPECIES.length());
2438         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2439         float ra = Float.NEGATIVE_INFINITY;
2440 
2441         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2442             for (int i = 0; i < a.length; i += SPECIES.length()) {
2443                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2444                 r[i] = av.reduceLanes(VectorOperators.MAX, vmask);
2445             }
2446         }
2447 
2448         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2449             ra = Float.NEGATIVE_INFINITY;
2450             for (int i = 0; i < a.length; i += SPECIES.length()) {
2451                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2452                 ra = (float)Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
2453             }
2454         }
2455 
2456         assertReductionArraysEqualsMasked(r, ra, a, mask,
2457                 Float128VectorTests::MAXReduceMasked, Float128VectorTests::MAXReduceAllMasked);
2458     }
2459 
2460 
2461 
2462 
2463 
2464     @Test(dataProvider = "floatUnaryOpProvider")
2465     static void withFloat128VectorTests(IntFunction<float []> fa) {
2466         float[] a = fa.apply(SPECIES.length());
2467         float[] r = fr.apply(SPECIES.length());
2468 
2469         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2470             for (int i = 0; i < a.length; i += SPECIES.length()) {
2471                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2472                 av.withLane(0, (float)4).intoArray(r, i);
2473             }
2474         }
2475 
2476         assertInsertArraysEquals(r, a, (float)4, 0);
2477     }
2478     static boolean testIS_DEFAULT(float a) {
2479         return bits(a)==0;
2480     }
2481 
2482     @Test(dataProvider = "floatTestOpProvider")
2483     static void IS_DEFAULTFloat128VectorTests(IntFunction<float[]> fa) {
2484         float[] a = fa.apply(SPECIES.length());
2485 
2486         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2487             for (int i = 0; i < a.length; i += SPECIES.length()) {
2488                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2489                 VectorMask<Float> mv = av.test(VectorOperators.IS_DEFAULT);
2490 
2491                 // Check results as part of computation.
2492                 for (int j = 0; j < SPECIES.length(); j++) {
2493                     Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j]));
2494                 }
2495             }
2496         }
2497     }
2498 
2499     @Test(dataProvider = "floatTestOpMaskProvider")
2500     static void IS_DEFAULTMaskedFloat128VectorTestsSmokeTest(IntFunction<float[]> fa,
2501                                           IntFunction<boolean[]> fm) {
2502         float[] a = fa.apply(SPECIES.length());
2503         boolean[] mask = fm.apply(SPECIES.length());
2504         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2505 
2506         for (int i = 0; i < a.length; i += SPECIES.length()) {
2507             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2508             VectorMask<Float> mv = av.test(VectorOperators.IS_DEFAULT, vmask);
2509 
2510             // Check results as part of computation.
2511             for (int j = 0; j < SPECIES.length(); j++) {
2512                 Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
2513             }
2514         }
2515     }
2516     static boolean testIS_NEGATIVE(float a) {
2517         return bits(a)<0;
2518     }
2519 
2520     @Test(dataProvider = "floatTestOpProvider")
2521     static void IS_NEGATIVEFloat128VectorTests(IntFunction<float[]> fa) {
2522         float[] a = fa.apply(SPECIES.length());
2523 
2524         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2525             for (int i = 0; i < a.length; i += SPECIES.length()) {
2526                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2527                 VectorMask<Float> mv = av.test(VectorOperators.IS_NEGATIVE);
2528 
2529                 // Check results as part of computation.
2530                 for (int j = 0; j < SPECIES.length(); j++) {
2531                     Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j]));
2532                 }
2533             }
2534         }
2535     }
2536 
2537     @Test(dataProvider = "floatTestOpMaskProvider")
2538     static void IS_NEGATIVEMaskedFloat128VectorTestsSmokeTest(IntFunction<float[]> fa,
2539                                           IntFunction<boolean[]> fm) {
2540         float[] a = fa.apply(SPECIES.length());
2541         boolean[] mask = fm.apply(SPECIES.length());
2542         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2543 
2544         for (int i = 0; i < a.length; i += SPECIES.length()) {
2545             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2546             VectorMask<Float> mv = av.test(VectorOperators.IS_NEGATIVE, vmask);
2547 
2548             // Check results as part of computation.
2549             for (int j = 0; j < SPECIES.length(); j++) {
2550                 Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j]));
2551             }
2552         }
2553     }
2554 
2555     static boolean testIS_FINITE(float a) {
2556         return Float.isFinite(a);
2557     }
2558 
2559     @Test(dataProvider = "floatTestOpProvider")
2560     static void IS_FINITEFloat128VectorTests(IntFunction<float[]> fa) {
2561         float[] a = fa.apply(SPECIES.length());
2562 
2563         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2564             for (int i = 0; i < a.length; i += SPECIES.length()) {
2565                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2566                 VectorMask<Float> mv = av.test(VectorOperators.IS_FINITE);
2567 
2568                 // Check results as part of computation.
2569                 for (int j = 0; j < SPECIES.length(); j++) {
2570                     Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j]));
2571                 }
2572             }
2573         }
2574     }
2575 
2576     @Test(dataProvider = "floatTestOpMaskProvider")
2577     static void IS_FINITEMaskedFloat128VectorTestsSmokeTest(IntFunction<float[]> fa,
2578                                           IntFunction<boolean[]> fm) {
2579         float[] a = fa.apply(SPECIES.length());
2580         boolean[] mask = fm.apply(SPECIES.length());
2581         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2582 
2583         for (int i = 0; i < a.length; i += SPECIES.length()) {
2584             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2585             VectorMask<Float> mv = av.test(VectorOperators.IS_FINITE, vmask);
2586 
2587             // Check results as part of computation.
2588             for (int j = 0; j < SPECIES.length(); j++) {
2589                 Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_FINITE(a[i + j]));
2590             }
2591         }
2592     }
2593 
2594 
2595     static boolean testIS_NAN(float a) {
2596         return Float.isNaN(a);
2597     }
2598 
2599     @Test(dataProvider = "floatTestOpProvider")
2600     static void IS_NANFloat128VectorTests(IntFunction<float[]> fa) {
2601         float[] a = fa.apply(SPECIES.length());
2602 
2603         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2604             for (int i = 0; i < a.length; i += SPECIES.length()) {
2605                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2606                 VectorMask<Float> mv = av.test(VectorOperators.IS_NAN);
2607 
2608                 // Check results as part of computation.
2609                 for (int j = 0; j < SPECIES.length(); j++) {
2610                     Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j]));
2611                 }
2612             }
2613         }
2614     }
2615 
2616     @Test(dataProvider = "floatTestOpMaskProvider")
2617     static void IS_NANMaskedFloat128VectorTestsSmokeTest(IntFunction<float[]> fa,
2618                                           IntFunction<boolean[]> fm) {
2619         float[] a = fa.apply(SPECIES.length());
2620         boolean[] mask = fm.apply(SPECIES.length());
2621         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2622 
2623         for (int i = 0; i < a.length; i += SPECIES.length()) {
2624             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2625             VectorMask<Float> mv = av.test(VectorOperators.IS_NAN, vmask);
2626 
2627             // Check results as part of computation.
2628             for (int j = 0; j < SPECIES.length(); j++) {
2629                 Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_NAN(a[i + j]));
2630             }
2631         }
2632     }
2633 
2634 
2635     static boolean testIS_INFINITE(float a) {
2636         return Float.isInfinite(a);
2637     }
2638 
2639     @Test(dataProvider = "floatTestOpProvider")
2640     static void IS_INFINITEFloat128VectorTests(IntFunction<float[]> fa) {
2641         float[] a = fa.apply(SPECIES.length());
2642 
2643         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2644             for (int i = 0; i < a.length; i += SPECIES.length()) {
2645                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2646                 VectorMask<Float> mv = av.test(VectorOperators.IS_INFINITE);
2647 
2648                 // Check results as part of computation.
2649                 for (int j = 0; j < SPECIES.length(); j++) {
2650                     Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j]));
2651                 }
2652             }
2653         }
2654     }
2655 
2656     @Test(dataProvider = "floatTestOpMaskProvider")
2657     static void IS_INFINITEMaskedFloat128VectorTestsSmokeTest(IntFunction<float[]> fa,
2658                                           IntFunction<boolean[]> fm) {
2659         float[] a = fa.apply(SPECIES.length());
2660         boolean[] mask = fm.apply(SPECIES.length());
2661         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2662 
2663         for (int i = 0; i < a.length; i += SPECIES.length()) {
2664             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2665             VectorMask<Float> mv = av.test(VectorOperators.IS_INFINITE, vmask);
2666 
2667             // Check results as part of computation.
2668             for (int j = 0; j < SPECIES.length(); j++) {
2669                 Assert.assertEquals(mv.laneIsSet(j),  vmask.laneIsSet(j) && testIS_INFINITE(a[i + j]));
2670             }
2671         }
2672     }
2673 
2674 
2675     @Test(dataProvider = "floatCompareOpProvider")
2676     static void LTFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2677         float[] a = fa.apply(SPECIES.length());
2678         float[] b = fb.apply(SPECIES.length());
2679 
2680         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2681             for (int i = 0; i < a.length; i += SPECIES.length()) {
2682                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2683                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2684                 VectorMask<Float> mv = av.compare(VectorOperators.LT, bv);
2685 
2686                 // Check results as part of computation.
2687                 for (int j = 0; j < SPECIES.length(); j++) {
2688                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
2689                 }
2690             }
2691         }
2692     }
2693 
2694 
2695     @Test(dataProvider = "floatCompareOpProvider")
2696     static void ltFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2697         float[] a = fa.apply(SPECIES.length());
2698         float[] b = fb.apply(SPECIES.length());
2699 
2700         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2701             for (int i = 0; i < a.length; i += SPECIES.length()) {
2702                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2703                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2704                 VectorMask<Float> mv = av.lt(bv);
2705 
2706                 // Check results as part of computation.
2707                 for (int j = 0; j < SPECIES.length(); j++) {
2708                     Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j]));
2709                 }
2710             }
2711         }
2712     }
2713 
2714     @Test(dataProvider = "floatCompareOpMaskProvider")
2715     static void LTFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
2716                                                 IntFunction<boolean[]> fm) {
2717         float[] a = fa.apply(SPECIES.length());
2718         float[] b = fb.apply(SPECIES.length());
2719         boolean[] mask = fm.apply(SPECIES.length());
2720 
2721         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2722 
2723         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2724             for (int i = 0; i < a.length; i += SPECIES.length()) {
2725                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2726                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2727                 VectorMask<Float> mv = av.compare(VectorOperators.LT, bv, vmask);
2728 
2729                 // Check results as part of computation.
2730                 for (int j = 0; j < SPECIES.length(); j++) {
2731                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j]));
2732                 }
2733             }
2734         }
2735     }
2736 
2737 
2738     @Test(dataProvider = "floatCompareOpProvider")
2739     static void GTFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2740         float[] a = fa.apply(SPECIES.length());
2741         float[] b = fb.apply(SPECIES.length());
2742 
2743         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2744             for (int i = 0; i < a.length; i += SPECIES.length()) {
2745                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2746                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2747                 VectorMask<Float> mv = av.compare(VectorOperators.GT, bv);
2748 
2749                 // Check results as part of computation.
2750                 for (int j = 0; j < SPECIES.length(); j++) {
2751                     Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j]));
2752                 }
2753             }
2754         }
2755     }
2756 
2757     @Test(dataProvider = "floatCompareOpMaskProvider")
2758     static void GTFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
2759                                                 IntFunction<boolean[]> fm) {
2760         float[] a = fa.apply(SPECIES.length());
2761         float[] b = fb.apply(SPECIES.length());
2762         boolean[] mask = fm.apply(SPECIES.length());
2763 
2764         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2765 
2766         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2767             for (int i = 0; i < a.length; i += SPECIES.length()) {
2768                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2769                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2770                 VectorMask<Float> mv = av.compare(VectorOperators.GT, bv, vmask);
2771 
2772                 // Check results as part of computation.
2773                 for (int j = 0; j < SPECIES.length(); j++) {
2774                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j]));
2775                 }
2776             }
2777         }
2778     }
2779 
2780 
2781     @Test(dataProvider = "floatCompareOpProvider")
2782     static void EQFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2783         float[] a = fa.apply(SPECIES.length());
2784         float[] b = fb.apply(SPECIES.length());
2785 
2786         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2787             for (int i = 0; i < a.length; i += SPECIES.length()) {
2788                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2789                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2790                 VectorMask<Float> mv = av.compare(VectorOperators.EQ, bv);
2791 
2792                 // Check results as part of computation.
2793                 for (int j = 0; j < SPECIES.length(); j++) {
2794                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
2795                 }
2796             }
2797         }
2798     }
2799 
2800 
2801     @Test(dataProvider = "floatCompareOpProvider")
2802     static void eqFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2803         float[] a = fa.apply(SPECIES.length());
2804         float[] b = fb.apply(SPECIES.length());
2805 
2806         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2807             for (int i = 0; i < a.length; i += SPECIES.length()) {
2808                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2809                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2810                 VectorMask<Float> mv = av.eq(bv);
2811 
2812                 // Check results as part of computation.
2813                 for (int j = 0; j < SPECIES.length(); j++) {
2814                     Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j]));
2815                 }
2816             }
2817         }
2818     }
2819 
2820     @Test(dataProvider = "floatCompareOpMaskProvider")
2821     static void EQFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
2822                                                 IntFunction<boolean[]> fm) {
2823         float[] a = fa.apply(SPECIES.length());
2824         float[] b = fb.apply(SPECIES.length());
2825         boolean[] mask = fm.apply(SPECIES.length());
2826 
2827         VectorMask<Float> 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                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2832                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2833                 VectorMask<Float> mv = av.compare(VectorOperators.EQ, bv, vmask);
2834 
2835                 // Check results as part of computation.
2836                 for (int j = 0; j < SPECIES.length(); j++) {
2837                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j]));
2838                 }
2839             }
2840         }
2841     }
2842 
2843 
2844     @Test(dataProvider = "floatCompareOpProvider")
2845     static void NEFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2846         float[] a = fa.apply(SPECIES.length());
2847         float[] b = fb.apply(SPECIES.length());
2848 
2849         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2850             for (int i = 0; i < a.length; i += SPECIES.length()) {
2851                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2852                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2853                 VectorMask<Float> mv = av.compare(VectorOperators.NE, bv);
2854 
2855                 // Check results as part of computation.
2856                 for (int j = 0; j < SPECIES.length(); j++) {
2857                     Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j]));
2858                 }
2859             }
2860         }
2861     }
2862 
2863     @Test(dataProvider = "floatCompareOpMaskProvider")
2864     static void NEFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
2865                                                 IntFunction<boolean[]> fm) {
2866         float[] a = fa.apply(SPECIES.length());
2867         float[] b = fb.apply(SPECIES.length());
2868         boolean[] mask = fm.apply(SPECIES.length());
2869 
2870         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2871 
2872         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2873             for (int i = 0; i < a.length; i += SPECIES.length()) {
2874                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2875                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2876                 VectorMask<Float> mv = av.compare(VectorOperators.NE, bv, vmask);
2877 
2878                 // Check results as part of computation.
2879                 for (int j = 0; j < SPECIES.length(); j++) {
2880                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j]));
2881                 }
2882             }
2883         }
2884     }
2885 
2886 
2887     @Test(dataProvider = "floatCompareOpProvider")
2888     static void LEFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2889         float[] a = fa.apply(SPECIES.length());
2890         float[] b = fb.apply(SPECIES.length());
2891 
2892         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2893             for (int i = 0; i < a.length; i += SPECIES.length()) {
2894                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2895                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2896                 VectorMask<Float> mv = av.compare(VectorOperators.LE, bv);
2897 
2898                 // Check results as part of computation.
2899                 for (int j = 0; j < SPECIES.length(); j++) {
2900                     Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j]));
2901                 }
2902             }
2903         }
2904     }
2905 
2906     @Test(dataProvider = "floatCompareOpMaskProvider")
2907     static void LEFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
2908                                                 IntFunction<boolean[]> fm) {
2909         float[] a = fa.apply(SPECIES.length());
2910         float[] b = fb.apply(SPECIES.length());
2911         boolean[] mask = fm.apply(SPECIES.length());
2912 
2913         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2914 
2915         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2916             for (int i = 0; i < a.length; i += SPECIES.length()) {
2917                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2918                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2919                 VectorMask<Float> mv = av.compare(VectorOperators.LE, bv, vmask);
2920 
2921                 // Check results as part of computation.
2922                 for (int j = 0; j < SPECIES.length(); j++) {
2923                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j]));
2924                 }
2925             }
2926         }
2927     }
2928 
2929 
2930     @Test(dataProvider = "floatCompareOpProvider")
2931     static void GEFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2932         float[] a = fa.apply(SPECIES.length());
2933         float[] b = fb.apply(SPECIES.length());
2934 
2935         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2936             for (int i = 0; i < a.length; i += SPECIES.length()) {
2937                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2938                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2939                 VectorMask<Float> mv = av.compare(VectorOperators.GE, bv);
2940 
2941                 // Check results as part of computation.
2942                 for (int j = 0; j < SPECIES.length(); j++) {
2943                     Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j]));
2944                 }
2945             }
2946         }
2947     }
2948 
2949     @Test(dataProvider = "floatCompareOpMaskProvider")
2950     static void GEFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
2951                                                 IntFunction<boolean[]> fm) {
2952         float[] a = fa.apply(SPECIES.length());
2953         float[] b = fb.apply(SPECIES.length());
2954         boolean[] mask = fm.apply(SPECIES.length());
2955 
2956         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
2957 
2958         for (int ic = 0; ic < INVOC_COUNT; ic++) {
2959             for (int i = 0; i < a.length; i += SPECIES.length()) {
2960                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2961                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
2962                 VectorMask<Float> mv = av.compare(VectorOperators.GE, bv, vmask);
2963 
2964                 // Check results as part of computation.
2965                 for (int j = 0; j < SPECIES.length(); j++) {
2966                     Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j]));
2967                 }
2968             }
2969         }
2970     }
2971 
2972 
2973 
2974 
2975 
2976 
2977 
2978 
2979 
2980 
2981     @Test(dataProvider = "floatCompareOpProvider")
2982     static void LTFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
2983         float[] a = fa.apply(SPECIES.length());
2984         float[] b = fb.apply(SPECIES.length());
2985 
2986         for (int i = 0; i < a.length; i += SPECIES.length()) {
2987             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
2988             VectorMask<Float> mv = av.compare(VectorOperators.LT, b[i]);
2989 
2990             // Check results as part of computation.
2991             for (int j = 0; j < SPECIES.length(); j++) {
2992                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
2993             }
2994         }
2995     }
2996 
2997 
2998     @Test(dataProvider = "floatCompareOpMaskProvider")
2999     static void LTFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
3000                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3001         float[] a = fa.apply(SPECIES.length());
3002         float[] b = fb.apply(SPECIES.length());
3003         boolean[] mask = fm.apply(SPECIES.length());
3004 
3005         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3006 
3007         for (int i = 0; i < a.length; i += SPECIES.length()) {
3008             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3009             VectorMask<Float> mv = av.compare(VectorOperators.LT, b[i], vmask);
3010 
3011             // Check results as part of computation.
3012             for (int j = 0; j < SPECIES.length(); j++) {
3013                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i]));
3014             }
3015         }
3016     }
3017 
3018     @Test(dataProvider = "floatCompareOpProvider")
3019     static void LTFloat128VectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3020         float[] a = fa.apply(SPECIES.length());
3021         float[] b = fb.apply(SPECIES.length());
3022 
3023         for (int i = 0; i < a.length; i += SPECIES.length()) {
3024             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3025             VectorMask<Float> mv = av.compare(VectorOperators.LT, (long)b[i]);
3026 
3027             // Check results as part of computation.
3028             for (int j = 0; j < SPECIES.length(); j++) {
3029                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i]));
3030             }
3031         }
3032     }
3033 
3034 
3035     @Test(dataProvider = "floatCompareOpMaskProvider")
3036     static void LTFloat128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
3037                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3038         float[] a = fa.apply(SPECIES.length());
3039         float[] b = fb.apply(SPECIES.length());
3040         boolean[] mask = fm.apply(SPECIES.length());
3041 
3042         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3043 
3044         for (int i = 0; i < a.length; i += SPECIES.length()) {
3045             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3046             VectorMask<Float> mv = av.compare(VectorOperators.LT, (long)b[i], vmask);
3047 
3048             // Check results as part of computation.
3049             for (int j = 0; j < SPECIES.length(); j++) {
3050                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i])));
3051             }
3052         }
3053     }
3054 
3055     @Test(dataProvider = "floatCompareOpProvider")
3056     static void EQFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3057         float[] a = fa.apply(SPECIES.length());
3058         float[] b = fb.apply(SPECIES.length());
3059 
3060         for (int i = 0; i < a.length; i += SPECIES.length()) {
3061             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3062             VectorMask<Float> mv = av.compare(VectorOperators.EQ, b[i]);
3063 
3064             // Check results as part of computation.
3065             for (int j = 0; j < SPECIES.length(); j++) {
3066                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
3067             }
3068         }
3069     }
3070 
3071 
3072     @Test(dataProvider = "floatCompareOpMaskProvider")
3073     static void EQFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
3074                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3075         float[] a = fa.apply(SPECIES.length());
3076         float[] b = fb.apply(SPECIES.length());
3077         boolean[] mask = fm.apply(SPECIES.length());
3078 
3079         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3080 
3081         for (int i = 0; i < a.length; i += SPECIES.length()) {
3082             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3083             VectorMask<Float> mv = av.compare(VectorOperators.EQ, b[i], vmask);
3084 
3085             // Check results as part of computation.
3086             for (int j = 0; j < SPECIES.length(); j++) {
3087                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i]));
3088             }
3089         }
3090     }
3091 
3092     @Test(dataProvider = "floatCompareOpProvider")
3093     static void EQFloat128VectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3094         float[] a = fa.apply(SPECIES.length());
3095         float[] b = fb.apply(SPECIES.length());
3096 
3097         for (int i = 0; i < a.length; i += SPECIES.length()) {
3098             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3099             VectorMask<Float> mv = av.compare(VectorOperators.EQ, (long)b[i]);
3100 
3101             // Check results as part of computation.
3102             for (int j = 0; j < SPECIES.length(); j++) {
3103                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i]));
3104             }
3105         }
3106     }
3107 
3108 
3109     @Test(dataProvider = "floatCompareOpMaskProvider")
3110     static void EQFloat128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
3111                                 IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
3112         float[] a = fa.apply(SPECIES.length());
3113         float[] b = fb.apply(SPECIES.length());
3114         boolean[] mask = fm.apply(SPECIES.length());
3115 
3116         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3117 
3118         for (int i = 0; i < a.length; i += SPECIES.length()) {
3119             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3120             VectorMask<Float> mv = av.compare(VectorOperators.EQ, (long)b[i], vmask);
3121 
3122             // Check results as part of computation.
3123             for (int j = 0; j < SPECIES.length(); j++) {
3124                 Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i])));
3125             }
3126         }
3127     }
3128 
3129     static float blend(float a, float b, boolean mask) {
3130         return mask ? b : a;
3131     }
3132 
3133     @Test(dataProvider = "floatBinaryOpMaskProvider")
3134     static void blendFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb,
3135                                           IntFunction<boolean[]> fm) {
3136         float[] a = fa.apply(SPECIES.length());
3137         float[] b = fb.apply(SPECIES.length());
3138         float[] r = fr.apply(SPECIES.length());
3139         boolean[] mask = fm.apply(SPECIES.length());
3140         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3141 
3142         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3143             for (int i = 0; i < a.length; i += SPECIES.length()) {
3144                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3145                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3146                 av.blend(bv, vmask).intoArray(r, i);
3147             }
3148         }
3149 
3150         assertArraysEquals(r, a, b, mask, Float128VectorTests::blend);
3151     }
3152 
3153     @Test(dataProvider = "floatUnaryOpShuffleProvider")
3154     static void RearrangeFloat128VectorTests(IntFunction<float[]> fa,
3155                                            BiFunction<Integer,Integer,int[]> fs) {
3156         float[] a = fa.apply(SPECIES.length());
3157         int[] order = fs.apply(a.length, SPECIES.length());
3158         float[] r = fr.apply(SPECIES.length());
3159 
3160         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3161             for (int i = 0; i < a.length; i += SPECIES.length()) {
3162                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3163                 av.rearrange(VectorShuffle.fromArray(SPECIES, order, i)).intoArray(r, i);
3164             }
3165         }
3166 
3167         assertRearrangeArraysEquals(r, a, order, SPECIES.length());
3168     }
3169 
3170     @Test(dataProvider = "floatUnaryOpShuffleMaskProvider")
3171     static void RearrangeFloat128VectorTestsMaskedSmokeTest(IntFunction<float[]> fa,
3172                                                           BiFunction<Integer,Integer,int[]> fs,
3173                                                           IntFunction<boolean[]> fm) {
3174         float[] a = fa.apply(SPECIES.length());
3175         int[] order = fs.apply(a.length, SPECIES.length());
3176         float[] r = fr.apply(SPECIES.length());
3177         boolean[] mask = fm.apply(SPECIES.length());
3178         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3179 
3180         for (int i = 0; i < a.length; i += SPECIES.length()) {
3181             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3182             av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
3183         }
3184 
3185         assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
3186     }
3187     @Test(dataProvider = "floatUnaryOpProvider")
3188     static void getFloat128VectorTests(IntFunction<float[]> fa) {
3189         float[] a = fa.apply(SPECIES.length());
3190         float[] r = fr.apply(SPECIES.length());
3191 
3192         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3193             for (int i = 0; i < a.length; i += SPECIES.length()) {
3194                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3195                 int num_lanes = SPECIES.length();
3196                 // Manually unroll because full unroll happens after intrinsification.
3197                 // Unroll is needed because get intrinsic requires for index to be a known constant.
3198                 if (num_lanes == 1) {
3199                     r[i]=av.lane(0);
3200                 } else if (num_lanes == 2) {
3201                     r[i]=av.lane(0);
3202                     r[i+1]=av.lane(1);
3203                 } else if (num_lanes == 4) {
3204                     r[i]=av.lane(0);
3205                     r[i+1]=av.lane(1);
3206                     r[i+2]=av.lane(2);
3207                     r[i+3]=av.lane(3);
3208                 } else if (num_lanes == 8) {
3209                     r[i]=av.lane(0);
3210                     r[i+1]=av.lane(1);
3211                     r[i+2]=av.lane(2);
3212                     r[i+3]=av.lane(3);
3213                     r[i+4]=av.lane(4);
3214                     r[i+5]=av.lane(5);
3215                     r[i+6]=av.lane(6);
3216                     r[i+7]=av.lane(7);
3217                 } else if (num_lanes == 16) {
3218                     r[i]=av.lane(0);
3219                     r[i+1]=av.lane(1);
3220                     r[i+2]=av.lane(2);
3221                     r[i+3]=av.lane(3);
3222                     r[i+4]=av.lane(4);
3223                     r[i+5]=av.lane(5);
3224                     r[i+6]=av.lane(6);
3225                     r[i+7]=av.lane(7);
3226                     r[i+8]=av.lane(8);
3227                     r[i+9]=av.lane(9);
3228                     r[i+10]=av.lane(10);
3229                     r[i+11]=av.lane(11);
3230                     r[i+12]=av.lane(12);
3231                     r[i+13]=av.lane(13);
3232                     r[i+14]=av.lane(14);
3233                     r[i+15]=av.lane(15);
3234                 } else if (num_lanes == 32) {
3235                     r[i]=av.lane(0);
3236                     r[i+1]=av.lane(1);
3237                     r[i+2]=av.lane(2);
3238                     r[i+3]=av.lane(3);
3239                     r[i+4]=av.lane(4);
3240                     r[i+5]=av.lane(5);
3241                     r[i+6]=av.lane(6);
3242                     r[i+7]=av.lane(7);
3243                     r[i+8]=av.lane(8);
3244                     r[i+9]=av.lane(9);
3245                     r[i+10]=av.lane(10);
3246                     r[i+11]=av.lane(11);
3247                     r[i+12]=av.lane(12);
3248                     r[i+13]=av.lane(13);
3249                     r[i+14]=av.lane(14);
3250                     r[i+15]=av.lane(15);
3251                     r[i+16]=av.lane(16);
3252                     r[i+17]=av.lane(17);
3253                     r[i+18]=av.lane(18);
3254                     r[i+19]=av.lane(19);
3255                     r[i+20]=av.lane(20);
3256                     r[i+21]=av.lane(21);
3257                     r[i+22]=av.lane(22);
3258                     r[i+23]=av.lane(23);
3259                     r[i+24]=av.lane(24);
3260                     r[i+25]=av.lane(25);
3261                     r[i+26]=av.lane(26);
3262                     r[i+27]=av.lane(27);
3263                     r[i+28]=av.lane(28);
3264                     r[i+29]=av.lane(29);
3265                     r[i+30]=av.lane(30);
3266                     r[i+31]=av.lane(31);
3267                 } else if (num_lanes == 64) {
3268                     r[i]=av.lane(0);
3269                     r[i+1]=av.lane(1);
3270                     r[i+2]=av.lane(2);
3271                     r[i+3]=av.lane(3);
3272                     r[i+4]=av.lane(4);
3273                     r[i+5]=av.lane(5);
3274                     r[i+6]=av.lane(6);
3275                     r[i+7]=av.lane(7);
3276                     r[i+8]=av.lane(8);
3277                     r[i+9]=av.lane(9);
3278                     r[i+10]=av.lane(10);
3279                     r[i+11]=av.lane(11);
3280                     r[i+12]=av.lane(12);
3281                     r[i+13]=av.lane(13);
3282                     r[i+14]=av.lane(14);
3283                     r[i+15]=av.lane(15);
3284                     r[i+16]=av.lane(16);
3285                     r[i+17]=av.lane(17);
3286                     r[i+18]=av.lane(18);
3287                     r[i+19]=av.lane(19);
3288                     r[i+20]=av.lane(20);
3289                     r[i+21]=av.lane(21);
3290                     r[i+22]=av.lane(22);
3291                     r[i+23]=av.lane(23);
3292                     r[i+24]=av.lane(24);
3293                     r[i+25]=av.lane(25);
3294                     r[i+26]=av.lane(26);
3295                     r[i+27]=av.lane(27);
3296                     r[i+28]=av.lane(28);
3297                     r[i+29]=av.lane(29);
3298                     r[i+30]=av.lane(30);
3299                     r[i+31]=av.lane(31);
3300                     r[i+32]=av.lane(32);
3301                     r[i+33]=av.lane(33);
3302                     r[i+34]=av.lane(34);
3303                     r[i+35]=av.lane(35);
3304                     r[i+36]=av.lane(36);
3305                     r[i+37]=av.lane(37);
3306                     r[i+38]=av.lane(38);
3307                     r[i+39]=av.lane(39);
3308                     r[i+40]=av.lane(40);
3309                     r[i+41]=av.lane(41);
3310                     r[i+42]=av.lane(42);
3311                     r[i+43]=av.lane(43);
3312                     r[i+44]=av.lane(44);
3313                     r[i+45]=av.lane(45);
3314                     r[i+46]=av.lane(46);
3315                     r[i+47]=av.lane(47);
3316                     r[i+48]=av.lane(48);
3317                     r[i+49]=av.lane(49);
3318                     r[i+50]=av.lane(50);
3319                     r[i+51]=av.lane(51);
3320                     r[i+52]=av.lane(52);
3321                     r[i+53]=av.lane(53);
3322                     r[i+54]=av.lane(54);
3323                     r[i+55]=av.lane(55);
3324                     r[i+56]=av.lane(56);
3325                     r[i+57]=av.lane(57);
3326                     r[i+58]=av.lane(58);
3327                     r[i+59]=av.lane(59);
3328                     r[i+60]=av.lane(60);
3329                     r[i+61]=av.lane(61);
3330                     r[i+62]=av.lane(62);
3331                     r[i+63]=av.lane(63);
3332                 } else {
3333                     for (int j = 0; j < SPECIES.length(); j++) {
3334                         r[i+j]=av.lane(j);
3335                     }
3336                 }
3337             }
3338         }
3339 
3340         assertArraysEquals(r, a, Float128VectorTests::get);
3341     }
3342 
3343     @Test(dataProvider = "floatUnaryOpProvider")
3344     static void BroadcastFloat128VectorTests(IntFunction<float[]> fa) {
3345         float[] a = fa.apply(SPECIES.length());
3346         float[] r = new float[a.length];
3347 
3348         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3349             for (int i = 0; i < a.length; i += SPECIES.length()) {
3350                 FloatVector.broadcast(SPECIES, a[i]).intoArray(r, i);
3351             }
3352         }
3353 
3354         assertBroadcastArraysEquals(r, a);
3355     }
3356 
3357 
3358 
3359 
3360 
3361     @Test(dataProvider = "floatUnaryOpProvider")
3362     static void ZeroFloat128VectorTests(IntFunction<float[]> fa) {
3363         float[] a = fa.apply(SPECIES.length());
3364         float[] r = new float[a.length];
3365 
3366         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3367             for (int i = 0; i < a.length; i += SPECIES.length()) {
3368                 FloatVector.zero(SPECIES).intoArray(a, i);
3369             }
3370         }
3371 
3372         Assert.assertEquals(a, r);
3373     }
3374 
3375 
3376 
3377 
3378     static float[] sliceUnary(float[] a, int origin, int idx) {
3379         float[] res = new float[SPECIES.length()];
3380         for (int i = 0; i < SPECIES.length(); i++){
3381             if(i+origin < SPECIES.length())
3382                 res[i] = a[idx+i+origin];
3383             else
3384                 res[i] = (float)0;
3385         }
3386         return res;
3387     }
3388 
3389     @Test(dataProvider = "floatUnaryOpProvider")
3390     static void sliceUnaryFloat128VectorTests(IntFunction<float[]> fa) {
3391         float[] a = fa.apply(SPECIES.length());
3392         float[] r = new float[a.length];
3393         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3394         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3395             for (int i = 0; i < a.length; i += SPECIES.length()) {
3396                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3397                 av.slice(origin).intoArray(r, i);
3398             }
3399         }
3400 
3401         assertArraysEquals(r, a, origin, Float128VectorTests::sliceUnary);
3402     }
3403     static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
3404         float[] res = new float[SPECIES.length()];
3405         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3406             if(i+origin < SPECIES.length())
3407                 res[i] = a[idx+i+origin];
3408             else {
3409                 res[i] = b[idx+j];
3410                 j++;
3411             }
3412         }
3413         return res;
3414     }
3415 
3416     @Test(dataProvider = "floatBinaryOpProvider")
3417     static void sliceBinaryFloat128VectorTestsBinary(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3418         float[] a = fa.apply(SPECIES.length());
3419         float[] b = fb.apply(SPECIES.length());
3420         float[] r = new float[a.length];
3421         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3422         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3423             for (int i = 0; i < a.length; i += SPECIES.length()) {
3424                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3425                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3426                 av.slice(origin, bv).intoArray(r, i);
3427             }
3428         }
3429 
3430         assertArraysEquals(r, a, b, origin, Float128VectorTests::sliceBinary);
3431     }
3432     static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
3433         float[] res = new float[SPECIES.length()];
3434         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3435             if(i+origin < SPECIES.length())
3436                 res[i] = mask[i] ? a[idx+i+origin] : (float)0;
3437             else {
3438                 res[i] = mask[i] ? b[idx+j] : (float)0;
3439                 j++;
3440             }
3441         }
3442         return res;
3443     }
3444 
3445     @Test(dataProvider = "floatBinaryOpMaskProvider")
3446     static void sliceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
3447     IntFunction<boolean[]> fm) {
3448         float[] a = fa.apply(SPECIES.length());
3449         float[] b = fb.apply(SPECIES.length());
3450         boolean[] mask = fm.apply(SPECIES.length());
3451         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3452 
3453         float[] r = new float[a.length];
3454         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3455         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3456             for (int i = 0; i < a.length; i += SPECIES.length()) {
3457                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3458                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3459                 av.slice(origin, bv, vmask).intoArray(r, i);
3460             }
3461         }
3462 
3463         assertArraysEquals(r, a, b, origin, mask, Float128VectorTests::slice);
3464     }
3465     static float[] unsliceUnary(float[] a, int origin, int idx) {
3466         float[] res = new float[SPECIES.length()];
3467         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3468             if(i < origin)
3469                 res[i] = (float)0;
3470             else {
3471                 res[i] = a[idx+j];
3472                 j++;
3473             }
3474         }
3475         return res;
3476     }
3477 
3478     @Test(dataProvider = "floatUnaryOpProvider")
3479     static void unsliceUnaryFloat128VectorTests(IntFunction<float[]> fa) {
3480         float[] a = fa.apply(SPECIES.length());
3481         float[] r = new float[a.length];
3482         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3483         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3484             for (int i = 0; i < a.length; i += SPECIES.length()) {
3485                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3486                 av.unslice(origin).intoArray(r, i);
3487             }
3488         }
3489 
3490         assertArraysEquals(r, a, origin, Float128VectorTests::unsliceUnary);
3491     }
3492     static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
3493         float[] res = new float[SPECIES.length()];
3494         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3495             if (part == 0) {
3496                 if (i < origin)
3497                     res[i] = b[idx+i];
3498                 else {
3499                     res[i] = a[idx+j];
3500                     j++;
3501                 }
3502             } else if (part == 1) {
3503                 if (i < origin)
3504                     res[i] = a[idx+SPECIES.length()-origin+i];
3505                 else {
3506                     res[i] = b[idx+origin+j];
3507                     j++;
3508                 }
3509             }
3510         }
3511         return res;
3512     }
3513 
3514     @Test(dataProvider = "floatBinaryOpProvider")
3515     static void unsliceBinaryFloat128VectorTestsBinary(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3516         float[] a = fa.apply(SPECIES.length());
3517         float[] b = fb.apply(SPECIES.length());
3518         float[] r = new float[a.length];
3519         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3520         int part = (new java.util.Random()).nextInt(2);
3521         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3522             for (int i = 0; i < a.length; i += SPECIES.length()) {
3523                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3524                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3525                 av.unslice(origin, bv, part).intoArray(r, i);
3526             }
3527         }
3528 
3529         assertArraysEquals(r, a, b, origin, part, Float128VectorTests::unsliceBinary);
3530     }
3531     static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
3532         float[] res = new float[SPECIES.length()];
3533         for (int i = 0, j = 0; i < SPECIES.length(); i++){
3534             if(i+origin < SPECIES.length())
3535                 res[i] = b[idx+i+origin];
3536             else {
3537                 res[i] = b[idx+j];
3538                 j++;
3539             }
3540         }
3541         for (int i = 0; i < SPECIES.length(); i++){
3542             res[i] = mask[i] ? a[idx+i] : res[i];
3543         }
3544         float[] res1 = new float[SPECIES.length()];
3545         if (part == 0) {
3546             for (int i = 0, j = 0; i < SPECIES.length(); i++){
3547                 if (i < origin)
3548                     res1[i] = b[idx+i];
3549                 else {
3550                    res1[i] = res[j];
3551                    j++;
3552                 }
3553             }
3554         } else if (part == 1) {
3555             for (int i = 0, j = 0; i < SPECIES.length(); i++){
3556                 if (i < origin)
3557                     res1[i] = res[SPECIES.length()-origin+i];
3558                 else {
3559                     res1[i] = b[idx+origin+j];
3560                     j++;
3561                 }
3562             }
3563         }
3564         return res1;
3565     }
3566 
3567     @Test(dataProvider = "floatBinaryOpMaskProvider")
3568     static void unsliceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
3569     IntFunction<boolean[]> fm) {
3570         float[] a = fa.apply(SPECIES.length());
3571         float[] b = fb.apply(SPECIES.length());
3572         boolean[] mask = fm.apply(SPECIES.length());
3573         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
3574         float[] r = new float[a.length];
3575         int origin = (new java.util.Random()).nextInt(SPECIES.length());
3576         int part = (new java.util.Random()).nextInt(2);
3577         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3578             for (int i = 0; i < a.length; i += SPECIES.length()) {
3579                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3580                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3581                 av.unslice(origin, bv, part, vmask).intoArray(r, i);
3582             }
3583         }
3584 
3585         assertArraysEquals(r, a, b, origin, part, mask, Float128VectorTests::unslice);
3586     }
3587 
3588     static float SIN(float a) {
3589         return (float)(Math.sin((double)a));
3590     }
3591 
3592     static float strictSIN(float a) {
3593         return (float)(StrictMath.sin((double)a));
3594     }
3595 
3596     @Test(dataProvider = "floatUnaryOpProvider")
3597     static void SINFloat128VectorTests(IntFunction<float[]> fa) {
3598         float[] a = fa.apply(SPECIES.length());
3599         float[] r = fr.apply(SPECIES.length());
3600 
3601         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3602             for (int i = 0; i < a.length; i += SPECIES.length()) {
3603                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3604                 av.lanewise(VectorOperators.SIN).intoArray(r, i);
3605             }
3606         }
3607 
3608         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::SIN, Float128VectorTests::strictSIN);
3609     }
3610 
3611 
3612     static float EXP(float a) {
3613         return (float)(Math.exp((double)a));
3614     }
3615 
3616     static float strictEXP(float a) {
3617         return (float)(StrictMath.exp((double)a));
3618     }
3619 
3620     @Test(dataProvider = "floatUnaryOpProvider")
3621     static void EXPFloat128VectorTests(IntFunction<float[]> fa) {
3622         float[] a = fa.apply(SPECIES.length());
3623         float[] r = fr.apply(SPECIES.length());
3624 
3625         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3626             for (int i = 0; i < a.length; i += SPECIES.length()) {
3627                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3628                 av.lanewise(VectorOperators.EXP).intoArray(r, i);
3629             }
3630         }
3631 
3632         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::EXP, Float128VectorTests::strictEXP);
3633     }
3634 
3635 
3636     static float LOG1P(float a) {
3637         return (float)(Math.log1p((double)a));
3638     }
3639 
3640     static float strictLOG1P(float a) {
3641         return (float)(StrictMath.log1p((double)a));
3642     }
3643 
3644     @Test(dataProvider = "floatUnaryOpProvider")
3645     static void LOG1PFloat128VectorTests(IntFunction<float[]> fa) {
3646         float[] a = fa.apply(SPECIES.length());
3647         float[] r = fr.apply(SPECIES.length());
3648 
3649         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3650             for (int i = 0; i < a.length; i += SPECIES.length()) {
3651                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3652                 av.lanewise(VectorOperators.LOG1P).intoArray(r, i);
3653             }
3654         }
3655 
3656         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG1P, Float128VectorTests::strictLOG1P);
3657     }
3658 
3659 
3660     static float LOG(float a) {
3661         return (float)(Math.log((double)a));
3662     }
3663 
3664     static float strictLOG(float a) {
3665         return (float)(StrictMath.log((double)a));
3666     }
3667 
3668     @Test(dataProvider = "floatUnaryOpProvider")
3669     static void LOGFloat128VectorTests(IntFunction<float[]> fa) {
3670         float[] a = fa.apply(SPECIES.length());
3671         float[] r = fr.apply(SPECIES.length());
3672 
3673         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3674             for (int i = 0; i < a.length; i += SPECIES.length()) {
3675                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3676                 av.lanewise(VectorOperators.LOG).intoArray(r, i);
3677             }
3678         }
3679 
3680         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG, Float128VectorTests::strictLOG);
3681     }
3682 
3683 
3684     static float LOG10(float a) {
3685         return (float)(Math.log10((double)a));
3686     }
3687 
3688     static float strictLOG10(float a) {
3689         return (float)(StrictMath.log10((double)a));
3690     }
3691 
3692     @Test(dataProvider = "floatUnaryOpProvider")
3693     static void LOG10Float128VectorTests(IntFunction<float[]> fa) {
3694         float[] a = fa.apply(SPECIES.length());
3695         float[] r = fr.apply(SPECIES.length());
3696 
3697         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3698             for (int i = 0; i < a.length; i += SPECIES.length()) {
3699                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3700                 av.lanewise(VectorOperators.LOG10).intoArray(r, i);
3701             }
3702         }
3703 
3704         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG10, Float128VectorTests::strictLOG10);
3705     }
3706 
3707 
3708     static float EXPM1(float a) {
3709         return (float)(Math.expm1((double)a));
3710     }
3711 
3712     static float strictEXPM1(float a) {
3713         return (float)(StrictMath.expm1((double)a));
3714     }
3715 
3716     @Test(dataProvider = "floatUnaryOpProvider")
3717     static void EXPM1Float128VectorTests(IntFunction<float[]> fa) {
3718         float[] a = fa.apply(SPECIES.length());
3719         float[] r = fr.apply(SPECIES.length());
3720 
3721         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3722             for (int i = 0; i < a.length; i += SPECIES.length()) {
3723                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3724                 av.lanewise(VectorOperators.EXPM1).intoArray(r, i);
3725             }
3726         }
3727 
3728         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::EXPM1, Float128VectorTests::strictEXPM1);
3729     }
3730 
3731 
3732     static float COS(float a) {
3733         return (float)(Math.cos((double)a));
3734     }
3735 
3736     static float strictCOS(float a) {
3737         return (float)(StrictMath.cos((double)a));
3738     }
3739 
3740     @Test(dataProvider = "floatUnaryOpProvider")
3741     static void COSFloat128VectorTests(IntFunction<float[]> fa) {
3742         float[] a = fa.apply(SPECIES.length());
3743         float[] r = fr.apply(SPECIES.length());
3744 
3745         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3746             for (int i = 0; i < a.length; i += SPECIES.length()) {
3747                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3748                 av.lanewise(VectorOperators.COS).intoArray(r, i);
3749             }
3750         }
3751 
3752         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::COS, Float128VectorTests::strictCOS);
3753     }
3754 
3755 
3756     static float TAN(float a) {
3757         return (float)(Math.tan((double)a));
3758     }
3759 
3760     static float strictTAN(float a) {
3761         return (float)(StrictMath.tan((double)a));
3762     }
3763 
3764     @Test(dataProvider = "floatUnaryOpProvider")
3765     static void TANFloat128VectorTests(IntFunction<float[]> fa) {
3766         float[] a = fa.apply(SPECIES.length());
3767         float[] r = fr.apply(SPECIES.length());
3768 
3769         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3770             for (int i = 0; i < a.length; i += SPECIES.length()) {
3771                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3772                 av.lanewise(VectorOperators.TAN).intoArray(r, i);
3773             }
3774         }
3775 
3776         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::TAN, Float128VectorTests::strictTAN);
3777     }
3778 
3779 
3780     static float SINH(float a) {
3781         return (float)(Math.sinh((double)a));
3782     }
3783 
3784     static float strictSINH(float a) {
3785         return (float)(StrictMath.sinh((double)a));
3786     }
3787 
3788     @Test(dataProvider = "floatUnaryOpProvider")
3789     static void SINHFloat128VectorTests(IntFunction<float[]> fa) {
3790         float[] a = fa.apply(SPECIES.length());
3791         float[] r = fr.apply(SPECIES.length());
3792 
3793         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3794             for (int i = 0; i < a.length; i += SPECIES.length()) {
3795                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3796                 av.lanewise(VectorOperators.SINH).intoArray(r, i);
3797             }
3798         }
3799 
3800         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::SINH, Float128VectorTests::strictSINH);
3801     }
3802 
3803 
3804     static float COSH(float a) {
3805         return (float)(Math.cosh((double)a));
3806     }
3807 
3808     static float strictCOSH(float a) {
3809         return (float)(StrictMath.cosh((double)a));
3810     }
3811 
3812     @Test(dataProvider = "floatUnaryOpProvider")
3813     static void COSHFloat128VectorTests(IntFunction<float[]> fa) {
3814         float[] a = fa.apply(SPECIES.length());
3815         float[] r = fr.apply(SPECIES.length());
3816 
3817         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3818             for (int i = 0; i < a.length; i += SPECIES.length()) {
3819                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3820                 av.lanewise(VectorOperators.COSH).intoArray(r, i);
3821             }
3822         }
3823 
3824         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::COSH, Float128VectorTests::strictCOSH);
3825     }
3826 
3827 
3828     static float TANH(float a) {
3829         return (float)(Math.tanh((double)a));
3830     }
3831 
3832     static float strictTANH(float a) {
3833         return (float)(StrictMath.tanh((double)a));
3834     }
3835 
3836     @Test(dataProvider = "floatUnaryOpProvider")
3837     static void TANHFloat128VectorTests(IntFunction<float[]> fa) {
3838         float[] a = fa.apply(SPECIES.length());
3839         float[] r = fr.apply(SPECIES.length());
3840 
3841         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3842             for (int i = 0; i < a.length; i += SPECIES.length()) {
3843                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3844                 av.lanewise(VectorOperators.TANH).intoArray(r, i);
3845             }
3846         }
3847 
3848         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::TANH, Float128VectorTests::strictTANH);
3849     }
3850 
3851 
3852     static float ASIN(float a) {
3853         return (float)(Math.asin((double)a));
3854     }
3855 
3856     static float strictASIN(float a) {
3857         return (float)(StrictMath.asin((double)a));
3858     }
3859 
3860     @Test(dataProvider = "floatUnaryOpProvider")
3861     static void ASINFloat128VectorTests(IntFunction<float[]> fa) {
3862         float[] a = fa.apply(SPECIES.length());
3863         float[] r = fr.apply(SPECIES.length());
3864 
3865         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3866             for (int i = 0; i < a.length; i += SPECIES.length()) {
3867                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3868                 av.lanewise(VectorOperators.ASIN).intoArray(r, i);
3869             }
3870         }
3871 
3872         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ASIN, Float128VectorTests::strictASIN);
3873     }
3874 
3875 
3876     static float ACOS(float a) {
3877         return (float)(Math.acos((double)a));
3878     }
3879 
3880     static float strictACOS(float a) {
3881         return (float)(StrictMath.acos((double)a));
3882     }
3883 
3884     @Test(dataProvider = "floatUnaryOpProvider")
3885     static void ACOSFloat128VectorTests(IntFunction<float[]> fa) {
3886         float[] a = fa.apply(SPECIES.length());
3887         float[] r = fr.apply(SPECIES.length());
3888 
3889         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3890             for (int i = 0; i < a.length; i += SPECIES.length()) {
3891                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3892                 av.lanewise(VectorOperators.ACOS).intoArray(r, i);
3893             }
3894         }
3895 
3896         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ACOS, Float128VectorTests::strictACOS);
3897     }
3898 
3899 
3900     static float ATAN(float a) {
3901         return (float)(Math.atan((double)a));
3902     }
3903 
3904     static float strictATAN(float a) {
3905         return (float)(StrictMath.atan((double)a));
3906     }
3907 
3908     @Test(dataProvider = "floatUnaryOpProvider")
3909     static void ATANFloat128VectorTests(IntFunction<float[]> fa) {
3910         float[] a = fa.apply(SPECIES.length());
3911         float[] r = fr.apply(SPECIES.length());
3912 
3913         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3914             for (int i = 0; i < a.length; i += SPECIES.length()) {
3915                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3916                 av.lanewise(VectorOperators.ATAN).intoArray(r, i);
3917             }
3918         }
3919 
3920         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ATAN, Float128VectorTests::strictATAN);
3921     }
3922 
3923 
3924     static float CBRT(float a) {
3925         return (float)(Math.cbrt((double)a));
3926     }
3927 
3928     static float strictCBRT(float a) {
3929         return (float)(StrictMath.cbrt((double)a));
3930     }
3931 
3932     @Test(dataProvider = "floatUnaryOpProvider")
3933     static void CBRTFloat128VectorTests(IntFunction<float[]> fa) {
3934         float[] a = fa.apply(SPECIES.length());
3935         float[] r = fr.apply(SPECIES.length());
3936 
3937         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3938             for (int i = 0; i < a.length; i += SPECIES.length()) {
3939                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3940                 av.lanewise(VectorOperators.CBRT).intoArray(r, i);
3941             }
3942         }
3943 
3944         assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::CBRT, Float128VectorTests::strictCBRT);
3945     }
3946 
3947 
3948     static float HYPOT(float a, float b) {
3949         return (float)(Math.hypot((double)a, (double)b));
3950     }
3951 
3952     static float strictHYPOT(float a, float b) {
3953         return (float)(StrictMath.hypot((double)a, (double)b));
3954     }
3955 
3956     @Test(dataProvider = "floatBinaryOpProvider")
3957     static void HYPOTFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3958         float[] a = fa.apply(SPECIES.length());
3959         float[] b = fb.apply(SPECIES.length());
3960         float[] r = fr.apply(SPECIES.length());
3961 
3962         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3963             for (int i = 0; i < a.length; i += SPECIES.length()) {
3964                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3965                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3966                 av.lanewise(VectorOperators.HYPOT, bv).intoArray(r, i);
3967             }
3968         }
3969 
3970         assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::HYPOT, Float128VectorTests::strictHYPOT);
3971     }
3972 
3973 
3974 
3975     static float POW(float a, float b) {
3976         return (float)(Math.pow((double)a, (double)b));
3977     }
3978 
3979     static float strictPOW(float a, float b) {
3980         return (float)(StrictMath.pow((double)a, (double)b));
3981     }
3982 
3983     @Test(dataProvider = "floatBinaryOpProvider")
3984     static void POWFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
3985         float[] a = fa.apply(SPECIES.length());
3986         float[] b = fb.apply(SPECIES.length());
3987         float[] r = fr.apply(SPECIES.length());
3988 
3989         for (int ic = 0; ic < INVOC_COUNT; ic++) {
3990             for (int i = 0; i < a.length; i += SPECIES.length()) {
3991                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
3992                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
3993                 av.lanewise(VectorOperators.POW, bv).intoArray(r, i);
3994             }
3995         }
3996 
3997         assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::POW, Float128VectorTests::strictPOW);
3998     }
3999 
4000     static float pow(float a, float b) {
4001         return (float)(Math.pow((double)a, (double)b));
4002     }
4003 
4004     static float strictpow(float a, float b) {
4005         return (float)(StrictMath.pow((double)a, (double)b));
4006     }
4007 
4008     @Test(dataProvider = "floatBinaryOpProvider")
4009     static void powFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4010         float[] a = fa.apply(SPECIES.length());
4011         float[] b = fb.apply(SPECIES.length());
4012         float[] r = fr.apply(SPECIES.length());
4013 
4014         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4015             for (int i = 0; i < a.length; i += SPECIES.length()) {
4016                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4017                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4018                 av.pow(bv).intoArray(r, i);
4019             }
4020         }
4021 
4022         assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::pow, Float128VectorTests::strictpow);
4023     }
4024 
4025 
4026 
4027     static float ATAN2(float a, float b) {
4028         return (float)(Math.atan2((double)a, (double)b));
4029     }
4030 
4031     static float strictATAN2(float a, float b) {
4032         return (float)(StrictMath.atan2((double)a, (double)b));
4033     }
4034 
4035     @Test(dataProvider = "floatBinaryOpProvider")
4036     static void ATAN2Float128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4037         float[] a = fa.apply(SPECIES.length());
4038         float[] b = fb.apply(SPECIES.length());
4039         float[] r = fr.apply(SPECIES.length());
4040 
4041         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4042             for (int i = 0; i < a.length; i += SPECIES.length()) {
4043                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4044                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4045                 av.lanewise(VectorOperators.ATAN2, bv).intoArray(r, i);
4046             }
4047         }
4048 
4049         assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::ATAN2, Float128VectorTests::strictATAN2);
4050     }
4051 
4052 
4053 
4054     @Test(dataProvider = "floatBinaryOpProvider")
4055     static void POWFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4056         float[] a = fa.apply(SPECIES.length());
4057         float[] b = fb.apply(SPECIES.length());
4058         float[] r = fr.apply(SPECIES.length());
4059 
4060         for (int i = 0; i < a.length; i += SPECIES.length()) {
4061             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4062             av.lanewise(VectorOperators.POW, b[i]).intoArray(r, i);
4063         }
4064 
4065         assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::POW, Float128VectorTests::strictPOW);
4066     }
4067 
4068     @Test(dataProvider = "floatBinaryOpProvider")
4069     static void powFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4070         float[] a = fa.apply(SPECIES.length());
4071         float[] b = fb.apply(SPECIES.length());
4072         float[] r = fr.apply(SPECIES.length());
4073 
4074         for (int i = 0; i < a.length; i += SPECIES.length()) {
4075             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4076             av.pow(b[i]).intoArray(r, i);
4077         }
4078 
4079         assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::pow, Float128VectorTests::strictpow);
4080     }
4081 
4082 
4083 
4084     static float FMA(float a, float b, float c) {
4085         return (float)(Math.fma(a, b, c));
4086     }
4087     static float fma(float a, float b, float c) {
4088         return (float)(Math.fma(a, b, c));
4089     }
4090 
4091 
4092     @Test(dataProvider = "floatTernaryOpProvider")
4093     static void FMAFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4094         float[] a = fa.apply(SPECIES.length());
4095         float[] b = fb.apply(SPECIES.length());
4096         float[] c = fc.apply(SPECIES.length());
4097         float[] r = fr.apply(SPECIES.length());
4098 
4099         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4100             for (int i = 0; i < a.length; i += SPECIES.length()) {
4101                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4102                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4103                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4104                 av.lanewise(VectorOperators.FMA, bv, cv).intoArray(r, i);
4105             }
4106         }
4107 
4108         assertArraysEquals(r, a, b, c, Float128VectorTests::FMA);
4109     }
4110     @Test(dataProvider = "floatTernaryOpProvider")
4111     static void fmaFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4112         float[] a = fa.apply(SPECIES.length());
4113         float[] b = fb.apply(SPECIES.length());
4114         float[] c = fc.apply(SPECIES.length());
4115         float[] r = fr.apply(SPECIES.length());
4116 
4117         for (int i = 0; i < a.length; i += SPECIES.length()) {
4118             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4119             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4120             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4121             av.fma(bv, cv).intoArray(r, i);
4122         }
4123 
4124         assertArraysEquals(r, a, b, c, Float128VectorTests::fma);
4125     }
4126 
4127 
4128     @Test(dataProvider = "floatTernaryOpMaskProvider")
4129     static void FMAFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
4130                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4131         float[] a = fa.apply(SPECIES.length());
4132         float[] b = fb.apply(SPECIES.length());
4133         float[] c = fc.apply(SPECIES.length());
4134         float[] r = fr.apply(SPECIES.length());
4135         boolean[] mask = fm.apply(SPECIES.length());
4136         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4137 
4138         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4139             for (int i = 0; i < a.length; i += SPECIES.length()) {
4140                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4141                 FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4142                 FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4143                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
4144             }
4145         }
4146 
4147         assertArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
4148     }
4149 
4150 
4151 
4152 
4153 
4154     @Test(dataProvider = "floatTernaryOpProvider")
4155     static void FMAFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4156         float[] a = fa.apply(SPECIES.length());
4157         float[] b = fb.apply(SPECIES.length());
4158         float[] c = fc.apply(SPECIES.length());
4159         float[] r = fr.apply(SPECIES.length());
4160 
4161         for (int i = 0; i < a.length; i += SPECIES.length()) {
4162             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4163             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4164             av.lanewise(VectorOperators.FMA, bv, c[i]).intoArray(r, i);
4165         }
4166         assertBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
4167     }
4168 
4169     @Test(dataProvider = "floatTernaryOpProvider")
4170     static void FMAFloat128VectorTestsAltBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4171         float[] a = fa.apply(SPECIES.length());
4172         float[] b = fb.apply(SPECIES.length());
4173         float[] c = fc.apply(SPECIES.length());
4174         float[] r = fr.apply(SPECIES.length());
4175 
4176         for (int i = 0; i < a.length; i += SPECIES.length()) {
4177             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4178             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4179             av.lanewise(VectorOperators.FMA, b[i], cv).intoArray(r, i);
4180         }
4181         assertAltBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
4182     }
4183 
4184 
4185     @Test(dataProvider = "floatTernaryOpMaskProvider")
4186     static void FMAFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4187                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4188         float[] a = fa.apply(SPECIES.length());
4189         float[] b = fb.apply(SPECIES.length());
4190         float[] c = fc.apply(SPECIES.length());
4191         float[] r = fr.apply(SPECIES.length());
4192         boolean[] mask = fm.apply(SPECIES.length());
4193         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4194 
4195         for (int i = 0; i < a.length; i += SPECIES.length()) {
4196             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4197             FloatVector bv = FloatVector.fromArray(SPECIES, b, i);
4198             av.lanewise(VectorOperators.FMA, bv, c[i], vmask).intoArray(r, i);
4199         }
4200 
4201         assertBroadcastArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
4202     }
4203 
4204     @Test(dataProvider = "floatTernaryOpMaskProvider")
4205     static void FMAFloat128VectorTestsAltBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4206                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4207         float[] a = fa.apply(SPECIES.length());
4208         float[] b = fb.apply(SPECIES.length());
4209         float[] c = fc.apply(SPECIES.length());
4210         float[] r = fr.apply(SPECIES.length());
4211         boolean[] mask = fm.apply(SPECIES.length());
4212         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4213 
4214         for (int i = 0; i < a.length; i += SPECIES.length()) {
4215             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4216             FloatVector cv = FloatVector.fromArray(SPECIES, c, i);
4217             av.lanewise(VectorOperators.FMA, b[i], cv, vmask).intoArray(r, i);
4218         }
4219 
4220         assertAltBroadcastArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
4221     }
4222 
4223 
4224 
4225 
4226     @Test(dataProvider = "floatTernaryOpProvider")
4227     static void FMAFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4228         float[] a = fa.apply(SPECIES.length());
4229         float[] b = fb.apply(SPECIES.length());
4230         float[] c = fc.apply(SPECIES.length());
4231         float[] r = fr.apply(SPECIES.length());
4232 
4233         for (int i = 0; i < a.length; i += SPECIES.length()) {
4234             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4235             av.lanewise(VectorOperators.FMA, b[i], c[i]).intoArray(r, i);
4236         }
4237 
4238         assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
4239     }
4240     @Test(dataProvider = "floatTernaryOpProvider")
4241     static void fmaFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
4242         float[] a = fa.apply(SPECIES.length());
4243         float[] b = fb.apply(SPECIES.length());
4244         float[] c = fc.apply(SPECIES.length());
4245         float[] r = fr.apply(SPECIES.length());
4246 
4247         for (int i = 0; i < a.length; i += SPECIES.length()) {
4248             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4249             av.fma(b[i], c[i]).intoArray(r, i);
4250         }
4251 
4252         assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::fma);
4253     }
4254 
4255 
4256     @Test(dataProvider = "floatTernaryOpMaskProvider")
4257     static void FMAFloat128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4258                                           IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
4259         float[] a = fa.apply(SPECIES.length());
4260         float[] b = fb.apply(SPECIES.length());
4261         float[] c = fc.apply(SPECIES.length());
4262         float[] r = fr.apply(SPECIES.length());
4263         boolean[] mask = fm.apply(SPECIES.length());
4264         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4265 
4266         for (int i = 0; i < a.length; i += SPECIES.length()) {
4267             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4268             av.lanewise(VectorOperators.FMA, b[i], c[i], vmask).intoArray(r, i);
4269         }
4270 
4271         assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
4272     }
4273 
4274 
4275 
4276 
4277     static float NEG(float a) {
4278         return (float)(-((float)a));
4279     }
4280 
4281     static float neg(float a) {
4282         return (float)(-((float)a));
4283     }
4284 
4285     @Test(dataProvider = "floatUnaryOpProvider")
4286     static void NEGFloat128VectorTests(IntFunction<float[]> fa) {
4287         float[] a = fa.apply(SPECIES.length());
4288         float[] r = fr.apply(SPECIES.length());
4289 
4290         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4291             for (int i = 0; i < a.length; i += SPECIES.length()) {
4292                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4293                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
4294             }
4295         }
4296 
4297         assertArraysEquals(r, a, Float128VectorTests::NEG);
4298     }
4299 
4300     @Test(dataProvider = "floatUnaryOpProvider")
4301     static void negFloat128VectorTests(IntFunction<float[]> fa) {
4302         float[] a = fa.apply(SPECIES.length());
4303         float[] r = fr.apply(SPECIES.length());
4304 
4305         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4306             for (int i = 0; i < a.length; i += SPECIES.length()) {
4307                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4308                 av.neg().intoArray(r, i);
4309             }
4310         }
4311 
4312         assertArraysEquals(r, a, Float128VectorTests::neg);
4313     }
4314 
4315     @Test(dataProvider = "floatUnaryOpMaskProvider")
4316     static void NEGMaskedFloat128VectorTests(IntFunction<float[]> fa,
4317                                                 IntFunction<boolean[]> fm) {
4318         float[] a = fa.apply(SPECIES.length());
4319         float[] r = fr.apply(SPECIES.length());
4320         boolean[] mask = fm.apply(SPECIES.length());
4321         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4322 
4323         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4324             for (int i = 0; i < a.length; i += SPECIES.length()) {
4325                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4326                 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i);
4327             }
4328         }
4329 
4330         assertArraysEquals(r, a, mask, Float128VectorTests::NEG);
4331     }
4332 
4333     static float ABS(float a) {
4334         return (float)(Math.abs((float)a));
4335     }
4336 
4337     static float abs(float a) {
4338         return (float)(Math.abs((float)a));
4339     }
4340 
4341     @Test(dataProvider = "floatUnaryOpProvider")
4342     static void ABSFloat128VectorTests(IntFunction<float[]> fa) {
4343         float[] a = fa.apply(SPECIES.length());
4344         float[] r = fr.apply(SPECIES.length());
4345 
4346         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4347             for (int i = 0; i < a.length; i += SPECIES.length()) {
4348                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4349                 av.lanewise(VectorOperators.ABS).intoArray(r, i);
4350             }
4351         }
4352 
4353         assertArraysEquals(r, a, Float128VectorTests::ABS);
4354     }
4355 
4356     @Test(dataProvider = "floatUnaryOpProvider")
4357     static void absFloat128VectorTests(IntFunction<float[]> fa) {
4358         float[] a = fa.apply(SPECIES.length());
4359         float[] r = fr.apply(SPECIES.length());
4360 
4361         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4362             for (int i = 0; i < a.length; i += SPECIES.length()) {
4363                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4364                 av.abs().intoArray(r, i);
4365             }
4366         }
4367 
4368         assertArraysEquals(r, a, Float128VectorTests::abs);
4369     }
4370 
4371     @Test(dataProvider = "floatUnaryOpMaskProvider")
4372     static void ABSMaskedFloat128VectorTests(IntFunction<float[]> fa,
4373                                                 IntFunction<boolean[]> fm) {
4374         float[] a = fa.apply(SPECIES.length());
4375         float[] r = fr.apply(SPECIES.length());
4376         boolean[] mask = fm.apply(SPECIES.length());
4377         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4378 
4379         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4380             for (int i = 0; i < a.length; i += SPECIES.length()) {
4381                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4382                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
4383             }
4384         }
4385 
4386         assertArraysEquals(r, a, mask, Float128VectorTests::ABS);
4387     }
4388 
4389 
4390 
4391 
4392 
4393 
4394 
4395 
4396     static float SQRT(float a) {
4397         return (float)(Math.sqrt((double)a));
4398     }
4399 
4400     static float sqrt(float a) {
4401         return (float)(Math.sqrt((double)a));
4402     }
4403 
4404 
4405 
4406     @Test(dataProvider = "floatUnaryOpProvider")
4407     static void SQRTFloat128VectorTests(IntFunction<float[]> fa) {
4408         float[] a = fa.apply(SPECIES.length());
4409         float[] r = fr.apply(SPECIES.length());
4410 
4411         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4412             for (int i = 0; i < a.length; i += SPECIES.length()) {
4413                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4414                 av.lanewise(VectorOperators.SQRT).intoArray(r, i);
4415             }
4416         }
4417 
4418         assertArraysEquals(r, a, Float128VectorTests::SQRT);
4419     }
4420 
4421     @Test(dataProvider = "floatUnaryOpProvider")
4422     static void sqrtFloat128VectorTests(IntFunction<float[]> fa) {
4423         float[] a = fa.apply(SPECIES.length());
4424         float[] r = fr.apply(SPECIES.length());
4425 
4426         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4427             for (int i = 0; i < a.length; i += SPECIES.length()) {
4428                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4429                 av.sqrt().intoArray(r, i);
4430             }
4431         }
4432 
4433         assertArraysEquals(r, a, Float128VectorTests::sqrt);
4434     }
4435 
4436 
4437 
4438     @Test(dataProvider = "floatUnaryOpMaskProvider")
4439     static void SQRTMaskedFloat128VectorTests(IntFunction<float[]> fa,
4440                                                 IntFunction<boolean[]> fm) {
4441         float[] a = fa.apply(SPECIES.length());
4442         float[] r = fr.apply(SPECIES.length());
4443         boolean[] mask = fm.apply(SPECIES.length());
4444         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4445 
4446         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4447             for (int i = 0; i < a.length; i += SPECIES.length()) {
4448                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4449                 av.lanewise(VectorOperators.SQRT, vmask).intoArray(r, i);
4450             }
4451         }
4452 
4453         assertArraysEquals(r, a, mask, Float128VectorTests::SQRT);
4454     }
4455 
4456 
4457     @Test(dataProvider = "floatCompareOpProvider")
4458     static void ltFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4459         float[] a = fa.apply(SPECIES.length());
4460         float[] b = fb.apply(SPECIES.length());
4461 
4462         for (int i = 0; i < a.length; i += SPECIES.length()) {
4463             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4464             VectorMask<Float> mv = av.lt(b[i]);
4465 
4466             // Check results as part of computation.
4467             for (int j = 0; j < SPECIES.length(); j++) {
4468                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
4469             }
4470         }
4471     }
4472 
4473     @Test(dataProvider = "floatCompareOpProvider")
4474     static void eqFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
4475         float[] a = fa.apply(SPECIES.length());
4476         float[] b = fb.apply(SPECIES.length());
4477 
4478         for (int i = 0; i < a.length; i += SPECIES.length()) {
4479             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4480             VectorMask<Float> mv = av.eq(b[i]);
4481 
4482             // Check results as part of computation.
4483             for (int j = 0; j < SPECIES.length(); j++) {
4484                 Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
4485             }
4486         }
4487     }
4488 
4489     @Test(dataProvider = "floattoIntUnaryOpProvider")
4490     static void toIntArrayFloat128VectorTestsSmokeTest(IntFunction<float[]> fa) {
4491         float[] a = fa.apply(SPECIES.length());
4492 
4493         for (int i = 0; i < a.length; i += SPECIES.length()) {
4494             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4495             int[] r = av.toIntArray();
4496             assertArraysEquals(r, a, i);
4497         }
4498     }
4499 
4500     @Test(dataProvider = "floattoLongUnaryOpProvider")
4501     static void toLongArrayFloat128VectorTestsSmokeTest(IntFunction<float[]> fa) {
4502         float[] a = fa.apply(SPECIES.length());
4503 
4504         for (int i = 0; i < a.length; i += SPECIES.length()) {
4505             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4506             long[] r = av.toLongArray();
4507             assertArraysEquals(r, a, i);
4508         }
4509     }
4510 
4511     @Test(dataProvider = "floatUnaryOpProvider")
4512     static void toDoubleArrayFloat128VectorTestsSmokeTest(IntFunction<float[]> fa) {
4513         float[] a = fa.apply(SPECIES.length());
4514 
4515         for (int i = 0; i < a.length; i += SPECIES.length()) {
4516             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4517             double[] r = av.toDoubleArray();
4518             assertArraysEquals(r, a, i);
4519         }
4520     }
4521 
4522     @Test(dataProvider = "floatUnaryOpProvider")
4523     static void toStringFloat128VectorTestsSmokeTest(IntFunction<float[]> fa) {
4524         float[] a = fa.apply(SPECIES.length());
4525 
4526         for (int i = 0; i < a.length; i += SPECIES.length()) {
4527             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4528             String str = av.toString();
4529 
4530             float subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
4531             Assert.assertTrue(str.equals(Arrays.toString(subarr)), "at index " + i + ", string should be = " + Arrays.toString(subarr) + ", but is = " + str);
4532         }
4533     }
4534 
4535     @Test(dataProvider = "floatUnaryOpProvider")
4536     static void hashCodeFloat128VectorTestsSmokeTest(IntFunction<float[]> fa) {
4537         float[] a = fa.apply(SPECIES.length());
4538 
4539         for (int i = 0; i < a.length; i += SPECIES.length()) {
4540             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4541             int hash = av.hashCode();
4542 
4543             float subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
4544             int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr));
4545             Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash);
4546         }
4547     }
4548 
4549 
4550     static long ADDReduceLong(float[] a, int idx) {
4551         float res = 0;
4552         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4553             res += a[i];
4554         }
4555 
4556         return (long)res;
4557     }
4558 
4559     static long ADDReduceAllLong(float[] a) {
4560         long res = 0;
4561         for (int i = 0; i < a.length; i += SPECIES.length()) {
4562             res += ADDReduceLong(a, i);
4563         }
4564 
4565         return res;
4566     }
4567 
4568     @Test(dataProvider = "floatUnaryOpProvider")
4569     static void ADDReduceLongFloat128VectorTests(IntFunction<float[]> fa) {
4570         float[] a = fa.apply(SPECIES.length());
4571         long[] r = lfr.apply(SPECIES.length());
4572         long ra = 0;
4573 
4574         for (int i = 0; i < a.length; i += SPECIES.length()) {
4575             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4576             r[i] = av.reduceLanesToLong(VectorOperators.ADD);
4577         }
4578 
4579         ra = 0;
4580         for (int i = 0; i < a.length; i ++) {
4581             ra += r[i];
4582         }
4583 
4584         assertReductionLongArraysEquals(r, ra, a,
4585                 Float128VectorTests::ADDReduceLong, Float128VectorTests::ADDReduceAllLong);
4586     }
4587 
4588     static long ADDReduceLongMasked(float[] a, int idx, boolean[] mask) {
4589         float res = 0;
4590         for (int i = idx; i < (idx + SPECIES.length()); i++) {
4591             if(mask[i % SPECIES.length()])
4592                 res += a[i];
4593         }
4594 
4595         return (long)res;
4596     }
4597 
4598     static long ADDReduceAllLongMasked(float[] a, boolean[] mask) {
4599         long res = 0;
4600         for (int i = 0; i < a.length; i += SPECIES.length()) {
4601             res += ADDReduceLongMasked(a, i, mask);
4602         }
4603 
4604         return res;
4605     }
4606 
4607     @Test(dataProvider = "floatUnaryOpMaskProvider")
4608     static void ADDReduceLongFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
4609         float[] a = fa.apply(SPECIES.length());
4610         long[] r = lfr.apply(SPECIES.length());
4611         boolean[] mask = fm.apply(SPECIES.length());
4612         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4613         long ra = 0;
4614 
4615         for (int i = 0; i < a.length; i += SPECIES.length()) {
4616             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4617             r[i] = av.reduceLanesToLong(VectorOperators.ADD, vmask);
4618         }
4619 
4620         ra = 0;
4621         for (int i = 0; i < a.length; i ++) {
4622             ra += r[i];
4623         }
4624 
4625         assertReductionLongArraysEqualsMasked(r, ra, a, mask,
4626                 Float128VectorTests::ADDReduceLongMasked, Float128VectorTests::ADDReduceAllLongMasked);
4627     }
4628 
4629     @Test(dataProvider = "floattoLongUnaryOpProvider")
4630     static void BroadcastLongFloat128VectorTestsSmokeTest(IntFunction<float[]> fa) {
4631         float[] a = fa.apply(SPECIES.length());
4632         float[] r = new float[a.length];
4633 
4634         for (int i = 0; i < a.length; i += SPECIES.length()) {
4635             FloatVector.broadcast(SPECIES, (long)a[i]).intoArray(r, i);
4636         }
4637         assertBroadcastArraysEquals(r, a);
4638     }
4639 
4640     @Test(dataProvider = "floatBinaryOpMaskProvider")
4641     static void blendFloat128VectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
4642                                           IntFunction<boolean[]> fm) {
4643         float[] a = fa.apply(SPECIES.length());
4644         float[] b = fb.apply(SPECIES.length());
4645         float[] r = fr.apply(SPECIES.length());
4646         boolean[] mask = fm.apply(SPECIES.length());
4647         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4648 
4649         for (int ic = 0; ic < INVOC_COUNT; ic++) {
4650             for (int i = 0; i < a.length; i += SPECIES.length()) {
4651                 FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4652                 av.blend((long)b[i], vmask).intoArray(r, i);
4653             }
4654         }
4655         assertBroadcastLongArraysEquals(r, a, b, mask, Float128VectorTests::blend);
4656     }
4657 
4658 
4659     @Test(dataProvider = "floatUnaryOpSelectFromProvider")
4660     static void SelectFromFloat128VectorTests(IntFunction<float[]> fa,
4661                                            BiFunction<Integer,Integer,float[]> fs) {
4662         float[] a = fa.apply(SPECIES.length());
4663         float[] order = fs.apply(a.length, SPECIES.length());
4664         float[] r = fr.apply(SPECIES.length());
4665 
4666         for (int i = 0; i < a.length; i += SPECIES.length()) {
4667             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4668             FloatVector bv = FloatVector.fromArray(SPECIES, order, i);
4669             bv.selectFrom(av).intoArray(r, i);
4670         }
4671 
4672         assertSelectFromArraysEquals(r, a, order, SPECIES.length());
4673     }
4674 
4675     @Test(dataProvider = "floatUnaryOpSelectFromMaskProvider")
4676     static void SelectFromFloat128VectorTestsMaskedSmokeTest(IntFunction<float[]> fa,
4677                                                            BiFunction<Integer,Integer,float[]> fs,
4678                                                            IntFunction<boolean[]> fm) {
4679         float[] a = fa.apply(SPECIES.length());
4680         float[] order = fs.apply(a.length, SPECIES.length());
4681         float[] r = fr.apply(SPECIES.length());
4682         boolean[] mask = fm.apply(SPECIES.length());
4683         VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
4684 
4685         for (int i = 0; i < a.length; i += SPECIES.length()) {
4686             FloatVector av = FloatVector.fromArray(SPECIES, a, i);
4687             FloatVector bv = FloatVector.fromArray(SPECIES, order, i);
4688             bv.selectFrom(av, vmask).intoArray(r, i);
4689         }
4690 
4691         assertSelectFromArraysEquals(r, a, order, mask, SPECIES.length());
4692     }
4693 
4694     @Test(dataProvider = "shuffleProvider")
4695     static void shuffleMiscellaneousFloat128VectorTestsSmokeTest(BiFunction<Integer,Integer,int[]> fs) {
4696         int[] a = fs.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
4697 
4698         for (int i = 0; i < a.length; i += SPECIES.length()) {
4699             var shuffle = VectorShuffle.fromArray(SPECIES, a, i);
4700             int hash = shuffle.hashCode();
4701             int length = shuffle.length();
4702 
4703             int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
4704             int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr));
4705             Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash);
4706             Assert.assertEquals(length, SPECIES.length());
4707         }
4708     }
4709 
4710     @Test(dataProvider = "shuffleProvider")
4711     static void shuffleToStringFloat128VectorTestsSmokeTest(BiFunction<Integer,Integer,int[]> fs) {
4712         int[] a = fs.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
4713 
4714         for (int i = 0; i < a.length; i += SPECIES.length()) {
4715             var shuffle = VectorShuffle.fromArray(SPECIES, a, i);
4716             String str = shuffle.toString();
4717 
4718             int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
4719             Assert.assertTrue(str.equals("Shuffle" + Arrays.toString(subarr)), "at index " +
4720                 i + ", string should be = " + Arrays.toString(subarr) + ", but is = " + str);
4721         }
4722     }
4723 
4724     @Test(dataProvider = "shuffleCompareOpProvider")
4725     static void shuffleEqualsFloat128VectorTestsSmokeTest(BiFunction<Integer,Integer,int[]> fa, BiFunction<Integer,Integer,int[]> fb) {
4726         int[] a = fa.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
4727         int[] b = fb.apply(SPECIES.length() * BUFFER_REPS, SPECIES.length());
4728 
4729         for (int i = 0; i < a.length; i += SPECIES.length()) {
4730             var av = VectorShuffle.fromArray(SPECIES, a, i);
4731             var bv = VectorShuffle.fromArray(SPECIES, b, i);
4732             boolean eq = av.equals(bv);
4733             int to = i + SPECIES.length();
4734             Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to));
4735         }
4736     }
4737 
4738     @Test(dataProvider = "maskCompareOpProvider")
4739     static void maskEqualsFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
4740         boolean[] a = fa.apply(SPECIES.length());
4741         boolean[] b = fb.apply(SPECIES.length());
4742 
4743         for (int i = 0; i < a.length; i += SPECIES.length()) {
4744             var av = SPECIES.loadMask(a, i);
4745             var bv = SPECIES.loadMask(b, i);
4746             boolean equals = av.equals(bv);
4747             int to = i + SPECIES.length();
4748             Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to));
4749         }
4750     }
4751 
4752     static boolean beq(boolean a, boolean b) {
4753         return (a == b);
4754     }
4755 
4756     @Test(dataProvider = "maskCompareOpProvider")
4757     static void maskEqFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa, IntFunction<boolean[]> fb) {
4758         boolean[] a = fa.apply(SPECIES.length());
4759         boolean[] b = fb.apply(SPECIES.length());
4760         boolean[] r = new boolean[a.length];
4761 
4762         for (int i = 0; i < a.length; i += SPECIES.length()) {
4763             var av = SPECIES.loadMask(a, i);
4764             var bv = SPECIES.loadMask(b, i);
4765             var cv = av.eq(bv);
4766             cv.intoArray(r, i);
4767         }
4768         assertArraysEquals(r, a, b, Float128VectorTests::beq);
4769     }
4770 
4771     @Test(dataProvider = "maskProvider")
4772     static void maskHashCodeFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4773         boolean[] a = fa.apply(SPECIES.length());
4774 
4775         for (int i = 0; i < a.length; i += SPECIES.length()) {
4776             var vmask = SPECIES.loadMask(a, i);
4777             int hash = vmask.hashCode();
4778 
4779             boolean subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length());
4780             int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr));
4781             Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash);
4782         }
4783     }
4784 
4785     static int maskTrueCount(boolean[] a, int idx) {
4786         int trueCount = 0;
4787         for (int i = idx; i < idx + SPECIES.length(); i++) {
4788             trueCount += a[i] ? 1 : 0;
4789         }
4790         return trueCount;
4791     }
4792 
4793     @Test(dataProvider = "maskProvider")
4794     static void maskTrueCountFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4795         boolean[] a = fa.apply(SPECIES.length());
4796         int[] r = new int[a.length];
4797 
4798         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
4799             for (int i = 0; i < a.length; i += SPECIES.length()) {
4800                 var vmask = SPECIES.loadMask(a, i);
4801                 r[i] = vmask.trueCount();
4802             }
4803         }
4804 
4805         assertMaskReductionArraysEquals(r, a, Float128VectorTests::maskTrueCount);
4806     }
4807 
4808     static int maskLastTrue(boolean[] a, int idx) {
4809         int i = idx + SPECIES.length() - 1;
4810         for (; i >= idx; i--) {
4811             if (a[i]) {
4812                 break;
4813             }
4814         }
4815         return i - idx;
4816     }
4817 
4818     @Test(dataProvider = "maskProvider")
4819     static void maskLastTrueFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4820         boolean[] a = fa.apply(SPECIES.length());
4821         int[] r = new int[a.length];
4822 
4823         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
4824             for (int i = 0; i < a.length; i += SPECIES.length()) {
4825                 var vmask = SPECIES.loadMask(a, i);
4826                 r[i] = vmask.lastTrue();
4827             }
4828         }
4829 
4830         assertMaskReductionArraysEquals(r, a, Float128VectorTests::maskLastTrue);
4831     }
4832 
4833     static int maskFirstTrue(boolean[] a, int idx) {
4834         int i = idx;
4835         for (; i < idx + SPECIES.length(); i++) {
4836             if (a[i]) {
4837                 break;
4838             }
4839         }
4840         return i - idx;
4841     }
4842 
4843     @Test(dataProvider = "maskProvider")
4844     static void maskFirstTrueFloat128VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
4845         boolean[] a = fa.apply(SPECIES.length());
4846         int[] r = new int[a.length];
4847 
4848         for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
4849             for (int i = 0; i < a.length; i += SPECIES.length()) {
4850                 var vmask = SPECIES.loadMask(a, i);
4851                 r[i] = vmask.firstTrue();
4852             }
4853         }
4854 
4855         assertMaskReductionArraysEquals(r, a, Float128VectorTests::maskFirstTrue);
4856     }
4857 
4858     @DataProvider
4859     public static Object[][] longMaskProvider() {
4860         return new Object[][]{
4861                 {0xFFFFFFFFFFFFFFFFL},
4862                 {0x0000000000000000L},
4863                 {0x5555555555555555L},
4864                 {0x0123456789abcdefL},
4865         };
4866     }
4867 
4868     @Test(dataProvider = "longMaskProvider")
4869     static void maskFromToLongFloat128VectorTestsSmokeTest(long inputLong) {
4870         var vmask = VectorMask.fromLong(SPECIES, inputLong);
4871         long outputLong = vmask.toLong();
4872         Assert.assertEquals(outputLong, inputLong & (((1L << (SPECIES.length() - 1)) << 1) - 1));
4873     }
4874 
4875     @DataProvider
4876     public static Object[][] offsetProvider() {
4877         return new Object[][]{
4878                 {0},
4879                 {-1},
4880                 {+1},
4881                 {+2},
4882                 {-2},
4883         };
4884     }
4885 
4886     @Test(dataProvider = "offsetProvider")
4887     static void indexInRangeFloat128VectorTestsSmokeTest(int offset) {
4888         int limit = SPECIES.length() * BUFFER_REPS;
4889         for (int i = 0; i < limit; i += SPECIES.length()) {
4890             var actualMask = SPECIES.indexInRange(i + offset, limit);
4891             var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
4892             assert(actualMask.equals(expectedMask));
4893             for (int j = 0; j < SPECIES.length(); j++)  {
4894                 int index = i + j + offset;
4895                 Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
4896             }
4897         }
4898     }
4899 
4900     @DataProvider
4901     public static Object[][] lengthProvider() {
4902         return new Object[][]{
4903                 {0},
4904                 {1},
4905                 {32},
4906                 {37},
4907                 {1024},
4908                 {1024+1},
4909                 {1024+5},
4910         };
4911     }
4912 
4913     @Test(dataProvider = "lengthProvider")
4914     static void loopBoundFloat128VectorTestsSmokeTest(int length) {
4915         int actualLoopBound = SPECIES.loopBound(length);
4916         int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
4917         Assert.assertEquals(actualLoopBound, expectedLoopBound);
4918     }
4919 
4920     @Test
4921     static void ElementSizeFloat128VectorTestsSmokeTest() {
4922         FloatVector av = FloatVector.zero(SPECIES);
4923         int elsize = av.elementSize();
4924         Assert.assertEquals(elsize, Float.SIZE);
4925     }
4926 
4927     @Test
4928     static void VectorShapeFloat128VectorTestsSmokeTest() {
4929         FloatVector av = FloatVector.zero(SPECIES);
4930         VectorShape vsh = av.shape();
4931         assert(vsh.equals(VectorShape.S_128_BIT));
4932     }
4933 
4934     @Test
4935     static void ShapeWithLanesFloat128VectorTestsSmokeTest() {
4936         FloatVector av = FloatVector.zero(SPECIES);
4937         VectorShape vsh = av.shape();
4938         VectorSpecies species = vsh.withLanes(float.class);
4939         assert(species.equals(SPECIES));
4940     }
4941 
4942     @Test
4943     static void ElementTypeFloat128VectorTestsSmokeTest() {
4944         FloatVector av = FloatVector.zero(SPECIES);
4945         assert(av.species().elementType() == float.class);
4946     }
4947 
4948     @Test
4949     static void SpeciesElementSizeFloat128VectorTestsSmokeTest() {
4950         FloatVector av = FloatVector.zero(SPECIES);
4951         assert(av.species().elementSize() == Float.SIZE);
4952     }
4953 
4954     @Test
4955     static void VectorTypeFloat128VectorTestsSmokeTest() {
4956         FloatVector av = FloatVector.zero(SPECIES);
4957         assert(av.species().vectorType() == av.getClass());
4958     }
4959 
4960     @Test
4961     static void WithLanesFloat128VectorTestsSmokeTest() {
4962         FloatVector av = FloatVector.zero(SPECIES);
4963         VectorSpecies species = av.species().withLanes(float.class);
4964         assert(species.equals(SPECIES));
4965     }
4966 
4967     @Test
4968     static void WithShapeFloat128VectorTestsSmokeTest() {
4969         FloatVector av = FloatVector.zero(SPECIES);
4970         VectorShape vsh = av.shape();
4971         VectorSpecies species = av.species().withShape(vsh);
4972         assert(species.equals(SPECIES));
4973     }
4974 }
4975