1 /*
   2  * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package org.openjdk.bench.jdk.incubator.vector.operation;
  25 
  26 // -- This file was mechanically generated: Do not edit! -- //
  27 
  28 import jdk.incubator.vector.Vector;
  29 import jdk.incubator.vector.VectorMask;
  30 import jdk.incubator.vector.VectorOperators;
  31 import jdk.incubator.vector.VectorShape;
  32 import jdk.incubator.vector.VectorSpecies;
  33 import jdk.incubator.vector.VectorShuffle;
  34 import jdk.incubator.vector.DoubleVector;
  35 
  36 import java.util.concurrent.TimeUnit;
  37 import java.util.function.BiFunction;
  38 import java.util.function.IntFunction;
  39 
  40 import org.openjdk.jmh.annotations.*;
  41 import org.openjdk.jmh.infra.Blackhole;
  42 
  43 @BenchmarkMode(Mode.Throughput)
  44 @OutputTimeUnit(TimeUnit.MILLISECONDS)
  45 @State(Scope.Benchmark)
  46 @Warmup(iterations = 3, time = 1)
  47 @Measurement(iterations = 5, time = 1)
  48 @Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
  49 public class Double256Vector extends AbstractVectorBenchmark {
  50     static final VectorSpecies<Double> SPECIES = DoubleVector.SPECIES_256;
  51 
  52     static final int INVOC_COUNT = 1; // get rid of outer loop
  53 
  54 
  55     @Param("1024")
  56     int size;
  57 
  58     double[] fill(IntFunction<Double> f) {
  59         double[] array = new double[size];
  60         for (int i = 0; i < array.length; i++) {
  61             array[i] = f.apply(i);
  62         }
  63         return array;
  64     }
  65 
  66     double[] a, b, c, r;
  67     boolean[] m, mt, rm;
  68     int[] s;
  69 
  70     @Setup
  71     public void init() {
  72         size += size % SPECIES.length(); // FIXME: add post-loops
  73 
  74         a = fill(i -> (double)(2*i));
  75         b = fill(i -> (double)(i+1));
  76         c = fill(i -> (double)(i+5));
  77         r = fill(i -> (double)0);
  78 
  79         m = fillMask(size, i -> (i % 2) == 0);
  80         mt = fillMask(size, i -> true);
  81         rm = fillMask(size, i -> false);
  82 
  83         s = fillInt(size, i -> RANDOM.nextInt(SPECIES.length()));
  84     }
  85 
  86     final IntFunction<double[]> fa = vl -> a;
  87     final IntFunction<double[]> fb = vl -> b;
  88     final IntFunction<double[]> fc = vl -> c;
  89     final IntFunction<double[]> fr = vl -> r;
  90     final IntFunction<boolean[]> fm = vl -> m;
  91     final IntFunction<boolean[]> fmt = vl -> mt;
  92     final IntFunction<boolean[]> fmr = vl -> rm;
  93     final BiFunction<Integer,Integer,int[]> fs = (i,j) -> s;
  94 
  95 
  96     @Benchmark
  97     public void ADD(Blackhole bh) {
  98         double[] a = fa.apply(SPECIES.length());
  99         double[] b = fb.apply(SPECIES.length());
 100         double[] r = fr.apply(SPECIES.length());
 101 
 102         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 103             for (int i = 0; i < a.length; i += SPECIES.length()) {
 104                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 105                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 106                 av.lanewise(VectorOperators.ADD, bv).intoArray(r, i);
 107             }
 108         }
 109 
 110         bh.consume(r);
 111     }
 112 
 113     @Benchmark
 114     public void ADDMasked(Blackhole bh) {
 115         double[] a = fa.apply(SPECIES.length());
 116         double[] b = fb.apply(SPECIES.length());
 117         double[] r = fr.apply(SPECIES.length());
 118         boolean[] mask = fm.apply(SPECIES.length());
 119         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 120 
 121         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 122             for (int i = 0; i < a.length; i += SPECIES.length()) {
 123                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 124                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 125                 av.lanewise(VectorOperators.ADD, bv, vmask).intoArray(r, i);
 126             }
 127         }
 128 
 129         bh.consume(r);
 130     }
 131 
 132     @Benchmark
 133     public void SUB(Blackhole bh) {
 134         double[] a = fa.apply(SPECIES.length());
 135         double[] b = fb.apply(SPECIES.length());
 136         double[] r = fr.apply(SPECIES.length());
 137 
 138         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 139             for (int i = 0; i < a.length; i += SPECIES.length()) {
 140                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 141                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 142                 av.lanewise(VectorOperators.SUB, bv).intoArray(r, i);
 143             }
 144         }
 145 
 146         bh.consume(r);
 147     }
 148 
 149     @Benchmark
 150     public void SUBMasked(Blackhole bh) {
 151         double[] a = fa.apply(SPECIES.length());
 152         double[] b = fb.apply(SPECIES.length());
 153         double[] r = fr.apply(SPECIES.length());
 154         boolean[] mask = fm.apply(SPECIES.length());
 155         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 156 
 157         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 158             for (int i = 0; i < a.length; i += SPECIES.length()) {
 159                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 160                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 161                 av.lanewise(VectorOperators.SUB, bv, vmask).intoArray(r, i);
 162             }
 163         }
 164 
 165         bh.consume(r);
 166     }
 167 
 168     @Benchmark
 169     public void MUL(Blackhole bh) {
 170         double[] a = fa.apply(SPECIES.length());
 171         double[] b = fb.apply(SPECIES.length());
 172         double[] r = fr.apply(SPECIES.length());
 173 
 174         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 175             for (int i = 0; i < a.length; i += SPECIES.length()) {
 176                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 177                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 178                 av.lanewise(VectorOperators.MUL, bv).intoArray(r, i);
 179             }
 180         }
 181 
 182         bh.consume(r);
 183     }
 184 
 185     @Benchmark
 186     public void MULMasked(Blackhole bh) {
 187         double[] a = fa.apply(SPECIES.length());
 188         double[] b = fb.apply(SPECIES.length());
 189         double[] r = fr.apply(SPECIES.length());
 190         boolean[] mask = fm.apply(SPECIES.length());
 191         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 192 
 193         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 194             for (int i = 0; i < a.length; i += SPECIES.length()) {
 195                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 196                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 197                 av.lanewise(VectorOperators.MUL, bv, vmask).intoArray(r, i);
 198             }
 199         }
 200 
 201         bh.consume(r);
 202     }
 203 
 204 
 205     @Benchmark
 206     public void DIV(Blackhole bh) {
 207         double[] a = fa.apply(SPECIES.length());
 208         double[] b = fb.apply(SPECIES.length());
 209         double[] r = fr.apply(SPECIES.length());
 210 
 211         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 212             for (int i = 0; i < a.length; i += SPECIES.length()) {
 213                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 214                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 215                 av.lanewise(VectorOperators.DIV, bv).intoArray(r, i);
 216             }
 217         }
 218 
 219         bh.consume(r);
 220     }
 221 
 222 
 223 
 224     @Benchmark
 225     public void DIVMasked(Blackhole bh) {
 226         double[] a = fa.apply(SPECIES.length());
 227         double[] b = fb.apply(SPECIES.length());
 228         double[] r = fr.apply(SPECIES.length());
 229         boolean[] mask = fm.apply(SPECIES.length());
 230         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 231 
 232         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 233             for (int i = 0; i < a.length; i += SPECIES.length()) {
 234                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 235                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 236                 av.lanewise(VectorOperators.DIV, bv, vmask).intoArray(r, i);
 237             }
 238         }
 239 
 240         bh.consume(r);
 241     }
 242 
 243 
 244 
 245 
 246     @Benchmark
 247     public void FIRST_NONZERO(Blackhole bh) {
 248         double[] a = fa.apply(SPECIES.length());
 249         double[] b = fb.apply(SPECIES.length());
 250         double[] r = fr.apply(SPECIES.length());
 251 
 252         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 253             for (int i = 0; i < a.length; i += SPECIES.length()) {
 254                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 255                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 256                 av.lanewise(VectorOperators.FIRST_NONZERO, bv).intoArray(r, i);
 257             }
 258         }
 259 
 260         bh.consume(r);
 261     }
 262 
 263     @Benchmark
 264     public void FIRST_NONZEROMasked(Blackhole bh) {
 265         double[] a = fa.apply(SPECIES.length());
 266         double[] b = fb.apply(SPECIES.length());
 267         double[] r = fr.apply(SPECIES.length());
 268         boolean[] mask = fm.apply(SPECIES.length());
 269         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 270 
 271         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 272             for (int i = 0; i < a.length; i += SPECIES.length()) {
 273                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 274                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 275                 av.lanewise(VectorOperators.FIRST_NONZERO, bv, vmask).intoArray(r, i);
 276             }
 277         }
 278 
 279         bh.consume(r);
 280     }
 281 
 282 
 283 
 284 
 285 
 286 
 287 
 288 
 289 
 290 
 291 
 292 
 293 
 294 
 295 
 296 
 297 
 298 
 299 
 300 
 301 
 302 
 303 
 304 
 305 
 306 
 307 
 308 
 309 
 310 
 311 
 312 
 313 
 314 
 315 
 316 
 317 
 318 
 319 
 320 
 321 
 322 
 323 
 324 
 325 
 326 
 327 
 328 
 329 
 330 
 331 
 332 
 333 
 334     @Benchmark
 335     public void MIN(Blackhole bh) {
 336         double[] a = fa.apply(SPECIES.length());
 337         double[] b = fb.apply(SPECIES.length());
 338         double[] r = fr.apply(SPECIES.length());
 339 
 340         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 341             for (int i = 0; i < a.length; i += SPECIES.length()) {
 342                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 343                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 344                 av.lanewise(VectorOperators.MIN, bv).intoArray(r, i);
 345             }
 346         }
 347 
 348         bh.consume(r);
 349     }
 350 
 351     @Benchmark
 352     public void MAX(Blackhole bh) {
 353         double[] a = fa.apply(SPECIES.length());
 354         double[] b = fb.apply(SPECIES.length());
 355         double[] r = fr.apply(SPECIES.length());
 356 
 357         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 358             for (int i = 0; i < a.length; i += SPECIES.length()) {
 359                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 360                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 361                 av.lanewise(VectorOperators.MAX, bv).intoArray(r, i);
 362             }
 363         }
 364 
 365         bh.consume(r);
 366     }
 367 
 368 
 369 
 370 
 371 
 372 
 373 
 374     @Benchmark
 375     public void ADDLanes(Blackhole bh) {
 376         double[] a = fa.apply(SPECIES.length());
 377         double ra = 0;
 378 
 379         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 380             ra = 0;
 381             for (int i = 0; i < a.length; i += SPECIES.length()) {
 382                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 383                 ra += av.reduceLanes(VectorOperators.ADD);
 384             }
 385         }
 386         bh.consume(ra);
 387     }
 388 
 389     @Benchmark
 390     public void ADDMaskedLanes(Blackhole bh) {
 391         double[] a = fa.apply(SPECIES.length());
 392         boolean[] mask = fm.apply(SPECIES.length());
 393         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 394         double ra = 0;
 395 
 396         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 397             ra = 0;
 398             for (int i = 0; i < a.length; i += SPECIES.length()) {
 399                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 400                 ra += av.reduceLanes(VectorOperators.ADD, vmask);
 401             }
 402         }
 403         bh.consume(ra);
 404     }
 405 
 406     @Benchmark
 407     public void MULLanes(Blackhole bh) {
 408         double[] a = fa.apply(SPECIES.length());
 409         double ra = 1;
 410 
 411         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 412             ra = 1;
 413             for (int i = 0; i < a.length; i += SPECIES.length()) {
 414                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 415                 ra *= av.reduceLanes(VectorOperators.MUL);
 416             }
 417         }
 418         bh.consume(ra);
 419     }
 420 
 421     @Benchmark
 422     public void MULMaskedLanes(Blackhole bh) {
 423         double[] a = fa.apply(SPECIES.length());
 424         boolean[] mask = fm.apply(SPECIES.length());
 425         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 426         double ra = 1;
 427 
 428         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 429             ra = 1;
 430             for (int i = 0; i < a.length; i += SPECIES.length()) {
 431                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 432                 ra *= av.reduceLanes(VectorOperators.MUL, vmask);
 433             }
 434         }
 435         bh.consume(ra);
 436     }
 437 
 438     @Benchmark
 439     public void MINLanes(Blackhole bh) {
 440         double[] a = fa.apply(SPECIES.length());
 441         double ra = Double.POSITIVE_INFINITY;
 442 
 443         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 444             ra = Double.POSITIVE_INFINITY;
 445             for (int i = 0; i < a.length; i += SPECIES.length()) {
 446                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 447                 ra = (double)Math.min(ra, av.reduceLanes(VectorOperators.MIN));
 448             }
 449         }
 450         bh.consume(ra);
 451     }
 452 
 453     @Benchmark
 454     public void MINMaskedLanes(Blackhole bh) {
 455         double[] a = fa.apply(SPECIES.length());
 456         boolean[] mask = fm.apply(SPECIES.length());
 457         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 458         double ra = Double.POSITIVE_INFINITY;
 459 
 460         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 461             ra = Double.POSITIVE_INFINITY;
 462             for (int i = 0; i < a.length; i += SPECIES.length()) {
 463                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 464                 ra = (double)Math.min(ra, av.reduceLanes(VectorOperators.MIN, vmask));
 465             }
 466         }
 467         bh.consume(ra);
 468     }
 469 
 470     @Benchmark
 471     public void MAXLanes(Blackhole bh) {
 472         double[] a = fa.apply(SPECIES.length());
 473         double ra = Double.NEGATIVE_INFINITY;
 474 
 475         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 476             ra = Double.NEGATIVE_INFINITY;
 477             for (int i = 0; i < a.length; i += SPECIES.length()) {
 478                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 479                 ra = (double)Math.max(ra, av.reduceLanes(VectorOperators.MAX));
 480             }
 481         }
 482         bh.consume(ra);
 483     }
 484 
 485     @Benchmark
 486     public void MAXMaskedLanes(Blackhole bh) {
 487         double[] a = fa.apply(SPECIES.length());
 488         boolean[] mask = fm.apply(SPECIES.length());
 489         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 490         double ra = Double.NEGATIVE_INFINITY;
 491 
 492         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 493             ra = Double.NEGATIVE_INFINITY;
 494             for (int i = 0; i < a.length; i += SPECIES.length()) {
 495                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 496                 ra = (double)Math.max(ra, av.reduceLanes(VectorOperators.MAX, vmask));
 497             }
 498         }
 499         bh.consume(ra);
 500     }
 501 
 502 
 503 
 504     @Benchmark
 505     public void withLane(Blackhole bh) {
 506         double[] a = fa.apply(SPECIES.length());
 507         double[] r = fr.apply(SPECIES.length());
 508 
 509         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 510             for (int i = 0; i < a.length; i += SPECIES.length()) {
 511                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 512                 av.withLane(0, (double)4).intoArray(r, i);
 513             }
 514         }
 515 
 516         bh.consume(r);
 517     }
 518 
 519     @Benchmark
 520     public Object IS_DEFAULT() {
 521         double[] a = fa.apply(size);
 522         boolean[] ms = fmt.apply(size);
 523         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 524 
 525         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 526             for (int i = 0; i < a.length; i += SPECIES.length()) {
 527                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 528 
 529                 // accumulate results, so JIT can't eliminate relevant computations
 530                 m = m.and(av.test(VectorOperators.IS_DEFAULT));
 531             }
 532         }
 533 
 534         return m;
 535     }
 536 
 537     @Benchmark
 538     public Object IS_NEGATIVE() {
 539         double[] a = fa.apply(size);
 540         boolean[] ms = fmt.apply(size);
 541         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 542 
 543         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 544             for (int i = 0; i < a.length; i += SPECIES.length()) {
 545                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 546 
 547                 // accumulate results, so JIT can't eliminate relevant computations
 548                 m = m.and(av.test(VectorOperators.IS_NEGATIVE));
 549             }
 550         }
 551 
 552         return m;
 553     }
 554 
 555 
 556     @Benchmark
 557     public Object IS_FINITE() {
 558         double[] a = fa.apply(size);
 559         boolean[] ms = fmt.apply(size);
 560         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 561 
 562         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 563             for (int i = 0; i < a.length; i += SPECIES.length()) {
 564                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 565 
 566                 // accumulate results, so JIT can't eliminate relevant computations
 567                 m = m.and(av.test(VectorOperators.IS_FINITE));
 568             }
 569         }
 570 
 571         return m;
 572     }
 573 
 574 
 575 
 576     @Benchmark
 577     public Object IS_NAN() {
 578         double[] a = fa.apply(size);
 579         boolean[] ms = fmt.apply(size);
 580         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 581 
 582         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 583             for (int i = 0; i < a.length; i += SPECIES.length()) {
 584                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 585 
 586                 // accumulate results, so JIT can't eliminate relevant computations
 587                 m = m.and(av.test(VectorOperators.IS_NAN));
 588             }
 589         }
 590 
 591         return m;
 592     }
 593 
 594 
 595 
 596     @Benchmark
 597     public Object IS_INFINITE() {
 598         double[] a = fa.apply(size);
 599         boolean[] ms = fmt.apply(size);
 600         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 601 
 602         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 603             for (int i = 0; i < a.length; i += SPECIES.length()) {
 604                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 605 
 606                 // accumulate results, so JIT can't eliminate relevant computations
 607                 m = m.and(av.test(VectorOperators.IS_INFINITE));
 608             }
 609         }
 610 
 611         return m;
 612     }
 613 
 614 
 615     @Benchmark
 616     public Object LT() {
 617         double[] a = fa.apply(size);
 618         double[] b = fb.apply(size);
 619         boolean[] ms = fmt.apply(size);
 620         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 621 
 622         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 623             for (int i = 0; i < a.length; i += SPECIES.length()) {
 624                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 625                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 626 
 627                 // accumulate results, so JIT can't eliminate relevant computations
 628                 m = m.and(av.compare(VectorOperators.LT, bv));
 629             }
 630         }
 631 
 632         return m;
 633     }
 634 
 635     @Benchmark
 636     public Object GT() {
 637         double[] a = fa.apply(size);
 638         double[] b = fb.apply(size);
 639         boolean[] ms = fmt.apply(size);
 640         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 641 
 642         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 643             for (int i = 0; i < a.length; i += SPECIES.length()) {
 644                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 645                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 646 
 647                 // accumulate results, so JIT can't eliminate relevant computations
 648                 m = m.and(av.compare(VectorOperators.GT, bv));
 649             }
 650         }
 651 
 652         return m;
 653     }
 654 
 655     @Benchmark
 656     public Object EQ() {
 657         double[] a = fa.apply(size);
 658         double[] b = fb.apply(size);
 659         boolean[] ms = fmt.apply(size);
 660         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 661 
 662         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 663             for (int i = 0; i < a.length; i += SPECIES.length()) {
 664                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 665                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 666 
 667                 // accumulate results, so JIT can't eliminate relevant computations
 668                 m = m.and(av.compare(VectorOperators.EQ, bv));
 669             }
 670         }
 671 
 672         return m;
 673     }
 674 
 675     @Benchmark
 676     public Object NE() {
 677         double[] a = fa.apply(size);
 678         double[] b = fb.apply(size);
 679         boolean[] ms = fmt.apply(size);
 680         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 681 
 682         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 683             for (int i = 0; i < a.length; i += SPECIES.length()) {
 684                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 685                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 686 
 687                 // accumulate results, so JIT can't eliminate relevant computations
 688                 m = m.and(av.compare(VectorOperators.NE, bv));
 689             }
 690         }
 691 
 692         return m;
 693     }
 694 
 695     @Benchmark
 696     public Object LE() {
 697         double[] a = fa.apply(size);
 698         double[] b = fb.apply(size);
 699         boolean[] ms = fmt.apply(size);
 700         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 701 
 702         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 703             for (int i = 0; i < a.length; i += SPECIES.length()) {
 704                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 705                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 706 
 707                 // accumulate results, so JIT can't eliminate relevant computations
 708                 m = m.and(av.compare(VectorOperators.LE, bv));
 709             }
 710         }
 711 
 712         return m;
 713     }
 714 
 715     @Benchmark
 716     public Object GE() {
 717         double[] a = fa.apply(size);
 718         double[] b = fb.apply(size);
 719         boolean[] ms = fmt.apply(size);
 720         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 721 
 722         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 723             for (int i = 0; i < a.length; i += SPECIES.length()) {
 724                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 725                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 726 
 727                 // accumulate results, so JIT can't eliminate relevant computations
 728                 m = m.and(av.compare(VectorOperators.GE, bv));
 729             }
 730         }
 731 
 732         return m;
 733     }
 734 
 735 
 736 
 737 
 738 
 739     @Benchmark
 740     public void blend(Blackhole bh) {
 741         double[] a = fa.apply(SPECIES.length());
 742         double[] b = fb.apply(SPECIES.length());
 743         double[] r = fr.apply(SPECIES.length());
 744         boolean[] mask = fm.apply(SPECIES.length());
 745         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
 746 
 747         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 748             for (int i = 0; i < a.length; i += SPECIES.length()) {
 749                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 750                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
 751                 av.blend(bv, vmask).intoArray(r, i);
 752             }
 753         }
 754 
 755         bh.consume(r);
 756     }
 757 
 758     @Benchmark
 759     public void rearrange(Blackhole bh) {
 760         double[] a = fa.apply(SPECIES.length());
 761         int[] order = fs.apply(a.length, SPECIES.length());
 762         double[] r = fr.apply(SPECIES.length());
 763 
 764         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 765             for (int i = 0; i < a.length; i += SPECIES.length()) {
 766                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 767                 av.rearrange(VectorShuffle.fromArray(SPECIES, order, i)).intoArray(r, i);
 768             }
 769         }
 770 
 771         bh.consume(r);
 772     }
 773 
 774     @Benchmark
 775     public Object compress() {
 776         double[] a = fa.apply(size);
 777         double[] r = fb.apply(size);
 778         boolean[] ms = fmt.apply(size);
 779         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 780 
 781         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 782             for (int i = 0; i < a.length; i += SPECIES.length()) {
 783                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 784                 av.compress(m).intoArray(r, i);
 785             }
 786         }
 787 
 788         return r;
 789     }
 790 
 791     @Benchmark
 792     public Object expand() {
 793         double[] a = fa.apply(size);
 794         double[] r = fb.apply(size);
 795         boolean[] ms = fmt.apply(size);
 796         VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, 0);
 797 
 798         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 799             for (int i = 0; i < a.length; i += SPECIES.length()) {
 800                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 801                 av.expand(m).intoArray(r, i);
 802             }
 803         }
 804 
 805         return r;
 806     }
 807 
 808     @Benchmark
 809     public Object maskCompress() {
 810         boolean[] ms = fmt.apply(size);
 811         boolean[] rs = fmt.apply(size);
 812 
 813         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 814             for (int i = 0, j = 0; i < ms.length; i += SPECIES.length()) {
 815                 VectorMask<Double> m = VectorMask.fromArray(SPECIES, ms, i);
 816                 m.compress().intoArray(rs, j);
 817                 j += m.trueCount();
 818             }
 819         }
 820 
 821         return rs;
 822     }
 823 
 824 
 825     @Benchmark
 826     public void laneextract(Blackhole bh) {
 827         double[] a = fa.apply(SPECIES.length());
 828         double[] r = fr.apply(SPECIES.length());
 829 
 830         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 831             for (int i = 0; i < a.length; i += SPECIES.length()) {
 832                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
 833                 int num_lanes = SPECIES.length();
 834                 // Manually unroll because full unroll happens after intrinsification.
 835                 // Unroll is needed because get intrinsic requires for index to be a known constant.
 836                 if (num_lanes == 1) {
 837                     r[i]=av.lane(0);
 838                 } else if (num_lanes == 2) {
 839                     r[i]=av.lane(0);
 840                     r[i+1]=av.lane(1);
 841                 } else if (num_lanes == 4) {
 842                     r[i]=av.lane(0);
 843                     r[i+1]=av.lane(1);
 844                     r[i+2]=av.lane(2);
 845                     r[i+3]=av.lane(3);
 846                 } else if (num_lanes == 8) {
 847                     r[i]=av.lane(0);
 848                     r[i+1]=av.lane(1);
 849                     r[i+2]=av.lane(2);
 850                     r[i+3]=av.lane(3);
 851                     r[i+4]=av.lane(4);
 852                     r[i+5]=av.lane(5);
 853                     r[i+6]=av.lane(6);
 854                     r[i+7]=av.lane(7);
 855                 } else if (num_lanes == 16) {
 856                     r[i]=av.lane(0);
 857                     r[i+1]=av.lane(1);
 858                     r[i+2]=av.lane(2);
 859                     r[i+3]=av.lane(3);
 860                     r[i+4]=av.lane(4);
 861                     r[i+5]=av.lane(5);
 862                     r[i+6]=av.lane(6);
 863                     r[i+7]=av.lane(7);
 864                     r[i+8]=av.lane(8);
 865                     r[i+9]=av.lane(9);
 866                     r[i+10]=av.lane(10);
 867                     r[i+11]=av.lane(11);
 868                     r[i+12]=av.lane(12);
 869                     r[i+13]=av.lane(13);
 870                     r[i+14]=av.lane(14);
 871                     r[i+15]=av.lane(15);
 872                 } else if (num_lanes == 32) {
 873                     r[i]=av.lane(0);
 874                     r[i+1]=av.lane(1);
 875                     r[i+2]=av.lane(2);
 876                     r[i+3]=av.lane(3);
 877                     r[i+4]=av.lane(4);
 878                     r[i+5]=av.lane(5);
 879                     r[i+6]=av.lane(6);
 880                     r[i+7]=av.lane(7);
 881                     r[i+8]=av.lane(8);
 882                     r[i+9]=av.lane(9);
 883                     r[i+10]=av.lane(10);
 884                     r[i+11]=av.lane(11);
 885                     r[i+12]=av.lane(12);
 886                     r[i+13]=av.lane(13);
 887                     r[i+14]=av.lane(14);
 888                     r[i+15]=av.lane(15);
 889                     r[i+16]=av.lane(16);
 890                     r[i+17]=av.lane(17);
 891                     r[i+18]=av.lane(18);
 892                     r[i+19]=av.lane(19);
 893                     r[i+20]=av.lane(20);
 894                     r[i+21]=av.lane(21);
 895                     r[i+22]=av.lane(22);
 896                     r[i+23]=av.lane(23);
 897                     r[i+24]=av.lane(24);
 898                     r[i+25]=av.lane(25);
 899                     r[i+26]=av.lane(26);
 900                     r[i+27]=av.lane(27);
 901                     r[i+28]=av.lane(28);
 902                     r[i+29]=av.lane(29);
 903                     r[i+30]=av.lane(30);
 904                     r[i+31]=av.lane(31);
 905                 } else if (num_lanes == 64) {
 906                     r[i]=av.lane(0);
 907                     r[i+1]=av.lane(1);
 908                     r[i+2]=av.lane(2);
 909                     r[i+3]=av.lane(3);
 910                     r[i+4]=av.lane(4);
 911                     r[i+5]=av.lane(5);
 912                     r[i+6]=av.lane(6);
 913                     r[i+7]=av.lane(7);
 914                     r[i+8]=av.lane(8);
 915                     r[i+9]=av.lane(9);
 916                     r[i+10]=av.lane(10);
 917                     r[i+11]=av.lane(11);
 918                     r[i+12]=av.lane(12);
 919                     r[i+13]=av.lane(13);
 920                     r[i+14]=av.lane(14);
 921                     r[i+15]=av.lane(15);
 922                     r[i+16]=av.lane(16);
 923                     r[i+17]=av.lane(17);
 924                     r[i+18]=av.lane(18);
 925                     r[i+19]=av.lane(19);
 926                     r[i+20]=av.lane(20);
 927                     r[i+21]=av.lane(21);
 928                     r[i+22]=av.lane(22);
 929                     r[i+23]=av.lane(23);
 930                     r[i+24]=av.lane(24);
 931                     r[i+25]=av.lane(25);
 932                     r[i+26]=av.lane(26);
 933                     r[i+27]=av.lane(27);
 934                     r[i+28]=av.lane(28);
 935                     r[i+29]=av.lane(29);
 936                     r[i+30]=av.lane(30);
 937                     r[i+31]=av.lane(31);
 938                     r[i+32]=av.lane(32);
 939                     r[i+33]=av.lane(33);
 940                     r[i+34]=av.lane(34);
 941                     r[i+35]=av.lane(35);
 942                     r[i+36]=av.lane(36);
 943                     r[i+37]=av.lane(37);
 944                     r[i+38]=av.lane(38);
 945                     r[i+39]=av.lane(39);
 946                     r[i+40]=av.lane(40);
 947                     r[i+41]=av.lane(41);
 948                     r[i+42]=av.lane(42);
 949                     r[i+43]=av.lane(43);
 950                     r[i+44]=av.lane(44);
 951                     r[i+45]=av.lane(45);
 952                     r[i+46]=av.lane(46);
 953                     r[i+47]=av.lane(47);
 954                     r[i+48]=av.lane(48);
 955                     r[i+49]=av.lane(49);
 956                     r[i+50]=av.lane(50);
 957                     r[i+51]=av.lane(51);
 958                     r[i+52]=av.lane(52);
 959                     r[i+53]=av.lane(53);
 960                     r[i+54]=av.lane(54);
 961                     r[i+55]=av.lane(55);
 962                     r[i+56]=av.lane(56);
 963                     r[i+57]=av.lane(57);
 964                     r[i+58]=av.lane(58);
 965                     r[i+59]=av.lane(59);
 966                     r[i+60]=av.lane(60);
 967                     r[i+61]=av.lane(61);
 968                     r[i+62]=av.lane(62);
 969                     r[i+63]=av.lane(63);
 970                 } else {
 971                     for (int j = 0; j < SPECIES.length(); j++) {
 972                         r[i+j]=av.lane(j);
 973                     }
 974                 }
 975             }
 976         }
 977 
 978         bh.consume(r);
 979     }
 980 
 981     @Benchmark
 982     public void broadcast(Blackhole bh) {
 983         double[] a = fa.apply(SPECIES.length());
 984         double[] r = new double[a.length];
 985 
 986         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 987             for (int i = 0; i < a.length; i += SPECIES.length()) {
 988                 DoubleVector.broadcast(SPECIES, a[i]).intoArray(r, i);
 989             }
 990         }
 991 
 992         bh.consume(r);
 993     }
 994 
 995     @Benchmark
 996     public void zero(Blackhole bh) {
 997         double[] a = fa.apply(SPECIES.length());
 998         double[] r = new double[a.length];
 999 
1000         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1001             for (int i = 0; i < a.length; i += SPECIES.length()) {
1002                 DoubleVector.zero(SPECIES).intoArray(a, i);
1003             }
1004         }
1005 
1006         bh.consume(r);
1007     }
1008 
1009     @Benchmark
1010     public void sliceUnary(Blackhole bh) {
1011         double[] a = fa.apply(SPECIES.length());
1012         double[] r = new double[a.length];
1013         int origin = (new java.util.Random()).nextInt(SPECIES.length());
1014         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1015             for (int i = 0; i < a.length; i += SPECIES.length()) {
1016                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1017                 av.slice(origin).intoArray(r, i);
1018             }
1019         }
1020 
1021         bh.consume(r);
1022     }
1023 
1024     @Benchmark
1025     public void sliceBinary(Blackhole bh) {
1026         double[] a = fa.apply(SPECIES.length());
1027         double[] b = fb.apply(SPECIES.length());
1028         double[] r = new double[a.length];
1029         int origin = (new java.util.Random()).nextInt(SPECIES.length());
1030         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1031             for (int i = 0; i < a.length; i += SPECIES.length()) {
1032                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1033                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1034                 av.slice(origin, bv).intoArray(r, i);
1035             }
1036         }
1037 
1038         bh.consume(r);
1039     }
1040 
1041     @Benchmark
1042     public void sliceMasked(Blackhole bh) {
1043         double[] a = fa.apply(SPECIES.length());
1044         double[] b = fb.apply(SPECIES.length());
1045         boolean[] mask = fm.apply(SPECIES.length());
1046         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1047 
1048         double[] r = new double[a.length];
1049         int origin = (new java.util.Random()).nextInt(SPECIES.length());
1050         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1051             for (int i = 0; i < a.length; i += SPECIES.length()) {
1052                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1053                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1054                 av.slice(origin, bv, vmask).intoArray(r, i);
1055             }
1056         }
1057 
1058         bh.consume(r);
1059     }
1060 
1061     @Benchmark
1062     public void unsliceUnary(Blackhole bh) {
1063         double[] a = fa.apply(SPECIES.length());
1064         double[] r = new double[a.length];
1065         int origin = (new java.util.Random()).nextInt(SPECIES.length());
1066         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1067             for (int i = 0; i < a.length; i += SPECIES.length()) {
1068                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1069                 av.unslice(origin).intoArray(r, i);
1070             }
1071         }
1072 
1073         bh.consume(r);
1074     }
1075 
1076     @Benchmark
1077     public void unsliceBinary(Blackhole bh) {
1078         double[] a = fa.apply(SPECIES.length());
1079         double[] b = fb.apply(SPECIES.length());
1080         double[] r = new double[a.length];
1081         int origin = (new java.util.Random()).nextInt(SPECIES.length());
1082         int part = (new java.util.Random()).nextInt(2);
1083         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1084             for (int i = 0; i < a.length; i += SPECIES.length()) {
1085                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1086                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1087                 av.unslice(origin, bv, part).intoArray(r, i);
1088             }
1089         }
1090 
1091         bh.consume(r);
1092     }
1093 
1094     @Benchmark
1095     public void unsliceMasked(Blackhole bh) {
1096         double[] a = fa.apply(SPECIES.length());
1097         double[] b = fb.apply(SPECIES.length());
1098         boolean[] mask = fm.apply(SPECIES.length());
1099         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1100         double[] r = new double[a.length];
1101         int origin = (new java.util.Random()).nextInt(SPECIES.length());
1102         int part = (new java.util.Random()).nextInt(2);
1103         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1104             for (int i = 0; i < a.length; i += SPECIES.length()) {
1105                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1106                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1107                 av.unslice(origin, bv, part, vmask).intoArray(r, i);
1108             }
1109         }
1110 
1111         bh.consume(r);
1112     }
1113 
1114 
1115     @Benchmark
1116     public void SIN(Blackhole bh) {
1117         double[] a = fa.apply(SPECIES.length());
1118         double[] r = fr.apply(SPECIES.length());
1119 
1120         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1121             for (int i = 0; i < a.length; i += SPECIES.length()) {
1122                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1123                 av.lanewise(VectorOperators.SIN).intoArray(r, i);
1124             }
1125         }
1126 
1127         bh.consume(r);
1128     }
1129 
1130 
1131 
1132     @Benchmark
1133     public void EXP(Blackhole bh) {
1134         double[] a = fa.apply(SPECIES.length());
1135         double[] r = fr.apply(SPECIES.length());
1136 
1137         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1138             for (int i = 0; i < a.length; i += SPECIES.length()) {
1139                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1140                 av.lanewise(VectorOperators.EXP).intoArray(r, i);
1141             }
1142         }
1143 
1144         bh.consume(r);
1145     }
1146 
1147 
1148 
1149     @Benchmark
1150     public void LOG1P(Blackhole bh) {
1151         double[] a = fa.apply(SPECIES.length());
1152         double[] r = fr.apply(SPECIES.length());
1153 
1154         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1155             for (int i = 0; i < a.length; i += SPECIES.length()) {
1156                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1157                 av.lanewise(VectorOperators.LOG1P).intoArray(r, i);
1158             }
1159         }
1160 
1161         bh.consume(r);
1162     }
1163 
1164 
1165 
1166     @Benchmark
1167     public void LOG(Blackhole bh) {
1168         double[] a = fa.apply(SPECIES.length());
1169         double[] r = fr.apply(SPECIES.length());
1170 
1171         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1172             for (int i = 0; i < a.length; i += SPECIES.length()) {
1173                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1174                 av.lanewise(VectorOperators.LOG).intoArray(r, i);
1175             }
1176         }
1177 
1178         bh.consume(r);
1179     }
1180 
1181 
1182 
1183     @Benchmark
1184     public void LOG10(Blackhole bh) {
1185         double[] a = fa.apply(SPECIES.length());
1186         double[] r = fr.apply(SPECIES.length());
1187 
1188         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1189             for (int i = 0; i < a.length; i += SPECIES.length()) {
1190                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1191                 av.lanewise(VectorOperators.LOG10).intoArray(r, i);
1192             }
1193         }
1194 
1195         bh.consume(r);
1196     }
1197 
1198 
1199 
1200     @Benchmark
1201     public void EXPM1(Blackhole bh) {
1202         double[] a = fa.apply(SPECIES.length());
1203         double[] r = fr.apply(SPECIES.length());
1204 
1205         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1206             for (int i = 0; i < a.length; i += SPECIES.length()) {
1207                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1208                 av.lanewise(VectorOperators.EXPM1).intoArray(r, i);
1209             }
1210         }
1211 
1212         bh.consume(r);
1213     }
1214 
1215 
1216 
1217     @Benchmark
1218     public void COS(Blackhole bh) {
1219         double[] a = fa.apply(SPECIES.length());
1220         double[] r = fr.apply(SPECIES.length());
1221 
1222         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1223             for (int i = 0; i < a.length; i += SPECIES.length()) {
1224                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1225                 av.lanewise(VectorOperators.COS).intoArray(r, i);
1226             }
1227         }
1228 
1229         bh.consume(r);
1230     }
1231 
1232 
1233 
1234     @Benchmark
1235     public void TAN(Blackhole bh) {
1236         double[] a = fa.apply(SPECIES.length());
1237         double[] r = fr.apply(SPECIES.length());
1238 
1239         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1240             for (int i = 0; i < a.length; i += SPECIES.length()) {
1241                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1242                 av.lanewise(VectorOperators.TAN).intoArray(r, i);
1243             }
1244         }
1245 
1246         bh.consume(r);
1247     }
1248 
1249 
1250 
1251     @Benchmark
1252     public void SINH(Blackhole bh) {
1253         double[] a = fa.apply(SPECIES.length());
1254         double[] r = fr.apply(SPECIES.length());
1255 
1256         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1257             for (int i = 0; i < a.length; i += SPECIES.length()) {
1258                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1259                 av.lanewise(VectorOperators.SINH).intoArray(r, i);
1260             }
1261         }
1262 
1263         bh.consume(r);
1264     }
1265 
1266 
1267 
1268     @Benchmark
1269     public void COSH(Blackhole bh) {
1270         double[] a = fa.apply(SPECIES.length());
1271         double[] r = fr.apply(SPECIES.length());
1272 
1273         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1274             for (int i = 0; i < a.length; i += SPECIES.length()) {
1275                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1276                 av.lanewise(VectorOperators.COSH).intoArray(r, i);
1277             }
1278         }
1279 
1280         bh.consume(r);
1281     }
1282 
1283 
1284 
1285     @Benchmark
1286     public void TANH(Blackhole bh) {
1287         double[] a = fa.apply(SPECIES.length());
1288         double[] r = fr.apply(SPECIES.length());
1289 
1290         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1291             for (int i = 0; i < a.length; i += SPECIES.length()) {
1292                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1293                 av.lanewise(VectorOperators.TANH).intoArray(r, i);
1294             }
1295         }
1296 
1297         bh.consume(r);
1298     }
1299 
1300 
1301 
1302     @Benchmark
1303     public void ASIN(Blackhole bh) {
1304         double[] a = fa.apply(SPECIES.length());
1305         double[] r = fr.apply(SPECIES.length());
1306 
1307         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1308             for (int i = 0; i < a.length; i += SPECIES.length()) {
1309                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1310                 av.lanewise(VectorOperators.ASIN).intoArray(r, i);
1311             }
1312         }
1313 
1314         bh.consume(r);
1315     }
1316 
1317 
1318 
1319     @Benchmark
1320     public void ACOS(Blackhole bh) {
1321         double[] a = fa.apply(SPECIES.length());
1322         double[] r = fr.apply(SPECIES.length());
1323 
1324         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1325             for (int i = 0; i < a.length; i += SPECIES.length()) {
1326                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1327                 av.lanewise(VectorOperators.ACOS).intoArray(r, i);
1328             }
1329         }
1330 
1331         bh.consume(r);
1332     }
1333 
1334 
1335 
1336     @Benchmark
1337     public void ATAN(Blackhole bh) {
1338         double[] a = fa.apply(SPECIES.length());
1339         double[] r = fr.apply(SPECIES.length());
1340 
1341         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1342             for (int i = 0; i < a.length; i += SPECIES.length()) {
1343                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1344                 av.lanewise(VectorOperators.ATAN).intoArray(r, i);
1345             }
1346         }
1347 
1348         bh.consume(r);
1349     }
1350 
1351 
1352 
1353     @Benchmark
1354     public void CBRT(Blackhole bh) {
1355         double[] a = fa.apply(SPECIES.length());
1356         double[] r = fr.apply(SPECIES.length());
1357 
1358         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1359             for (int i = 0; i < a.length; i += SPECIES.length()) {
1360                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1361                 av.lanewise(VectorOperators.CBRT).intoArray(r, i);
1362             }
1363         }
1364 
1365         bh.consume(r);
1366     }
1367 
1368 
1369 
1370     @Benchmark
1371     public void HYPOT(Blackhole bh) {
1372         double[] a = fa.apply(SPECIES.length());
1373         double[] b = fb.apply(SPECIES.length());
1374         double[] r = fr.apply(SPECIES.length());
1375 
1376         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1377             for (int i = 0; i < a.length; i += SPECIES.length()) {
1378                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1379                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1380                 av.lanewise(VectorOperators.HYPOT, bv).intoArray(r, i);
1381             }
1382         }
1383 
1384         bh.consume(r);
1385     }
1386 
1387 
1388 
1389     @Benchmark
1390     public void POW(Blackhole bh) {
1391         double[] a = fa.apply(SPECIES.length());
1392         double[] b = fb.apply(SPECIES.length());
1393         double[] r = fr.apply(SPECIES.length());
1394 
1395         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1396             for (int i = 0; i < a.length; i += SPECIES.length()) {
1397                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1398                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1399                 av.lanewise(VectorOperators.POW, bv).intoArray(r, i);
1400             }
1401         }
1402 
1403         bh.consume(r);
1404     }
1405 
1406 
1407 
1408     @Benchmark
1409     public void ATAN2(Blackhole bh) {
1410         double[] a = fa.apply(SPECIES.length());
1411         double[] b = fb.apply(SPECIES.length());
1412         double[] r = fr.apply(SPECIES.length());
1413 
1414         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1415             for (int i = 0; i < a.length; i += SPECIES.length()) {
1416                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1417                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1418                 av.lanewise(VectorOperators.ATAN2, bv).intoArray(r, i);
1419             }
1420         }
1421 
1422         bh.consume(r);
1423     }
1424 
1425 
1426 
1427     @Benchmark
1428     public void FMA(Blackhole bh) {
1429         double[] a = fa.apply(SPECIES.length());
1430         double[] b = fb.apply(SPECIES.length());
1431         double[] c = fc.apply(SPECIES.length());
1432         double[] r = fr.apply(SPECIES.length());
1433 
1434         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1435             for (int i = 0; i < a.length; i += SPECIES.length()) {
1436                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1437                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1438                 DoubleVector cv = DoubleVector.fromArray(SPECIES, c, i);
1439                 av.lanewise(VectorOperators.FMA, bv, cv).intoArray(r, i);
1440             }
1441         }
1442 
1443         bh.consume(r);
1444     }
1445 
1446 
1447 
1448     @Benchmark
1449     public void FMAMasked(Blackhole bh) {
1450         double[] a = fa.apply(SPECIES.length());
1451         double[] b = fb.apply(SPECIES.length());
1452         double[] c = fc.apply(SPECIES.length());
1453         double[] r = fr.apply(SPECIES.length());
1454         boolean[] mask = fm.apply(SPECIES.length());
1455         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1456 
1457         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1458             for (int i = 0; i < a.length; i += SPECIES.length()) {
1459                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1460                 DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
1461                 DoubleVector cv = DoubleVector.fromArray(SPECIES, c, i);
1462                 av.lanewise(VectorOperators.FMA, bv, cv, vmask).intoArray(r, i);
1463             }
1464         }
1465 
1466         bh.consume(r);
1467     }
1468 
1469 
1470 
1471 
1472     @Benchmark
1473     public void NEG(Blackhole bh) {
1474         double[] a = fa.apply(SPECIES.length());
1475         double[] r = fr.apply(SPECIES.length());
1476 
1477         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1478             for (int i = 0; i < a.length; i += SPECIES.length()) {
1479                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1480                 av.lanewise(VectorOperators.NEG).intoArray(r, i);
1481             }
1482         }
1483 
1484         bh.consume(r);
1485     }
1486 
1487     @Benchmark
1488     public void NEGMasked(Blackhole bh) {
1489         double[] a = fa.apply(SPECIES.length());
1490         double[] r = fr.apply(SPECIES.length());
1491         boolean[] mask = fm.apply(SPECIES.length());
1492         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1493 
1494         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1495             for (int i = 0; i < a.length; i += SPECIES.length()) {
1496                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1497                 av.lanewise(VectorOperators.NEG, vmask).intoArray(r, i);
1498             }
1499         }
1500 
1501         bh.consume(r);
1502     }
1503 
1504     @Benchmark
1505     public void ABS(Blackhole bh) {
1506         double[] a = fa.apply(SPECIES.length());
1507         double[] r = fr.apply(SPECIES.length());
1508 
1509         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1510             for (int i = 0; i < a.length; i += SPECIES.length()) {
1511                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1512                 av.lanewise(VectorOperators.ABS).intoArray(r, i);
1513             }
1514         }
1515 
1516         bh.consume(r);
1517     }
1518 
1519     @Benchmark
1520     public void ABSMasked(Blackhole bh) {
1521         double[] a = fa.apply(SPECIES.length());
1522         double[] r = fr.apply(SPECIES.length());
1523         boolean[] mask = fm.apply(SPECIES.length());
1524         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1525 
1526         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1527             for (int i = 0; i < a.length; i += SPECIES.length()) {
1528                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1529                 av.lanewise(VectorOperators.ABS, vmask).intoArray(r, i);
1530             }
1531         }
1532 
1533         bh.consume(r);
1534     }
1535 
1536 
1537 
1538 
1539 
1540 
1541     @Benchmark
1542     public void SQRT(Blackhole bh) {
1543         double[] a = fa.apply(SPECIES.length());
1544         double[] r = fr.apply(SPECIES.length());
1545 
1546         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1547             for (int i = 0; i < a.length; i += SPECIES.length()) {
1548                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1549                 av.lanewise(VectorOperators.SQRT).intoArray(r, i);
1550             }
1551         }
1552 
1553         bh.consume(r);
1554     }
1555 
1556 
1557 
1558     @Benchmark
1559     public void SQRTMasked(Blackhole bh) {
1560         double[] a = fa.apply(SPECIES.length());
1561         double[] r = fr.apply(SPECIES.length());
1562         boolean[] mask = fm.apply(SPECIES.length());
1563         VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
1564 
1565         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1566             for (int i = 0; i < a.length; i += SPECIES.length()) {
1567                 DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
1568                 av.lanewise(VectorOperators.SQRT, vmask).intoArray(r, i);
1569             }
1570         }
1571 
1572         bh.consume(r);
1573     }
1574 
1575 }
1576