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