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