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