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