1 /*
   2  * Copyright (c) 2022, 2025, Arm Limited. All rights reserved.
   3  * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
   4  * Copyright (c) 2025, Rivos Inc. All rights reserved.
   5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6  *
   7  * This code is free software; you can redistribute it and/or modify it
   8  * under the terms of the GNU General Public License version 2 only, as
   9  * published by the Free Software Foundation.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package compiler.c2.cmove;
  27 
  28 import compiler.lib.ir_framework.*;
  29 import java.util.Random;
  30 import jdk.test.lib.Asserts;
  31 import jdk.test.lib.Utils;
  32 
  33 /*
  34  * @test
  35  * @bug 8289422 8306088 8313720
  36  * @key randomness
  37  * @summary Auto-vectorization enhancement to support vector conditional move.
  38  * @library /test/lib /
  39  * @run driver ${test.main.class}
  40  */
  41 
  42 public class TestConditionalMove {
  43     final private static int SIZE = 1024;
  44     private static final Random RANDOM = Utils.getRandomInstance();
  45 
  46     public static void main(String[] args) {
  47         // Vectorizaion: +UseCMoveUnconditionally, +UseVectorCmov
  48         // Cross-product: +-AlignVector and +-UseCompactObjectHeaders
  49         TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:+UseVectorCmov",
  50                                    "-XX:-UseCompactObjectHeaders", "-XX:-AlignVector");
  51         TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:+UseVectorCmov",
  52                                    "-XX:-UseCompactObjectHeaders", "-XX:+AlignVector");
  53         TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:+UseVectorCmov",
  54                                    "-XX:+UseCompactObjectHeaders", "-XX:-AlignVector");
  55         TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:+UseVectorCmov",
  56                                    "-XX:+UseCompactObjectHeaders", "-XX:+AlignVector");
  57 
  58         // Scalar: +UseCMoveUnconditionally, -UseVectorCmov
  59         TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov",
  60                                    "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders");
  61         TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov",
  62                                    "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCompactObjectHeaders");
  63     }
  64 
  65     // Compare 2 values, and pick one of them
  66     private float cmoveFloatGT(float a, float b) {
  67         return (a > b) ? a : b;
  68     }
  69 
  70     private float cmoveFloatGTSwap(float a, float b) {
  71         return (b > a) ? a : b;
  72     }
  73 
  74     private float cmoveFloatLT(float a, float b) {
  75         return (a < b) ? a : b;
  76     }
  77 
  78     private float cmoveFloatLTSwap(float a, float b) {
  79         return (b < a) ? a : b;
  80     }
  81 
  82     private float cmoveFloatEQ(float a, float b) {
  83         return (a == b) ? a : b;
  84     }
  85 
  86     private double cmoveDoubleLE(double a, double b) {
  87         return (a <= b) ? a : b;
  88     }
  89 
  90     private double cmoveDoubleLESwap(double a, double b) {
  91         return (b <= a) ? a : b;
  92     }
  93 
  94     private double cmoveDoubleGE(double a, double b) {
  95         return (a >= b) ? a : b;
  96     }
  97 
  98     private double cmoveDoubleGESwap(double a, double b) {
  99         return (b >= a) ? a : b;
 100     }
 101 
 102     private double cmoveDoubleNE(double a, double b) {
 103         return (a != b) ? a : b;
 104     }
 105 
 106     // Extensions: compare 2 values, and pick from 2 consts
 107     private float cmoveFGTforFConst(float a, float b) {
 108         return (a > b) ? 0.1f : -0.1f;
 109     }
 110 
 111     private float cmoveFGEforFConst(float a, float b) {
 112         return (a >= b) ? 0.1f : -0.1f;
 113     }
 114 
 115     private float cmoveFLTforFConst(float a, float b) {
 116         return (a < b) ? 0.1f : -0.1f;
 117     }
 118 
 119     private float cmoveFLEforFConst(float a, float b) {
 120         return (a <= b) ? 0.1f : -0.1f;
 121     }
 122 
 123     private float cmoveFEQforFConst(float a, float b) {
 124         return (a == b) ? 0.1f : -0.1f;
 125     }
 126 
 127     private float cmoveFNEQforFConst(float a, float b) {
 128         return (a != b) ? 0.1f : -0.1f;
 129     }
 130 
 131     private double cmoveDGTforDConst(double a, double b) {
 132         return (a > b) ? 0.1 : -0.1;
 133     }
 134 
 135     private double cmoveDGEforDConst(double a, double b) {
 136         return (a >= b) ? 0.1 : -0.1;
 137     }
 138 
 139     private double cmoveDLTforDConst(double a, double b) {
 140         return (a < b) ? 0.1 : -0.1;
 141     }
 142 
 143     private double cmoveDLEforDConst(double a, double b) {
 144         return (a <= b) ? 0.1 : -0.1;
 145     }
 146 
 147     private double cmoveDEQforDConst(double a, double b) {
 148         return (a == b) ? 0.1 : -0.1;
 149     }
 150 
 151     private double cmoveDNEQforDConst(double a, double b) {
 152         return (a != b) ? 0.1 : -0.1;
 153     }
 154 
 155     // Extension: Compare 2 ILFD values, and pick from 2 ILFD values
 156     // Signed comparison: I/L
 157     //    I for I
 158     private int cmoveIEQforI(int a, int b, int c, int d) {
 159         return (a == b) ? c : d;
 160     }
 161 
 162     private int cmoveINEforI(int a, int b, int c, int d) {
 163         return (a != b) ? c : d;
 164     }
 165 
 166     private int cmoveIGTforI(int a, int b, int c, int d) {
 167         return (a > b) ? c : d;
 168     }
 169 
 170     private int cmoveIGEforI(int a, int b, int c, int d) {
 171         return (a >= b) ? c : d;
 172     }
 173 
 174     private int cmoveILTforI(int a, int b, int c, int d) {
 175         return (a < b) ? c : d;
 176     }
 177 
 178     private int cmoveILEforI(int a, int b, int c, int d) {
 179         return (a <= b) ? c : d;
 180     }
 181 
 182     //    I for L
 183     private long cmoveIEQforL(int a, int b, long c, long d) {
 184         return (a == b) ? c : d;
 185     }
 186 
 187     private long cmoveINEforL(int a, int b, long c, long d) {
 188         return (a != b) ? c : d;
 189     }
 190 
 191     private long cmoveIGTforL(int a, int b, long c, long d) {
 192         return (a > b) ? c : d;
 193     }
 194 
 195     private long cmoveIGEforL(int a, int b, long c, long d) {
 196         return (a >= b) ? c : d;
 197     }
 198 
 199     private long cmoveILTforL(int a, int b, long c, long d) {
 200         return (a < b) ? c : d;
 201     }
 202 
 203     private long cmoveILEforL(int a, int b, long c, long d) {
 204         return (a <= b) ? c : d;
 205     }
 206 
 207     //    I for F
 208     private float cmoveIEQforF(int a, int b, float c, float d) {
 209         return (a == b) ? c : d;
 210     }
 211 
 212     private float cmoveINEforF(int a, int b, float c, float d) {
 213         return (a != b) ? c : d;
 214     }
 215 
 216     private float cmoveIGTforF(int a, int b, float c, float d) {
 217         return (a > b) ? c : d;
 218     }
 219 
 220     private float cmoveIGEforF(int a, int b, float c, float d) {
 221         return (a >= b) ? c : d;
 222     }
 223 
 224     private float cmoveILTforF(int a, int b, float c, float d) {
 225         return (a < b) ? c : d;
 226     }
 227 
 228     private float cmoveILEforF(int a, int b, float c, float d) {
 229         return (a <= b) ? c : d;
 230     }
 231 
 232     //    I for D
 233     private double cmoveIEQforD(int a, int b, double c, double d) {
 234         return (a == b) ? c : d;
 235     }
 236 
 237     private double cmoveINEforD(int a, int b, double c, double d) {
 238         return (a != b) ? c : d;
 239     }
 240 
 241     private double cmoveIGTforD(int a, int b, double c, double d) {
 242         return (a > b) ? c : d;
 243     }
 244 
 245     private double cmoveIGEforD(int a, int b, double c, double d) {
 246         return (a >= b) ? c : d;
 247     }
 248 
 249     private double cmoveILTforD(int a, int b, double c, double d) {
 250         return (a < b) ? c : d;
 251     }
 252 
 253     private double cmoveILEforD(int a, int b, double c, double d) {
 254         return (a <= b) ? c : d;
 255     }
 256 
 257     //    L for I
 258     private int cmoveLEQforI(long a, long b, int c, int d) {
 259         return (a == b) ? c : d;
 260     }
 261 
 262     private int cmoveLNEforI(long a, long b, int c, int d) {
 263         return (a != b) ? c : d;
 264     }
 265 
 266     private int cmoveLGTforI(long a, long b, int c, int d) {
 267         return (a > b) ? c : d;
 268     }
 269 
 270     private int cmoveLGEforI(long a, long b, int c, int d) {
 271         return (a >= b) ? c : d;
 272     }
 273 
 274     private int cmoveLLTforI(long a, long b, int c, int d) {
 275         return (a < b) ? c : d;
 276     }
 277 
 278     private int cmoveLLEforI(long a, long b, int c, int d) {
 279         return (a <= b) ? c : d;
 280     }
 281 
 282     //    L for L
 283     private long cmoveLEQforL(long a, long b, long c, long d) {
 284         return (a == b) ? c : d;
 285     }
 286 
 287     private long cmoveLNEforL(long a, long b, long c, long d) {
 288         return (a != b) ? c : d;
 289     }
 290 
 291     private long cmoveLGTforL(long a, long b, long c, long d) {
 292         return (a > b) ? c : d;
 293     }
 294 
 295     private long cmoveLGEforL(long a, long b, long c, long d) {
 296         return (a >= b) ? c : d;
 297     }
 298 
 299     private long cmoveLLTforL(long a, long b, long c, long d) {
 300         return (a < b) ? c : d;
 301     }
 302 
 303     private long cmoveLLEforL(long a, long b, long c, long d) {
 304         return (a <= b) ? c : d;
 305     }
 306 
 307     //    L for F
 308     private float cmoveLEQforF(long a, long b, float c, float d) {
 309         return (a == b) ? c : d;
 310     }
 311 
 312     private float cmoveLNEforF(long a, long b, float c, float d) {
 313         return (a != b) ? c : d;
 314     }
 315 
 316     private float cmoveLGTforF(long a, long b, float c, float d) {
 317         return (a > b) ? c : d;
 318     }
 319 
 320     private float cmoveLGEforF(long a, long b, float c, float d) {
 321         return (a >= b) ? c : d;
 322     }
 323 
 324     private float cmoveLLTforF(long a, long b, float c, float d) {
 325         return (a < b) ? c : d;
 326     }
 327 
 328     private float cmoveLLEforF(long a, long b, float c, float d) {
 329         return (a <= b) ? c : d;
 330     }
 331 
 332     //    L for D
 333     private double cmoveLEQforD(long a, long b, double c, double d) {
 334         return (a == b) ? c : d;
 335     }
 336 
 337     private double cmoveLNEforD(long a, long b, double c, double d) {
 338         return (a != b) ? c : d;
 339     }
 340 
 341     private double cmoveLGTforD(long a, long b, double c, double d) {
 342         return (a > b) ? c : d;
 343     }
 344 
 345     private double cmoveLGEforD(long a, long b, double c, double d) {
 346         return (a >= b) ? c : d;
 347     }
 348 
 349     private double cmoveLLTforD(long a, long b, double c, double d) {
 350         return (a < b) ? c : d;
 351     }
 352 
 353     private double cmoveLLEforD(long a, long b, double c, double d) {
 354         return (a <= b) ? c : d;
 355     }
 356 
 357     // Unsigned comparison: I/L
 358     //    I for I
 359     private int cmoveUIEQforI(int a, int b, int c, int d) {
 360         return Integer.compareUnsigned(a, b) == 0 ? c : d;
 361     }
 362 
 363     private int cmoveUINEforI(int a, int b, int c, int d) {
 364         return Integer.compareUnsigned(a, b) != 0 ? c : d;
 365     }
 366 
 367     private int cmoveUIGTforI(int a, int b, int c, int d) {
 368         return Integer.compareUnsigned(a, b) > 0 ? c : d;
 369     }
 370 
 371     private int cmoveUIGEforI(int a, int b, int c, int d) {
 372         return Integer.compareUnsigned(a, b) >= 0 ? c : d;
 373     }
 374 
 375     private int cmoveUILTforI(int a, int b, int c, int d) {
 376         return Integer.compareUnsigned(a, b) < 0 ? c : d;
 377     }
 378 
 379     private int cmoveUILEforI(int a, int b, int c, int d) {
 380         return Integer.compareUnsigned(a, b) <= 0 ? c : d;
 381     }
 382 
 383     //    I for L
 384     private long cmoveUIEQforL(int a, int b, long c, long d) {
 385         return Integer.compareUnsigned(a, b) == 0 ? c : d;
 386     }
 387 
 388     private long cmoveUINEforL(int a, int b, long c, long d) {
 389         return Integer.compareUnsigned(a, b) != 0 ? c : d;
 390     }
 391 
 392     private long cmoveUIGTforL(int a, int b, long c, long d) {
 393         return Integer.compareUnsigned(a, b) > 0 ? c : d;
 394     }
 395 
 396     private long cmoveUIGEforL(int a, int b, long c, long d) {
 397         return Integer.compareUnsigned(a, b) >= 0 ? c : d;
 398     }
 399 
 400     private long cmoveUILTforL(int a, int b, long c, long d) {
 401         return Integer.compareUnsigned(a, b) < 0 ? c : d;
 402     }
 403 
 404     private long cmoveUILEforL(int a, int b, long c, long d) {
 405         return Integer.compareUnsigned(a, b) <= 0 ? c : d;
 406     }
 407 
 408     //    I for F
 409     private float cmoveUIEQforF(int a, int b, float c, float d) {
 410         return Integer.compareUnsigned(a, b) == 0 ? c : d;
 411     }
 412 
 413     private float cmoveUINEforF(int a, int b, float c, float d) {
 414         return Integer.compareUnsigned(a, b) != 0 ? c : d;
 415     }
 416 
 417     private float cmoveUIGTforF(int a, int b, float c, float d) {
 418         return Integer.compareUnsigned(a, b) > 0 ? c : d;
 419     }
 420 
 421     private float cmoveUIGEforF(int a, int b, float c, float d) {
 422         return Integer.compareUnsigned(a, b) >= 0 ? c : d;
 423     }
 424 
 425     private float cmoveUILTforF(int a, int b, float c, float d) {
 426         return Integer.compareUnsigned(a, b) < 0 ? c : d;
 427     }
 428 
 429     private float cmoveUILEforF(int a, int b, float c, float d) {
 430         return Integer.compareUnsigned(a, b) <= 0 ? c : d;
 431     }
 432 
 433     //    I for D
 434     private double cmoveUIEQforD(int a, int b, double c, double d) {
 435         return Integer.compareUnsigned(a, b) == 0 ? c : d;
 436     }
 437 
 438     private double cmoveUINEforD(int a, int b, double c, double d) {
 439         return Integer.compareUnsigned(a, b) != 0 ? c : d;
 440     }
 441 
 442     private double cmoveUIGTforD(int a, int b, double c, double d) {
 443         return Integer.compareUnsigned(a, b) > 0 ? c : d;
 444     }
 445 
 446     private double cmoveUIGEforD(int a, int b, double c, double d) {
 447         return Integer.compareUnsigned(a, b) >= 0 ? c : d;
 448     }
 449 
 450     private double cmoveUILTforD(int a, int b, double c, double d) {
 451         return Integer.compareUnsigned(a, b) < 0 ? c : d;
 452     }
 453 
 454     private double cmoveUILEforD(int a, int b, double c, double d) {
 455         return Integer.compareUnsigned(a, b) <= 0 ? c : d;
 456     }
 457 
 458     //    L for I
 459     private int cmoveULEQforI(long a, long b, int c, int d) {
 460         return Long.compareUnsigned(a, b) == 0 ? c : d;
 461     }
 462 
 463     private int cmoveULNEforI(long a, long b, int c, int d) {
 464         return Long.compareUnsigned(a, b) != 0 ? c : d;
 465     }
 466 
 467     private int cmoveULGTforI(long a, long b, int c, int d) {
 468         return Long.compareUnsigned(a, b) > 0 ? c : d;
 469     }
 470 
 471     private int cmoveULGEforI(long a, long b, int c, int d) {
 472         return Long.compareUnsigned(a, b) >= 0 ? c : d;
 473     }
 474 
 475     private int cmoveULLTforI(long a, long b, int c, int d) {
 476         return Long.compareUnsigned(a, b) < 0 ? c : d;
 477     }
 478 
 479     private int cmoveULLEforI(long a, long b, int c, int d) {
 480         return Long.compareUnsigned(a, b) <= 0 ? c : d;
 481     }
 482 
 483     //    L for L
 484     private long cmoveULEQforL(long a, long b, long c, long d) {
 485         return Long.compareUnsigned(a, b) == 0 ? c : d;
 486     }
 487 
 488     private long cmoveULNEforL(long a, long b, long c, long d) {
 489         return Long.compareUnsigned(a, b) != 0 ? c : d;
 490     }
 491 
 492     private long cmoveULGTforL(long a, long b, long c, long d) {
 493         return Long.compareUnsigned(a, b) > 0 ? c : d;
 494     }
 495 
 496     private long cmoveULGEforL(long a, long b, long c, long d) {
 497         return Long.compareUnsigned(a, b) >= 0 ? c : d;
 498     }
 499 
 500     private long cmoveULLTforL(long a, long b, long c, long d) {
 501         return Long.compareUnsigned(a, b) < 0 ? c : d;
 502     }
 503 
 504     private long cmoveULLEforL(long a, long b, long c, long d) {
 505         return Long.compareUnsigned(a, b) <= 0 ? c : d;
 506     }
 507 
 508     //    L for F
 509     private float cmoveULEQforF(long a, long b, float c, float d) {
 510         return Long.compareUnsigned(a, b) == 0 ? c : d;
 511     }
 512 
 513     private float cmoveULNEforF(long a, long b, float c, float d) {
 514         return Long.compareUnsigned(a, b) != 0 ? c : d;
 515     }
 516 
 517     private float cmoveULGTforF(long a, long b, float c, float d) {
 518         return Long.compareUnsigned(a, b) > 0 ? c : d;
 519     }
 520 
 521     private float cmoveULGEforF(long a, long b, float c, float d) {
 522         return Long.compareUnsigned(a, b) >= 0 ? c : d;
 523     }
 524 
 525     private float cmoveULLTforF(long a, long b, float c, float d) {
 526         return Long.compareUnsigned(a, b) < 0 ? c : d;
 527     }
 528 
 529     private float cmoveULLEforF(long a, long b, float c, float d) {
 530         return Long.compareUnsigned(a, b) <= 0 ? c : d;
 531     }
 532 
 533     //    L for D
 534     private double cmoveULEQforD(long a, long b, double c, double d) {
 535         return Long.compareUnsigned(a, b) == 0 ? c : d;
 536     }
 537 
 538     private double cmoveULNEforD(long a, long b, double c, double d) {
 539         return Long.compareUnsigned(a, b) != 0 ? c : d;
 540     }
 541 
 542     private double cmoveULGTforD(long a, long b, double c, double d) {
 543         return Long.compareUnsigned(a, b) > 0 ? c : d;
 544     }
 545 
 546     private double cmoveULGEforD(long a, long b, double c, double d) {
 547         return Long.compareUnsigned(a, b) >= 0 ? c : d;
 548     }
 549 
 550     private double cmoveULLTforD(long a, long b, double c, double d) {
 551         return Long.compareUnsigned(a, b) < 0 ? c : d;
 552     }
 553 
 554     private double cmoveULLEforD(long a, long b, double c, double d) {
 555         return Long.compareUnsigned(a, b) <= 0 ? c : d;
 556     }
 557 
 558     // Float comparison
 559     private int cmoveFGTforI(float a, float b, int c, int d) {
 560         return (a > b) ? c : d;
 561     }
 562 
 563     private long cmoveFGTforL(float a, float b, long c, long d) {
 564         return (a > b) ? c : d;
 565     }
 566 
 567     private float cmoveFGTforF(float a, float b, float c, float d) {
 568         return (a > b) ? c : d;
 569     }
 570 
 571     private double cmoveFGTforD(float a, float b, double c, double d) {
 572         return (a > b) ? c : d;
 573     }
 574 
 575     // Double comparison
 576     private int cmoveDGTforI(double a, double b, int c, int d) {
 577         return (a > b) ? c : d;
 578     }
 579 
 580     private long cmoveDGTforL(double a, double b, long c, long d) {
 581         return (a > b) ? c : d;
 582     }
 583 
 584     private float cmoveDGTforF(double a, double b, float c, float d) {
 585         return (a > b) ? c : d;
 586     }
 587 
 588     private double cmoveDGTforD(double a, double b, double c, double d) {
 589         return (a > b) ? c : d;
 590     }
 591 
 592     // Compare 2 values, and pick one of them
 593     @Test
 594     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 595                   IRNode.VECTOR_MASK_CMP_F, ">0",
 596                   IRNode.VECTOR_BLEND_F, ">0",
 597                   IRNode.STORE_VECTOR, ">0"},
 598         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 599         applyIf = {"UseVectorCmov", "true"})
 600     @IR(failOn = {IRNode.STORE_VECTOR},
 601         applyIf = {"UseVectorCmov", "false"})
 602     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 603         applyIf = {"UseVectorCmov", "false"},
 604         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 605     private static void testCMoveVFGT(float[] a, float[] b, float[] c) {
 606         for (int i = 0; i < a.length; i++) {
 607             c[i] = (a[i] > b[i]) ? a[i] : b[i];
 608         }
 609     }
 610 
 611     @Test
 612     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 613                   IRNode.VECTOR_MASK_CMP_F, ">0",
 614                   IRNode.VECTOR_BLEND_F, ">0",
 615                   IRNode.STORE_VECTOR, ">0"},
 616         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 617         applyIf = {"UseVectorCmov", "true"})
 618     @IR(failOn = {IRNode.STORE_VECTOR},
 619         applyIf = {"UseVectorCmov", "false"})
 620     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 621         applyIf = {"UseVectorCmov", "false"},
 622         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 623     private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) {
 624         for (int i = 0; i < a.length; i++) {
 625             c[i] = (b[i] > a[i]) ? a[i] : b[i];
 626         }
 627     }
 628 
 629     @Test
 630     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 631                   IRNode.VECTOR_MASK_CMP_F, ">0",
 632                   IRNode.VECTOR_BLEND_F, ">0",
 633                   IRNode.STORE_VECTOR, ">0"},
 634         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 635         applyIf = {"UseVectorCmov", "true"})
 636     @IR(failOn = {IRNode.STORE_VECTOR},
 637         applyIf = {"UseVectorCmov", "false"})
 638     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 639         applyIf = {"UseVectorCmov", "false"},
 640         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 641     private static void testCMoveVFLT(float[] a, float[] b, float[] c) {
 642         for (int i = 0; i < a.length; i++) {
 643             c[i] = (a[i] < b[i]) ? a[i] : b[i];
 644         }
 645     }
 646 
 647     @Test
 648     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 649                   IRNode.VECTOR_MASK_CMP_F, ">0",
 650                   IRNode.VECTOR_BLEND_F, ">0",
 651                   IRNode.STORE_VECTOR, ">0"},
 652         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 653         applyIf = {"UseVectorCmov", "true"})
 654     @IR(failOn = {IRNode.STORE_VECTOR},
 655         applyIf = {"UseVectorCmov", "false"})
 656     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 657         applyIf = {"UseVectorCmov", "false"},
 658         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 659     private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) {
 660         for (int i = 0; i < a.length; i++) {
 661             c[i] = (b[i] < a[i]) ? a[i] : b[i];
 662         }
 663     }
 664 
 665     @Test
 666     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 667                   IRNode.VECTOR_MASK_CMP_F, ">0",
 668                   IRNode.VECTOR_BLEND_F, ">0",
 669                   IRNode.STORE_VECTOR, ">0"},
 670         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 671         applyIf = {"UseVectorCmov", "true"})
 672     @IR(failOn = {IRNode.STORE_VECTOR},
 673         applyIf = {"UseVectorCmov", "false"})
 674     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 675         applyIf = {"UseVectorCmov", "false"},
 676         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 677     private static void testCMoveVFEQ(float[] a, float[] b, float[] c) {
 678         for (int i = 0; i < a.length; i++) {
 679             c[i] = (a[i] == b[i]) ? a[i] : b[i];
 680         }
 681     }
 682 
 683     @Test
 684     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
 685                   IRNode.VECTOR_MASK_CMP_D, ">0",
 686                   IRNode.VECTOR_BLEND_D, ">0",
 687                   IRNode.STORE_VECTOR, ">0"},
 688         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 689         applyIf = {"UseVectorCmov", "true"})
 690     @IR(failOn = {IRNode.STORE_VECTOR},
 691         applyIf = {"UseVectorCmov", "false"})
 692     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
 693         applyIf = {"UseVectorCmov", "false"},
 694         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 695     private static void testCMoveVDLE(double[] a, double[] b, double[] c) {
 696         for (int i = 0; i < a.length; i++) {
 697             c[i] = (a[i] <= b[i]) ? a[i] : b[i];
 698         }
 699     }
 700 
 701     @Test
 702     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
 703                   IRNode.VECTOR_MASK_CMP_D, ">0",
 704                   IRNode.VECTOR_BLEND_D, ">0",
 705                   IRNode.STORE_VECTOR, ">0"},
 706         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 707         applyIf = {"UseVectorCmov", "true"})
 708     @IR(failOn = {IRNode.STORE_VECTOR},
 709         applyIf = {"UseVectorCmov", "false"})
 710     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
 711         applyIf = {"UseVectorCmov", "false"},
 712         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 713     private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) {
 714         for (int i = 0; i < a.length; i++) {
 715             c[i] = (b[i] <= a[i]) ? a[i] : b[i];
 716         }
 717     }
 718 
 719     @Test
 720     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
 721                   IRNode.VECTOR_MASK_CMP_D, ">0",
 722                   IRNode.VECTOR_BLEND_D, ">0",
 723                   IRNode.STORE_VECTOR, ">0"},
 724         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 725         applyIf = {"UseVectorCmov", "true"})
 726     @IR(failOn = {IRNode.STORE_VECTOR},
 727         applyIf = {"UseVectorCmov", "false"})
 728     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
 729         applyIf = {"UseVectorCmov", "false"},
 730         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 731     private static void testCMoveVDGE(double[] a, double[] b, double[] c) {
 732         for (int i = 0; i < a.length; i++) {
 733             c[i] = (a[i] >= b[i]) ? a[i] : b[i];
 734         }
 735     }
 736 
 737     @Test
 738     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
 739                   IRNode.VECTOR_MASK_CMP_D, ">0",
 740                   IRNode.VECTOR_BLEND_D, ">0",
 741                   IRNode.STORE_VECTOR, ">0"},
 742         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 743         applyIf = {"UseVectorCmov", "true"})
 744     @IR(failOn = {IRNode.STORE_VECTOR},
 745         applyIf = {"UseVectorCmov", "false"})
 746     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
 747         applyIf = {"UseVectorCmov", "false"},
 748         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 749     private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) {
 750         for (int i = 0; i < a.length; i++) {
 751             c[i] = (b[i] >= a[i]) ? a[i] : b[i];
 752         }
 753     }
 754 
 755     @Test
 756     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
 757                   IRNode.VECTOR_MASK_CMP_D, ">0",
 758                   IRNode.VECTOR_BLEND_D, ">0",
 759                   IRNode.STORE_VECTOR, ">0"},
 760         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 761         applyIf = {"UseVectorCmov", "true"})
 762     @IR(failOn = {IRNode.STORE_VECTOR},
 763         applyIf = {"UseVectorCmov", "false"})
 764     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
 765         applyIf = {"UseVectorCmov", "false"},
 766         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 767     private static void testCMoveVDNE(double[] a, double[] b, double[] c) {
 768         for (int i = 0; i < a.length; i++) {
 769             c[i] = (a[i] != b[i]) ? a[i] : b[i];
 770         }
 771     }
 772 
 773     // Extensions: compare 2 values, and pick from 2 consts
 774     @Test
 775     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 776                   IRNode.VECTOR_MASK_CMP_F, ">0",
 777                   IRNode.VECTOR_BLEND_F, ">0",
 778                   IRNode.STORE_VECTOR, ">0"},
 779         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 780         applyIf = {"UseVectorCmov", "true"})
 781     @IR(failOn = {IRNode.STORE_VECTOR},
 782         applyIf = {"UseVectorCmov", "false"})
 783     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 784         applyIf = {"UseVectorCmov", "false"},
 785         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 786     private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) {
 787         for (int i = 0; i < a.length; i++) {
 788             c[i] = (a[i] > b[i]) ? 0.1f : -0.1f;
 789         }
 790     }
 791 
 792     @Test
 793     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 794                   IRNode.VECTOR_MASK_CMP_F, ">0",
 795                   IRNode.VECTOR_BLEND_F, ">0",
 796                   IRNode.STORE_VECTOR, ">0"},
 797         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 798         applyIf = {"UseVectorCmov", "true"})
 799     @IR(failOn = {IRNode.STORE_VECTOR},
 800         applyIf = {"UseVectorCmov", "false"})
 801     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 802         applyIf = {"UseVectorCmov", "false"},
 803         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 804     private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) {
 805         for (int i = 0; i < a.length; i++) {
 806             c[i] = (a[i] >= b[i]) ? 0.1f : -0.1f;
 807         }
 808     }
 809 
 810     @Test
 811     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 812                   IRNode.VECTOR_MASK_CMP_F, ">0",
 813                   IRNode.VECTOR_BLEND_F, ">0",
 814                   IRNode.STORE_VECTOR, ">0"},
 815         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 816         applyIf = {"UseVectorCmov", "true"})
 817     @IR(failOn = {IRNode.STORE_VECTOR},
 818         applyIf = {"UseVectorCmov", "false"})
 819     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 820         applyIf = {"UseVectorCmov", "false"},
 821         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 822     private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) {
 823         for (int i = 0; i < a.length; i++) {
 824             c[i] = (a[i] < b[i]) ? 0.1f : -0.1f;
 825         }
 826     }
 827 
 828     @Test
 829     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 830                   IRNode.VECTOR_MASK_CMP_F, ">0",
 831                   IRNode.VECTOR_BLEND_F, ">0",
 832                   IRNode.STORE_VECTOR, ">0"},
 833         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 834         applyIf = {"UseVectorCmov", "true"})
 835     @IR(failOn = {IRNode.STORE_VECTOR},
 836         applyIf = {"UseVectorCmov", "false"})
 837     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 838         applyIf = {"UseVectorCmov", "false"},
 839         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 840     private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) {
 841         for (int i = 0; i < a.length; i++) {
 842             c[i] = (a[i] <= b[i]) ? 0.1f : -0.1f;
 843         }
 844     }
 845 
 846     @Test
 847     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 848                   IRNode.VECTOR_MASK_CMP_F, ">0",
 849                   IRNode.VECTOR_BLEND_F, ">0",
 850                   IRNode.STORE_VECTOR, ">0"},
 851         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 852         applyIf = {"UseVectorCmov", "true"})
 853     @IR(failOn = {IRNode.STORE_VECTOR},
 854         applyIf = {"UseVectorCmov", "false"})
 855     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 856         applyIf = {"UseVectorCmov", "false"},
 857         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 858     private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) {
 859         for (int i = 0; i < a.length; i++) {
 860             c[i] = (a[i] == b[i]) ? 0.1f : -0.1f;
 861         }
 862     }
 863 
 864     @Test
 865     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 866                   IRNode.VECTOR_MASK_CMP_F, ">0",
 867                   IRNode.VECTOR_BLEND_F, ">0",
 868                   IRNode.STORE_VECTOR, ">0"},
 869         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 870         applyIf = {"UseVectorCmov", "true"})
 871     @IR(failOn = {IRNode.STORE_VECTOR},
 872         applyIf = {"UseVectorCmov", "false"})
 873     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 874         applyIf = {"UseVectorCmov", "false"},
 875         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 876     private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) {
 877         for (int i = 0; i < a.length; i++) {
 878             c[i] = (a[i] != b[i]) ? 0.1f : -0.1f;
 879         }
 880     }
 881 
 882     @Test
 883     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 884                   IRNode.VECTOR_MASK_CMP_F, ">0",
 885                   IRNode.VECTOR_BLEND_F, ">0",
 886                   IRNode.STORE_VECTOR, ">0"},
 887         applyIfAnd = {"UseCompactObjectHeaders", "false", "UseVectorCmov", "true"},
 888         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"})
 889     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 890                     IRNode.VECTOR_MASK_CMP_F, ">0",
 891                     IRNode.VECTOR_BLEND_F, ">0",
 892                     IRNode.STORE_VECTOR, ">0"},
 893         applyIfAnd = {"AlignVector", "false", "UseVectorCmov", "true"},
 894         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"})
 895     @IR(failOn = {IRNode.STORE_VECTOR},
 896         applyIf = {"UseVectorCmov", "false"})
 897     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 898         applyIf = {"UseVectorCmov", "false"},
 899         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 900     private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) {
 901         for (int i = 0; i < a.length; i+=2) {
 902             c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f;
 903             c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
 904             // With AlignVector, we need 8-byte alignment of vector loads/stores.
 905             // UseCompactObjectHeaders=false                        UseCompactObjectHeaders=true
 906             // adr = base + 16 + 8*i      ->  always                adr = base + 12 + 8*i      ->  never
 907             // -> vectorize                                         -> no vectorization
 908         }
 909     }
 910 
 911     @Test
 912     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 913                   IRNode.VECTOR_MASK_CMP_F, ">0",
 914                   IRNode.VECTOR_BLEND_F, ">0",
 915                   IRNode.STORE_VECTOR, ">0"},
 916         applyIfAnd = {"UseCompactObjectHeaders", "false", "UseVectorCmov", "true"},
 917         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"})
 918     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
 919                     IRNode.VECTOR_MASK_CMP_F, ">0",
 920                     IRNode.VECTOR_BLEND_F, ">0",
 921                     IRNode.STORE_VECTOR, ">0"},
 922         applyIfAnd = {"AlignVector", "false", "UseVectorCmov", "true"},
 923         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"})
 924     @IR(failOn = {IRNode.STORE_VECTOR},
 925         applyIf = {"UseVectorCmov", "false"})
 926     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 927         applyIf = {"UseVectorCmov", "false"},
 928         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 929     private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) {
 930         for (int i = 0; i < a.length; i+=2) {
 931             c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
 932             c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f;
 933             // With AlignVector, we need 8-byte alignment of vector loads/stores.
 934             // UseCompactObjectHeaders=false                        UseCompactObjectHeaders=true
 935             // adr = base + 16 + 8*i      ->  always                adr = base + 12 + 8*i      ->  never
 936             // -> vectorize                                         -> no vectorization
 937         }
 938     }
 939 
 940     @Test
 941     @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
 942                   IRNode.VECTOR_MASK_CMP_F, "=0",
 943                   IRNode.VECTOR_BLEND_F, "=0",
 944                   IRNode.STORE_VECTOR, "=0"},
 945         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 946         applyIf = {"UseVectorCmov", "true"})
 947     @IR(failOn = {IRNode.STORE_VECTOR},
 948         applyIf = {"UseVectorCmov", "false"})
 949     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 950         applyIf = {"UseVectorCmov", "false"},
 951         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 952     private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) {
 953         for (int i = 0; i < a.length; i+=2) {
 954             c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
 955             c[i+1] = (a[i+1] <  b[i+1]) ? 0.1f : -0.1f;
 956         }
 957     }
 958 
 959     @Test
 960     @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
 961                   IRNode.VECTOR_MASK_CMP_F, "=0",
 962                   IRNode.VECTOR_BLEND_F, "=0",
 963                   IRNode.STORE_VECTOR, "=0"},
 964         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 965         applyIf = {"UseVectorCmov", "true"})
 966     @IR(failOn = {IRNode.STORE_VECTOR},
 967         applyIf = {"UseVectorCmov", "false"})
 968     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
 969         applyIf = {"UseVectorCmov", "false"},
 970         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 971     private static void testCMoveFXXforFConstH2(float[] a, float[] b, float[] c) {
 972         for (int i = 0; i < a.length; i+=2) {
 973             c[i+0] = (a[i+0] <  b[i+0]) ? 0.1f : -0.1f;
 974             c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f;
 975         }
 976     }
 977 
 978     @Test
 979     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
 980                   IRNode.VECTOR_MASK_CMP_D, ">0",
 981                   IRNode.VECTOR_BLEND_D, ">0",
 982                   IRNode.STORE_VECTOR, ">0"},
 983         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
 984         applyIf = {"UseVectorCmov", "true"})
 985     @IR(failOn = {IRNode.STORE_VECTOR},
 986         applyIf = {"UseVectorCmov", "false"})
 987     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
 988         applyIf = {"UseVectorCmov", "false"},
 989         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
 990     private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) {
 991         for (int i = 0; i < a.length; i++) {
 992             c[i] = (a[i] > b[i]) ? 0.1 : -0.1;
 993         }
 994     }
 995 
 996     @Test
 997     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
 998                   IRNode.VECTOR_MASK_CMP_D, ">0",
 999                   IRNode.VECTOR_BLEND_D, ">0",
1000                   IRNode.STORE_VECTOR, ">0"},
1001         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1002         applyIf = {"UseVectorCmov", "true"})
1003     @IR(failOn = {IRNode.STORE_VECTOR},
1004         applyIf = {"UseVectorCmov", "false"})
1005     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1006         applyIf = {"UseVectorCmov", "false"},
1007         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1008     private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) {
1009         for (int i = 0; i < a.length; i++) {
1010             c[i] = (a[i] >= b[i]) ? 0.1 : -0.1;
1011         }
1012     }
1013 
1014     @Test
1015     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
1016                   IRNode.VECTOR_MASK_CMP_D, ">0",
1017                   IRNode.VECTOR_BLEND_D, ">0",
1018                   IRNode.STORE_VECTOR, ">0"},
1019         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1020         applyIf = {"UseVectorCmov", "true"})
1021     @IR(failOn = {IRNode.STORE_VECTOR},
1022         applyIf = {"UseVectorCmov", "false"})
1023     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1024         applyIf = {"UseVectorCmov", "false"},
1025         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1026     private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) {
1027         for (int i = 0; i < a.length; i++) {
1028             c[i] = (a[i] < b[i]) ? 0.1 : -0.1;
1029         }
1030     }
1031 
1032     @Test
1033     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
1034                   IRNode.VECTOR_MASK_CMP_D, ">0",
1035                   IRNode.VECTOR_BLEND_D, ">0",
1036                   IRNode.STORE_VECTOR, ">0"},
1037         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1038         applyIf = {"UseVectorCmov", "true"})
1039     @IR(failOn = {IRNode.STORE_VECTOR},
1040         applyIf = {"UseVectorCmov", "false"})
1041     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1042         applyIf = {"UseVectorCmov", "false"},
1043         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1044     private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) {
1045         for (int i = 0; i < a.length; i++) {
1046             c[i] = (a[i] <= b[i]) ? 0.1 : -0.1;
1047         }
1048     }
1049 
1050     @Test
1051     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
1052                   IRNode.VECTOR_MASK_CMP_D, ">0",
1053                   IRNode.VECTOR_BLEND_D, ">0",
1054                   IRNode.STORE_VECTOR, ">0"},
1055         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1056         applyIf = {"UseVectorCmov", "true"})
1057     @IR(failOn = {IRNode.STORE_VECTOR},
1058         applyIf = {"UseVectorCmov", "false"})
1059     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1060         applyIf = {"UseVectorCmov", "false"},
1061         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1062     private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) {
1063         for (int i = 0; i < a.length; i++) {
1064             c[i] = (a[i] == b[i]) ? 0.1 : -0.1;
1065         }
1066     }
1067 
1068     @Test
1069     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
1070                   IRNode.VECTOR_MASK_CMP_D, ">0",
1071                   IRNode.VECTOR_BLEND_D, ">0",
1072                   IRNode.STORE_VECTOR, ">0"},
1073         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1074         applyIf = {"UseVectorCmov", "true"})
1075     @IR(failOn = {IRNode.STORE_VECTOR},
1076         applyIf = {"UseVectorCmov", "false"})
1077     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1078         applyIf = {"UseVectorCmov", "false"},
1079         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1080     private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) {
1081         for (int i = 0; i < a.length; i++) {
1082             c[i] = (a[i] != b[i]) ? 0.1 : -0.1;
1083         }
1084     }
1085 
1086     @Test
1087     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
1088                   IRNode.VECTOR_MASK_CMP_D, ">0",
1089                   IRNode.VECTOR_BLEND_D, ">0",
1090                   IRNode.STORE_VECTOR, ">0"},
1091         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1092         applyIf = {"UseVectorCmov", "true"})
1093     @IR(failOn = {IRNode.STORE_VECTOR},
1094         applyIf = {"UseVectorCmov", "false"})
1095     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1096         applyIf = {"UseVectorCmov", "false"},
1097         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1098     private static void testCMoveDLTforDConstH2(double[] a, double[] b, double[] c) {
1099         for (int i = 0; i < a.length; i+=2) {
1100             c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1;
1101             c[i+1] = (a[i+1] < b[i+1]) ? 0.1 : -0.1;
1102         }
1103     }
1104 
1105     @Test
1106     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
1107                   IRNode.VECTOR_MASK_CMP_D, ">0",
1108                   IRNode.VECTOR_BLEND_D, ">0",
1109                   IRNode.STORE_VECTOR, ">0"},
1110         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1111         applyIf = {"UseVectorCmov", "true"})
1112     @IR(failOn = {IRNode.STORE_VECTOR},
1113         applyIf = {"UseVectorCmov", "false"})
1114     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1115         applyIf = {"UseVectorCmov", "false"},
1116         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1117     private static void testCMoveDLEforDConstH2(double[] a, double[] b, double[] c) {
1118         for (int i = 0; i < a.length; i+=2) {
1119             c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1;
1120             c[i+1] = (a[i+1] <= b[i+1]) ? 0.1 : -0.1;
1121         }
1122     }
1123 
1124     @Test
1125     @IR(counts = {IRNode.LOAD_VECTOR_D, "=0",
1126                   IRNode.VECTOR_MASK_CMP_D, "=0",
1127                   IRNode.VECTOR_BLEND_D, "=0",
1128                   IRNode.STORE_VECTOR, "=0"},
1129         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1130         applyIf = {"UseVectorCmov", "true"})
1131     @IR(failOn = {IRNode.STORE_VECTOR},
1132         applyIf = {"UseVectorCmov", "false"})
1133     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1134         applyIf = {"UseVectorCmov", "false"},
1135         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1136     private static void testCMoveDYYforDConstH2(double[] a, double[] b, double[] c) {
1137         for (int i = 0; i < a.length; i+=2) {
1138             c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1;
1139             c[i+1] = (a[i+1] <  b[i+1]) ? 0.1 : -0.1;
1140         }
1141     }
1142 
1143     @Test
1144     @IR(counts = {IRNode.LOAD_VECTOR_D, "=0",
1145                   IRNode.VECTOR_MASK_CMP_D, "=0",
1146                   IRNode.VECTOR_BLEND_D, "=0",
1147                   IRNode.STORE_VECTOR, "=0"},
1148         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1149         applyIf = {"UseVectorCmov", "true"})
1150     @IR(failOn = {IRNode.STORE_VECTOR},
1151         applyIf = {"UseVectorCmov", "false"})
1152     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
1153         applyIf = {"UseVectorCmov", "false"},
1154         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1155     private static void testCMoveDXXforDConstH2(double[] a, double[] b, double[] c) {
1156         for (int i = 0; i < a.length; i+=2) {
1157             c[i+0] = (a[i+0] <  b[i+0]) ? 0.1 : -0.1;
1158             c[i+1] = (a[i+1] <= b[i+1]) ? 0.1 : -0.1;
1159         }
1160     }
1161 
1162     // Extension: Compare 2 ILFD values, and pick from 2 ILFD values
1163     // Note:
1164     //   To guarantee that CMove is introduced, I need to perform the loads before the branch. To ensure they
1165     //   do not float down into the branches, I compute a value, and store it to r2 (same as r, except that the
1166     //   compilation does not know that).
1167     //   So far, vectorization only works for CMoveF/D, with same data-width comparison (F/I for F, D/L for D).
1168     //   TODO: enable CMOVE_I/L verification when it's guaranteed to generate CMOVE_I/L, JDK-8371984.
1169     //
1170     // Signed comparison: I/L
1171     //     I fo I
1172     @Test
1173     @IR(failOn = {IRNode.STORE_VECTOR})
1174     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"},
1175     //     applyIf = {"UseVectorCmov", "false"},
1176     //     applyIfPlatform = {"riscv64", "true"})
1177     private static void testCMoveIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1178         for (int i = 0; i < a.length; i++) {
1179             int cc = c[i];
1180             int dd = d[i];
1181             r2[i] = cc + dd;
1182             r[i] = (a[i] == b[i]) ? cc : dd;
1183         }
1184     }
1185 
1186     @Test
1187     @IR(failOn = {IRNode.STORE_VECTOR})
1188     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"},
1189     //     applyIf = {"UseVectorCmov", "false"},
1190     //     applyIfPlatform = {"riscv64", "true"})
1191     private static void testCMoveINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1192         for (int i = 0; i < a.length; i++) {
1193             int cc = c[i];
1194             int dd = d[i];
1195             r2[i] = cc + dd;
1196             r[i] = (a[i] != b[i]) ? cc : dd;
1197         }
1198     }
1199 
1200     @Test
1201     @IR(failOn = {IRNode.STORE_VECTOR})
1202     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"},
1203     //     applyIf = {"UseVectorCmov", "false"},
1204     //     applyIfPlatform = {"riscv64", "true"})
1205     private static void testCMoveIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1206         for (int i = 0; i < a.length; i++) {
1207             int cc = c[i];
1208             int dd = d[i];
1209             r2[i] = cc + dd;
1210             r[i] = (a[i] > b[i]) ? cc : dd;
1211         }
1212     }
1213 
1214     @Test
1215     @IR(failOn = {IRNode.STORE_VECTOR})
1216     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"},
1217     //     applyIf = {"UseVectorCmov", "false"},
1218     //     applyIfPlatform = {"riscv64", "true"})
1219     private static void testCMoveIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1220         for (int i = 0; i < a.length; i++) {
1221             int cc = c[i];
1222             int dd = d[i];
1223             r2[i] = cc + dd;
1224             r[i] = (a[i] >= b[i]) ? cc : dd;
1225         }
1226     }
1227 
1228     @Test
1229     @IR(failOn = {IRNode.STORE_VECTOR})
1230     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"},
1231     //     applyIf = {"UseVectorCmov", "false"},
1232     //     applyIfPlatform = {"riscv64", "true"})
1233     private static void testCMoveILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1234         for (int i = 0; i < a.length; i++) {
1235             int cc = c[i];
1236             int dd = d[i];
1237             r2[i] = cc + dd;
1238             r[i] = (a[i] < b[i]) ? cc : dd;
1239         }
1240     }
1241 
1242     @Test
1243     @IR(failOn = {IRNode.STORE_VECTOR})
1244     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"},
1245     //     applyIf = {"UseVectorCmov", "false"},
1246     //     applyIfPlatform = {"riscv64", "true"})
1247     private static void testCMoveILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1248         for (int i = 0; i < a.length; i++) {
1249             int cc = c[i];
1250             int dd = d[i];
1251             r2[i] = cc + dd;
1252             r[i] = (a[i] <= b[i]) ? cc : dd;
1253         }
1254     }
1255 
1256     //     I fo L
1257     @Test
1258     @IR(failOn = {IRNode.STORE_VECTOR})
1259     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"},
1260     //     applyIf = {"UseVectorCmov", "false"},
1261     //     applyIfPlatform = {"riscv64", "true"})
1262     private static void testCMoveIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
1263         for (int i = 0; i < a.length; i++) {
1264             long cc = c[i];
1265             long dd = d[i];
1266             r2[i] = cc + dd;
1267             r[i] = (a[i] == b[i]) ? cc : dd;
1268         }
1269     }
1270 
1271     @Test
1272     @IR(failOn = {IRNode.STORE_VECTOR})
1273     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"},
1274     //     applyIf = {"UseVectorCmov", "false"},
1275     //     applyIfPlatform = {"riscv64", "true"})
1276     private static void testCMoveINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
1277         for (int i = 0; i < a.length; i++) {
1278             long cc = c[i];
1279             long dd = d[i];
1280             r2[i] = cc + dd;
1281             r[i] = (a[i] != b[i]) ? cc : dd;
1282         }
1283     }
1284 
1285     @Test
1286     @IR(failOn = {IRNode.STORE_VECTOR})
1287     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"},
1288     //     applyIf = {"UseVectorCmov", "false"},
1289     //     applyIfPlatform = {"riscv64", "true"})
1290     private static void testCMoveIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
1291         for (int i = 0; i < a.length; i++) {
1292             long cc = c[i];
1293             long dd = d[i];
1294             r2[i] = cc + dd;
1295             r[i] = (a[i] > b[i]) ? cc : dd;
1296         }
1297     }
1298 
1299     @Test
1300     @IR(failOn = {IRNode.STORE_VECTOR})
1301     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"},
1302     //     applyIf = {"UseVectorCmov", "false"},
1303     //     applyIfPlatform = {"riscv64", "true"})
1304     private static void testCMoveIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
1305         for (int i = 0; i < a.length; i++) {
1306             long cc = c[i];
1307             long dd = d[i];
1308             r2[i] = cc + dd;
1309             r[i] = (a[i] >= b[i]) ? cc : dd;
1310         }
1311     }
1312 
1313     @Test
1314     @IR(failOn = {IRNode.STORE_VECTOR})
1315     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"},
1316     //     applyIf = {"UseVectorCmov", "false"},
1317     //     applyIfPlatform = {"riscv64", "true"})
1318     private static void testCMoveILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
1319         for (int i = 0; i < a.length; i++) {
1320             long cc = c[i];
1321             long dd = d[i];
1322             r2[i] = cc + dd;
1323             r[i] = (a[i] < b[i]) ? cc : dd;
1324         }
1325     }
1326 
1327     @Test
1328     @IR(failOn = {IRNode.STORE_VECTOR})
1329     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"},
1330     //     applyIf = {"UseVectorCmov", "false"},
1331     //     applyIfPlatform = {"riscv64", "true"})
1332     private static void testCMoveILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
1333         for (int i = 0; i < a.length; i++) {
1334             long cc = c[i];
1335             long dd = d[i];
1336             r2[i] = cc + dd;
1337             r[i] = (a[i] <= b[i]) ? cc : dd;
1338         }
1339     }
1340 
1341     //     I fo F
1342     @Test
1343     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1344                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1345                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1346                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1347                   IRNode.STORE_VECTOR, ">0"},
1348         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1349         applyIf = {"UseVectorCmov", "true"})
1350     @IR(failOn = {IRNode.STORE_VECTOR},
1351         applyIf = {"UseVectorCmov", "false"})
1352     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"},
1353         applyIf = {"UseVectorCmov", "false"},
1354         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1355     private static void testCMoveIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
1356         for (int i = 0; i < a.length; i++) {
1357             float cc = c[i];
1358             float dd = d[i];
1359             r2[i] = cc + dd;
1360             r[i] = (a[i] == b[i]) ? cc : dd;
1361         }
1362     }
1363 
1364     @Test
1365     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1366                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1367                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1368                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1369                   IRNode.STORE_VECTOR, ">0"},
1370         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1371         applyIf = {"UseVectorCmov", "true"})
1372     @IR(failOn = {IRNode.STORE_VECTOR},
1373         applyIf = {"UseVectorCmov", "false"})
1374     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"},
1375         applyIf = {"UseVectorCmov", "false"},
1376         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1377     private static void testCMoveINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
1378         for (int i = 0; i < a.length; i++) {
1379             float cc = c[i];
1380             float dd = d[i];
1381             r2[i] = cc + dd;
1382             r[i] = (a[i] != b[i]) ? cc : dd;
1383         }
1384     }
1385 
1386     @Test
1387     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1388                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1389                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1390                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1391                   IRNode.STORE_VECTOR, ">0"},
1392         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1393         applyIf = {"UseVectorCmov", "true"})
1394     @IR(failOn = {IRNode.STORE_VECTOR},
1395         applyIf = {"UseVectorCmov", "false"})
1396     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"},
1397         applyIf = {"UseVectorCmov", "false"},
1398         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1399     private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
1400         for (int i = 0; i < a.length; i++) {
1401             float cc = c[i];
1402             float dd = d[i];
1403             r2[i] = cc + dd;
1404             r[i] = (a[i] > b[i]) ? cc : dd;
1405         }
1406     }
1407 
1408     @Test
1409     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1410                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1411                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1412                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1413                   IRNode.STORE_VECTOR, ">0"},
1414         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1415         applyIf = {"UseVectorCmov", "true"})
1416     @IR(failOn = {IRNode.STORE_VECTOR},
1417         applyIf = {"UseVectorCmov", "false"})
1418     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"},
1419         applyIf = {"UseVectorCmov", "false"},
1420         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1421     private static void testCMoveIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
1422         for (int i = 0; i < a.length; i++) {
1423             float cc = c[i];
1424             float dd = d[i];
1425             r2[i] = cc + dd;
1426             r[i] = (a[i] >= b[i]) ? cc : dd;
1427         }
1428     }
1429 
1430     @Test
1431     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1432                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1433                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1434                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1435                   IRNode.STORE_VECTOR, ">0"},
1436         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1437         applyIf = {"UseVectorCmov", "true"})
1438     @IR(failOn = {IRNode.STORE_VECTOR},
1439         applyIf = {"UseVectorCmov", "false"})
1440     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"},
1441         applyIf = {"UseVectorCmov", "false"},
1442         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1443     private static void testCMoveILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
1444         for (int i = 0; i < a.length; i++) {
1445             float cc = c[i];
1446             float dd = d[i];
1447             r2[i] = cc + dd;
1448             r[i] = (a[i] < b[i]) ? cc : dd;
1449         }
1450     }
1451 
1452     @Test
1453     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1454                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1455                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1456                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
1457                   IRNode.STORE_VECTOR, ">0"},
1458         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
1459         applyIf = {"UseVectorCmov", "true"})
1460     @IR(failOn = {IRNode.STORE_VECTOR},
1461         applyIf = {"UseVectorCmov", "false"})
1462     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"},
1463         applyIf = {"UseVectorCmov", "false"},
1464         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1465     private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
1466         for (int i = 0; i < a.length; i++) {
1467             float cc = c[i];
1468             float dd = d[i];
1469             r2[i] = cc + dd;
1470             r[i] = (a[i] <= b[i]) ? cc : dd;
1471         }
1472     }
1473 
1474     //     I fo D
1475     @Test
1476     @IR(failOn = {IRNode.STORE_VECTOR})
1477     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"},
1478         applyIf = {"UseVectorCmov", "false"},
1479         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1480     private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
1481         for (int i = 0; i < a.length; i++) {
1482             double cc = c[i];
1483             double dd = d[i];
1484             r2[i] = cc + dd;
1485             r[i] = (a[i] == b[i]) ? cc : dd;
1486         }
1487     }
1488 
1489     @Test
1490     @IR(failOn = {IRNode.STORE_VECTOR})
1491     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"},
1492         applyIf = {"UseVectorCmov", "false"},
1493         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1494     private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
1495         for (int i = 0; i < a.length; i++) {
1496             double cc = c[i];
1497             double dd = d[i];
1498             r2[i] = cc + dd;
1499             r[i] = (a[i] != b[i]) ? cc : dd;
1500         }
1501     }
1502 
1503     @Test
1504     @IR(failOn = {IRNode.STORE_VECTOR})
1505     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"},
1506         applyIf = {"UseVectorCmov", "false"},
1507         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1508     private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
1509         for (int i = 0; i < a.length; i++) {
1510             double cc = c[i];
1511             double dd = d[i];
1512             r2[i] = cc + dd;
1513             r[i] = (a[i] > b[i]) ? cc : dd;
1514         }
1515     }
1516 
1517     @Test
1518     @IR(failOn = {IRNode.STORE_VECTOR})
1519     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"},
1520         applyIf = {"UseVectorCmov", "false"},
1521         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1522     private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
1523         for (int i = 0; i < a.length; i++) {
1524             double cc = c[i];
1525             double dd = d[i];
1526             r2[i] = cc + dd;
1527             r[i] = (a[i] >= b[i]) ? cc : dd;
1528         }
1529     }
1530 
1531     @Test
1532     @IR(failOn = {IRNode.STORE_VECTOR})
1533     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"},
1534         applyIf = {"UseVectorCmov", "false"},
1535         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1536     private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
1537         for (int i = 0; i < a.length; i++) {
1538             double cc = c[i];
1539             double dd = d[i];
1540             r2[i] = cc + dd;
1541             r[i] = (a[i] < b[i]) ? cc : dd;
1542         }
1543     }
1544 
1545     @Test
1546     @IR(failOn = {IRNode.STORE_VECTOR})
1547     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"},
1548         applyIf = {"UseVectorCmov", "false"},
1549         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1550     private static void testCMoveILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
1551         for (int i = 0; i < a.length; i++) {
1552             double cc = c[i];
1553             double dd = d[i];
1554             r2[i] = cc + dd;
1555             r[i] = (a[i] <= b[i]) ? cc : dd;
1556         }
1557     }
1558 
1559     //     L fo I
1560     @Test
1561     @IR(failOn = {IRNode.STORE_VECTOR})
1562     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"},
1563     //     applyIf = {"UseVectorCmov", "false"},
1564     //     applyIfPlatform = {"riscv64", "true"})
1565     private static void testCMoveLEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
1566         for (int i = 0; i < a.length; i++) {
1567             int cc = c[i];
1568             int dd = d[i];
1569             r2[i] = cc + dd;
1570             r[i] = (a[i] == b[i]) ? cc : dd;
1571         }
1572     }
1573 
1574     @Test
1575     @IR(failOn = {IRNode.STORE_VECTOR})
1576     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"},
1577     //     applyIf = {"UseVectorCmov", "false"},
1578     //     applyIfPlatform = {"riscv64", "true"})
1579     private static void testCMoveLNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
1580         for (int i = 0; i < a.length; i++) {
1581             int cc = c[i];
1582             int dd = d[i];
1583             r2[i] = cc + dd;
1584             r[i] = (a[i] != b[i]) ? cc : dd;
1585         }
1586     }
1587 
1588     @Test
1589     @IR(failOn = {IRNode.STORE_VECTOR})
1590     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"},
1591     //     applyIf = {"UseVectorCmov", "false"},
1592     //     applyIfPlatform = {"riscv64", "true"})
1593     private static void testCMoveLGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
1594         for (int i = 0; i < a.length; i++) {
1595             int cc = c[i];
1596             int dd = d[i];
1597             r2[i] = cc + dd;
1598             r[i] = (a[i] > b[i]) ? cc : dd;
1599         }
1600     }
1601 
1602     @Test
1603     @IR(failOn = {IRNode.STORE_VECTOR})
1604     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"},
1605     //     applyIf = {"UseVectorCmov", "false"},
1606     //     applyIfPlatform = {"riscv64", "true"})
1607     private static void testCMoveLGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
1608         for (int i = 0; i < a.length; i++) {
1609             int cc = c[i];
1610             int dd = d[i];
1611             r2[i] = cc + dd;
1612             r[i] = (a[i] >= b[i]) ? cc : dd;
1613         }
1614     }
1615 
1616     @Test
1617     @IR(failOn = {IRNode.STORE_VECTOR})
1618     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"},
1619     //     applyIf = {"UseVectorCmov", "false"},
1620     //     applyIfPlatform = {"riscv64", "true"})
1621     private static void testCMoveLLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
1622         for (int i = 0; i < a.length; i++) {
1623             int cc = c[i];
1624             int dd = d[i];
1625             r2[i] = cc + dd;
1626             r[i] = (a[i] < b[i]) ? cc : dd;
1627         }
1628     }
1629 
1630     @Test
1631     @IR(failOn = {IRNode.STORE_VECTOR})
1632     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"},
1633     //     applyIf = {"UseVectorCmov", "false"},
1634     //     applyIfPlatform = {"riscv64", "true"})
1635     private static void testCMoveLLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
1636         for (int i = 0; i < a.length; i++) {
1637             int cc = c[i];
1638             int dd = d[i];
1639             r2[i] = cc + dd;
1640             r[i] = (a[i] <= b[i]) ? cc : dd;
1641         }
1642     }
1643 
1644     //     L fo L
1645     @Test
1646     @IR(failOn = {IRNode.STORE_VECTOR})
1647     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"},
1648     //     applyIf = {"UseVectorCmov", "false"},
1649     //     applyIfPlatform = {"riscv64", "true"})
1650     private static void testCMoveLEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
1651         for (int i = 0; i < a.length; i++) {
1652             long cc = c[i];
1653             long dd = d[i];
1654             r2[i] = cc + dd;
1655             r[i] = (a[i] == b[i]) ? cc : dd;
1656         }
1657     }
1658 
1659     @Test
1660     @IR(failOn = {IRNode.STORE_VECTOR})
1661     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"},
1662     //     applyIf = {"UseVectorCmov", "false"},
1663     //     applyIfPlatform = {"riscv64", "true"})
1664     private static void testCMoveLNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
1665         for (int i = 0; i < a.length; i++) {
1666             long cc = c[i];
1667             long dd = d[i];
1668             r2[i] = cc + dd;
1669             r[i] = (a[i] != b[i]) ? cc : dd;
1670         }
1671     }
1672 
1673     @Test
1674     @IR(failOn = {IRNode.STORE_VECTOR})
1675     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"},
1676     //     applyIf = {"UseVectorCmov", "false"},
1677     //     applyIfPlatform = {"riscv64", "true"})
1678     private static void testCMoveLGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
1679         for (int i = 0; i < a.length; i++) {
1680             long cc = c[i];
1681             long dd = d[i];
1682             r2[i] = cc + dd;
1683             r[i] = (a[i] > b[i]) ? cc : dd;
1684         }
1685     }
1686 
1687     @Test
1688     @IR(failOn = {IRNode.STORE_VECTOR})
1689     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"},
1690     //     applyIf = {"UseVectorCmov", "false"},
1691     //     applyIfPlatform = {"riscv64", "true"})
1692     private static void testCMoveLGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
1693         for (int i = 0; i < a.length; i++) {
1694             long cc = c[i];
1695             long dd = d[i];
1696             r2[i] = cc + dd;
1697             r[i] = (a[i] >= b[i]) ? cc : dd;
1698         }
1699     }
1700 
1701     @Test
1702     @IR(failOn = {IRNode.STORE_VECTOR})
1703     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"},
1704     //     applyIf = {"UseVectorCmov", "false"},
1705     //     applyIfPlatform = {"riscv64", "true"})
1706     private static void testCMoveLLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
1707         for (int i = 0; i < a.length; i++) {
1708             long cc = c[i];
1709             long dd = d[i];
1710             r2[i] = cc + dd;
1711             r[i] = (a[i] < b[i]) ? cc : dd;
1712         }
1713     }
1714 
1715     @Test
1716     @IR(failOn = {IRNode.STORE_VECTOR})
1717     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"},
1718     //     applyIf = {"UseVectorCmov", "false"},
1719     //     applyIfPlatform = {"riscv64", "true"})
1720     private static void testCMoveLLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
1721         for (int i = 0; i < a.length; i++) {
1722             long cc = c[i];
1723             long dd = d[i];
1724             r2[i] = cc + dd;
1725             r[i] = (a[i] <= b[i]) ? cc : dd;
1726         }
1727     }
1728 
1729     //     L fo F
1730     @Test
1731     @IR(failOn = {IRNode.STORE_VECTOR})
1732     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"},
1733         applyIf = {"UseVectorCmov", "false"},
1734         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1735     private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
1736         for (int i = 0; i < a.length; i++) {
1737             float cc = c[i];
1738             float dd = d[i];
1739             r2[i] = cc + dd;
1740             r[i] = (a[i] == b[i]) ? cc : dd;
1741         }
1742     }
1743 
1744     @Test
1745     @IR(failOn = {IRNode.STORE_VECTOR})
1746     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"},
1747         applyIf = {"UseVectorCmov", "false"},
1748         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1749     private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
1750         for (int i = 0; i < a.length; i++) {
1751             float cc = c[i];
1752             float dd = d[i];
1753             r2[i] = cc + dd;
1754             r[i] = (a[i] != b[i]) ? cc : dd;
1755         }
1756     }
1757 
1758     @Test
1759     @IR(failOn = {IRNode.STORE_VECTOR})
1760     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"},
1761         applyIf = {"UseVectorCmov", "false"},
1762         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1763     private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
1764         for (int i = 0; i < a.length; i++) {
1765             float cc = c[i];
1766             float dd = d[i];
1767             r2[i] = cc + dd;
1768             r[i] = (a[i] > b[i]) ? cc : dd;
1769         }
1770     }
1771 
1772     @Test
1773     @IR(failOn = {IRNode.STORE_VECTOR})
1774     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"},
1775         applyIf = {"UseVectorCmov", "false"},
1776         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1777     private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
1778         for (int i = 0; i < a.length; i++) {
1779             float cc = c[i];
1780             float dd = d[i];
1781             r2[i] = cc + dd;
1782             r[i] = (a[i] >= b[i]) ? cc : dd;
1783         }
1784     }
1785 
1786     @Test
1787     @IR(failOn = {IRNode.STORE_VECTOR})
1788     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"},
1789         applyIf = {"UseVectorCmov", "false"},
1790         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1791     private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
1792         for (int i = 0; i < a.length; i++) {
1793             float cc = c[i];
1794             float dd = d[i];
1795             r2[i] = cc + dd;
1796             r[i] = (a[i] < b[i]) ? cc : dd;
1797         }
1798     }
1799 
1800     @Test
1801     @IR(failOn = {IRNode.STORE_VECTOR})
1802     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"},
1803         applyIf = {"UseVectorCmov", "false"},
1804         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1805     private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
1806         for (int i = 0; i < a.length; i++) {
1807             float cc = c[i];
1808             float dd = d[i];
1809             r2[i] = cc + dd;
1810             r[i] = (a[i] <= b[i]) ? cc : dd;
1811         }
1812     }
1813 
1814     //     L fo D
1815     @Test
1816     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1817                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1818                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1819                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1820                   IRNode.STORE_VECTOR, ">0"},
1821         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
1822         applyIf = {"UseVectorCmov", "true"})
1823     @IR(failOn = {IRNode.STORE_VECTOR},
1824         applyIf = {"UseVectorCmov", "false"})
1825     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"},
1826         applyIf = {"UseVectorCmov", "false"},
1827         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1828     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
1829     private static void testCMoveLEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
1830         for (int i = 0; i < a.length; i++) {
1831             double cc = c[i];
1832             double dd = d[i];
1833             r2[i] = cc + dd;
1834             r[i] = (a[i] == b[i]) ? cc : dd;
1835         }
1836     }
1837 
1838     @Test
1839     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1840                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1841                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1842                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1843                   IRNode.STORE_VECTOR, ">0"},
1844         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
1845         applyIf = {"UseVectorCmov", "true"})
1846     @IR(failOn = {IRNode.STORE_VECTOR},
1847         applyIf = {"UseVectorCmov", "false"})
1848     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"},
1849         applyIf = {"UseVectorCmov", "false"},
1850         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1851     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
1852     private static void testCMoveLNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
1853         for (int i = 0; i < a.length; i++) {
1854             double cc = c[i];
1855             double dd = d[i];
1856             r2[i] = cc + dd;
1857             r[i] = (a[i] != b[i]) ? cc : dd;
1858         }
1859     }
1860 
1861     @Test
1862     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1863                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1864                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1865                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1866                   IRNode.STORE_VECTOR, ">0"},
1867         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
1868         applyIf = {"UseVectorCmov", "true"})
1869     @IR(failOn = {IRNode.STORE_VECTOR},
1870         applyIf = {"UseVectorCmov", "false"})
1871     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"},
1872         applyIf = {"UseVectorCmov", "false"},
1873         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1874     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
1875     private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
1876         for (int i = 0; i < a.length; i++) {
1877             double cc = c[i];
1878             double dd = d[i];
1879             r2[i] = cc + dd;
1880             r[i] = (a[i] > b[i]) ? cc : dd;
1881         }
1882     }
1883 
1884     @Test
1885     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1886                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1887                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1888                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1889                   IRNode.STORE_VECTOR, ">0"},
1890         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
1891         applyIf = {"UseVectorCmov", "true"})
1892     @IR(failOn = {IRNode.STORE_VECTOR},
1893         applyIf = {"UseVectorCmov", "false"})
1894     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"},
1895         applyIf = {"UseVectorCmov", "false"},
1896         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1897     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
1898     private static void testCMoveLGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
1899         for (int i = 0; i < a.length; i++) {
1900             double cc = c[i];
1901             double dd = d[i];
1902             r2[i] = cc + dd;
1903             r[i] = (a[i] >= b[i]) ? cc : dd;
1904         }
1905     }
1906 
1907     @Test
1908     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1909                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1910                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1911                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1912                   IRNode.STORE_VECTOR, ">0"},
1913         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
1914         applyIf = {"UseVectorCmov", "true"})
1915     @IR(failOn = {IRNode.STORE_VECTOR},
1916         applyIf = {"UseVectorCmov", "false"})
1917     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"},
1918         applyIf = {"UseVectorCmov", "false"},
1919         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1920     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
1921     private static void testCMoveLLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
1922         for (int i = 0; i < a.length; i++) {
1923             double cc = c[i];
1924             double dd = d[i];
1925             r2[i] = cc + dd;
1926             r[i] = (a[i] < b[i]) ? cc : dd;
1927         }
1928     }
1929 
1930     @Test
1931     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1932                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1933                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1934                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
1935                   IRNode.STORE_VECTOR, ">0"},
1936         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
1937         applyIf = {"UseVectorCmov", "true"})
1938     @IR(failOn = {IRNode.STORE_VECTOR},
1939         applyIf = {"UseVectorCmov", "false"})
1940     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"},
1941         applyIf = {"UseVectorCmov", "false"},
1942         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
1943     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
1944     private static void testCMoveLLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
1945         for (int i = 0; i < a.length; i++) {
1946             double cc = c[i];
1947             double dd = d[i];
1948             r2[i] = cc + dd;
1949             r[i] = (a[i] <= b[i]) ? cc : dd;
1950         }
1951     }
1952 
1953     // Unsigned comparison: I/L
1954     //     I fo I
1955     @Test
1956     @IR(failOn = {IRNode.STORE_VECTOR})
1957     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"},
1958     //     applyIf = {"UseVectorCmov", "false"},
1959     //     applyIfPlatform = {"riscv64", "true"})
1960     private static void testCMoveUIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1961         for (int i = 0; i < a.length; i++) {
1962             int cc = c[i];
1963             int dd = d[i];
1964             r2[i] = cc + dd;
1965             r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
1966         }
1967     }
1968 
1969     @Test
1970     @IR(failOn = {IRNode.STORE_VECTOR})
1971     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"},
1972     //     applyIf = {"UseVectorCmov", "false"},
1973     //     applyIfPlatform = {"riscv64", "true"})
1974     private static void testCMoveUINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1975         for (int i = 0; i < a.length; i++) {
1976             int cc = c[i];
1977             int dd = d[i];
1978             r2[i] = cc + dd;
1979             r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
1980         }
1981     }
1982 
1983     @Test
1984     @IR(failOn = {IRNode.STORE_VECTOR})
1985     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"},
1986     //     applyIf = {"UseVectorCmov", "false"},
1987     //     applyIfPlatform = {"riscv64", "true"})
1988     private static void testCMoveUIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
1989         for (int i = 0; i < a.length; i++) {
1990             int cc = c[i];
1991             int dd = d[i];
1992             r2[i] = cc + dd;
1993             r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
1994         }
1995     }
1996 
1997     @Test
1998     @IR(failOn = {IRNode.STORE_VECTOR})
1999     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"},
2000     //     applyIf = {"UseVectorCmov", "false"},
2001     //     applyIfPlatform = {"riscv64", "true"})
2002     private static void testCMoveUIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
2003         for (int i = 0; i < a.length; i++) {
2004             int cc = c[i];
2005             int dd = d[i];
2006             r2[i] = cc + dd;
2007             r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2008         }
2009     }
2010 
2011     @Test
2012     @IR(failOn = {IRNode.STORE_VECTOR})
2013     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"},
2014     //     applyIf = {"UseVectorCmov", "false"},
2015     //     applyIfPlatform = {"riscv64", "true"})
2016     private static void testCMoveUILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
2017         for (int i = 0; i < a.length; i++) {
2018             int cc = c[i];
2019             int dd = d[i];
2020             r2[i] = cc + dd;
2021             r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2022         }
2023     }
2024 
2025     @Test
2026     @IR(failOn = {IRNode.STORE_VECTOR})
2027     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"},
2028     //     applyIf = {"UseVectorCmov", "false"},
2029     //     applyIfPlatform = {"riscv64", "true"})
2030     private static void testCMoveUILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) {
2031         for (int i = 0; i < a.length; i++) {
2032             int cc = c[i];
2033             int dd = d[i];
2034             r2[i] = cc + dd;
2035             r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2036         }
2037     }
2038 
2039     //     I fo L
2040     @Test
2041     @IR(failOn = {IRNode.STORE_VECTOR})
2042     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"},
2043     //     applyIf = {"UseVectorCmov", "false"},
2044     //     applyIfPlatform = {"riscv64", "true"})
2045     private static void testCMoveUIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
2046         for (int i = 0; i < a.length; i++) {
2047             long cc = c[i];
2048             long dd = d[i];
2049             r2[i] = cc + dd;
2050             r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
2051         }
2052     }
2053 
2054     @Test
2055     @IR(failOn = {IRNode.STORE_VECTOR})
2056     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"},
2057     //     applyIf = {"UseVectorCmov", "false"},
2058     //     applyIfPlatform = {"riscv64", "true"})
2059     private static void testCMoveUINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
2060         for (int i = 0; i < a.length; i++) {
2061             long cc = c[i];
2062             long dd = d[i];
2063             r2[i] = cc + dd;
2064             r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
2065         }
2066     }
2067 
2068     @Test
2069     @IR(failOn = {IRNode.STORE_VECTOR})
2070     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"},
2071     //     applyIf = {"UseVectorCmov", "false"},
2072     //     applyIfPlatform = {"riscv64", "true"})
2073     private static void testCMoveUIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
2074         for (int i = 0; i < a.length; i++) {
2075             long cc = c[i];
2076             long dd = d[i];
2077             r2[i] = cc + dd;
2078             r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
2079         }
2080     }
2081 
2082     @Test
2083     @IR(failOn = {IRNode.STORE_VECTOR})
2084     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"},
2085     //     applyIf = {"UseVectorCmov", "false"},
2086     //     applyIfPlatform = {"riscv64", "true"})
2087     private static void testCMoveUIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
2088         for (int i = 0; i < a.length; i++) {
2089             long cc = c[i];
2090             long dd = d[i];
2091             r2[i] = cc + dd;
2092             r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2093         }
2094     }
2095 
2096     @Test
2097     @IR(failOn = {IRNode.STORE_VECTOR})
2098     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"},
2099     //     applyIf = {"UseVectorCmov", "false"},
2100     //     applyIfPlatform = {"riscv64", "true"})
2101     private static void testCMoveUILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
2102         for (int i = 0; i < a.length; i++) {
2103             long cc = c[i];
2104             long dd = d[i];
2105             r2[i] = cc + dd;
2106             r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2107         }
2108     }
2109 
2110     @Test
2111     @IR(failOn = {IRNode.STORE_VECTOR})
2112     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"},
2113     //     applyIf = {"UseVectorCmov", "false"},
2114     //     applyIfPlatform = {"riscv64", "true"})
2115     private static void testCMoveUILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) {
2116         for (int i = 0; i < a.length; i++) {
2117             long cc = c[i];
2118             long dd = d[i];
2119             r2[i] = cc + dd;
2120             r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2121         }
2122     }
2123 
2124     //     I fo F
2125     @Test
2126     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2127                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2128                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2129                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2130                   IRNode.STORE_VECTOR, ">0"},
2131         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2132         applyIf = {"UseVectorCmov", "true"})
2133     @IR(failOn = {IRNode.STORE_VECTOR},
2134         applyIf = {"UseVectorCmov", "false"})
2135     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"},
2136         applyIf = {"UseVectorCmov", "false"},
2137             applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2138     private static void testCMoveUIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
2139         for (int i = 0; i < a.length; i++) {
2140             float cc = c[i];
2141             float dd = d[i];
2142             r2[i] = cc + dd;
2143             r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
2144         }
2145     }
2146 
2147     @Test
2148     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2149                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2150                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2151                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2152                   IRNode.STORE_VECTOR, ">0"},
2153         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2154         applyIf = {"UseVectorCmov", "true"})
2155     @IR(failOn = {IRNode.STORE_VECTOR},
2156         applyIf = {"UseVectorCmov", "false"})
2157     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"},
2158         applyIf = {"UseVectorCmov", "false"},
2159             applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2160     private static void testCMoveUINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
2161         for (int i = 0; i < a.length; i++) {
2162             float cc = c[i];
2163             float dd = d[i];
2164             r2[i] = cc + dd;
2165             r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
2166         }
2167     }
2168 
2169     @Test
2170     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2171                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2172                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2173                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2174                   IRNode.STORE_VECTOR, ">0"},
2175         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2176         applyIf = {"UseVectorCmov", "true"})
2177     @IR(failOn = {IRNode.STORE_VECTOR},
2178         applyIf = {"UseVectorCmov", "false"})
2179     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"},
2180         applyIf = {"UseVectorCmov", "false"},
2181             applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2182     private static void testCMoveUIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
2183         for (int i = 0; i < a.length; i++) {
2184             float cc = c[i];
2185             float dd = d[i];
2186             r2[i] = cc + dd;
2187             r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
2188         }
2189     }
2190 
2191     @Test
2192     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2193                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2194                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2195                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2196                   IRNode.STORE_VECTOR, ">0"},
2197         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2198         applyIf = {"UseVectorCmov", "true"})
2199     @IR(failOn = {IRNode.STORE_VECTOR},
2200         applyIf = {"UseVectorCmov", "false"})
2201     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"},
2202         applyIf = {"UseVectorCmov", "false"},
2203             applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2204     private static void testCMoveUIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
2205         for (int i = 0; i < a.length; i++) {
2206             float cc = c[i];
2207             float dd = d[i];
2208             r2[i] = cc + dd;
2209             r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2210         }
2211     }
2212 
2213     @Test
2214     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2215                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2216                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2217                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2218                   IRNode.STORE_VECTOR, ">0"},
2219         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2220         applyIf = {"UseVectorCmov", "true"})
2221     @IR(failOn = {IRNode.STORE_VECTOR},
2222         applyIf = {"UseVectorCmov", "false"})
2223     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"},
2224         applyIf = {"UseVectorCmov", "false"},
2225             applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2226     private static void testCMoveUILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
2227         for (int i = 0; i < a.length; i++) {
2228             float cc = c[i];
2229             float dd = d[i];
2230             r2[i] = cc + dd;
2231             r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2232         }
2233     }
2234 
2235     @Test
2236     @IR(counts = {IRNode.LOAD_VECTOR_I,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2237                   IRNode.LOAD_VECTOR_F,     IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2238                   IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2239                   IRNode.VECTOR_BLEND_F,    IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0",
2240                   IRNode.STORE_VECTOR, ">0"},
2241         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2242         applyIf = {"UseVectorCmov", "true"})
2243     @IR(failOn = {IRNode.STORE_VECTOR},
2244         applyIf = {"UseVectorCmov", "false"})
2245     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"},
2246         applyIf = {"UseVectorCmov", "false"},
2247             applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2248     private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) {
2249         for (int i = 0; i < a.length; i++) {
2250             float cc = c[i];
2251             float dd = d[i];
2252             r2[i] = cc + dd;
2253             r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2254         }
2255     }
2256 
2257     //     I fo D
2258     @Test
2259     @IR(failOn = {IRNode.STORE_VECTOR})
2260     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"},
2261         applyIf = {"UseVectorCmov", "false"},
2262         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2263     private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
2264         for (int i = 0; i < a.length; i++) {
2265             double cc = c[i];
2266             double dd = d[i];
2267             r2[i] = cc + dd;
2268             r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
2269         }
2270     }
2271 
2272     @Test
2273     @IR(failOn = {IRNode.STORE_VECTOR})
2274     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"},
2275         applyIf = {"UseVectorCmov", "false"},
2276         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2277     private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
2278         for (int i = 0; i < a.length; i++) {
2279             double cc = c[i];
2280             double dd = d[i];
2281             r2[i] = cc + dd;
2282             r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
2283         }
2284     }
2285 
2286     @Test
2287     @IR(failOn = {IRNode.STORE_VECTOR})
2288     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"},
2289         applyIf = {"UseVectorCmov", "false"},
2290         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2291     private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
2292         for (int i = 0; i < a.length; i++) {
2293             double cc = c[i];
2294             double dd = d[i];
2295             r2[i] = cc + dd;
2296             r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
2297         }
2298     }
2299 
2300     @Test
2301     @IR(failOn = {IRNode.STORE_VECTOR})
2302     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"},
2303         applyIf = {"UseVectorCmov", "false"},
2304         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2305     private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
2306         for (int i = 0; i < a.length; i++) {
2307             double cc = c[i];
2308             double dd = d[i];
2309             r2[i] = cc + dd;
2310             r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2311         }
2312     }
2313 
2314     @Test
2315     @IR(failOn = {IRNode.STORE_VECTOR})
2316     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"},
2317         applyIf = {"UseVectorCmov", "false"},
2318         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2319     private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
2320         for (int i = 0; i < a.length; i++) {
2321             double cc = c[i];
2322             double dd = d[i];
2323             r2[i] = cc + dd;
2324             r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2325         }
2326     }
2327 
2328     @Test
2329     @IR(failOn = {IRNode.STORE_VECTOR})
2330     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"},
2331         applyIf = {"UseVectorCmov", "false"},
2332         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2333     private static void testCMoveUILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) {
2334         for (int i = 0; i < a.length; i++) {
2335             double cc = c[i];
2336             double dd = d[i];
2337             r2[i] = cc + dd;
2338             r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2339         }
2340     }
2341 
2342     //     L fo I
2343     @Test
2344     @IR(failOn = {IRNode.STORE_VECTOR})
2345     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"},
2346     //     applyIf = {"UseVectorCmov", "false"},
2347     //     applyIfPlatform = {"riscv64", "true"})
2348     private static void testCMoveULEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
2349         for (int i = 0; i < a.length; i++) {
2350             int cc = c[i];
2351             int dd = d[i];
2352             r2[i] = cc + dd;
2353             r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
2354         }
2355     }
2356 
2357     @Test
2358     @IR(failOn = {IRNode.STORE_VECTOR})
2359     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"},
2360     //     applyIf = {"UseVectorCmov", "false"},
2361     //     applyIfPlatform = {"riscv64", "true"})
2362     private static void testCMoveULNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
2363         for (int i = 0; i < a.length; i++) {
2364             int cc = c[i];
2365             int dd = d[i];
2366             r2[i] = cc + dd;
2367             r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
2368         }
2369     }
2370 
2371     @Test
2372     @IR(failOn = {IRNode.STORE_VECTOR})
2373     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"},
2374     //     applyIf = {"UseVectorCmov", "false"},
2375     //     applyIfPlatform = {"riscv64", "true"})
2376     private static void testCMoveULGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
2377         for (int i = 0; i < a.length; i++) {
2378             int cc = c[i];
2379             int dd = d[i];
2380             r2[i] = cc + dd;
2381             r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
2382         }
2383     }
2384 
2385     @Test
2386     @IR(failOn = {IRNode.STORE_VECTOR})
2387     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"},
2388     //     applyIf = {"UseVectorCmov", "false"},
2389     //     applyIfPlatform = {"riscv64", "true"})
2390     private static void testCMoveULGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
2391         for (int i = 0; i < a.length; i++) {
2392             int cc = c[i];
2393             int dd = d[i];
2394             r2[i] = cc + dd;
2395             r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2396         }
2397     }
2398 
2399     @Test
2400     @IR(failOn = {IRNode.STORE_VECTOR})
2401     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"},
2402     //     applyIf = {"UseVectorCmov", "false"},
2403     //     applyIfPlatform = {"riscv64", "true"})
2404     private static void testCMoveULLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
2405         for (int i = 0; i < a.length; i++) {
2406             int cc = c[i];
2407             int dd = d[i];
2408             r2[i] = cc + dd;
2409             r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2410         }
2411     }
2412 
2413     @Test
2414     @IR(failOn = {IRNode.STORE_VECTOR})
2415     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"},
2416     //     applyIf = {"UseVectorCmov", "false"},
2417     //     applyIfPlatform = {"riscv64", "true"})
2418     private static void testCMoveULLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) {
2419         for (int i = 0; i < a.length; i++) {
2420             int cc = c[i];
2421             int dd = d[i];
2422             r2[i] = cc + dd;
2423             r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2424         }
2425     }
2426 
2427     //     L fo L
2428     @Test
2429     @IR(failOn = {IRNode.STORE_VECTOR})
2430     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"},
2431     //     applyIf = {"UseVectorCmov", "false"},
2432     //     applyIfPlatform = {"riscv64", "true"})
2433     private static void testCMoveULEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
2434         for (int i = 0; i < a.length; i++) {
2435             long cc = c[i];
2436             long dd = d[i];
2437             r2[i] = cc + dd;
2438             r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
2439         }
2440     }
2441 
2442     @Test
2443     @IR(failOn = {IRNode.STORE_VECTOR})
2444     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"},
2445     //     applyIf = {"UseVectorCmov", "false"},
2446     //     applyIfPlatform = {"riscv64", "true"})
2447     private static void testCMoveULNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
2448         for (int i = 0; i < a.length; i++) {
2449             long cc = c[i];
2450             long dd = d[i];
2451             r2[i] = cc + dd;
2452             r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
2453         }
2454     }
2455 
2456     @Test
2457     @IR(failOn = {IRNode.STORE_VECTOR})
2458     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"},
2459     //     applyIf = {"UseVectorCmov", "false"},
2460     //     applyIfPlatform = {"riscv64", "true"})
2461     private static void testCMoveULGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
2462         for (int i = 0; i < a.length; i++) {
2463             long cc = c[i];
2464             long dd = d[i];
2465             r2[i] = cc + dd;
2466             r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
2467         }
2468     }
2469 
2470     @Test
2471     @IR(failOn = {IRNode.STORE_VECTOR})
2472     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"},
2473     //     applyIf = {"UseVectorCmov", "false"},
2474     //     applyIfPlatform = {"riscv64", "true"})
2475     private static void testCMoveULGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
2476         for (int i = 0; i < a.length; i++) {
2477             long cc = c[i];
2478             long dd = d[i];
2479             r2[i] = cc + dd;
2480             r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2481         }
2482     }
2483 
2484     @Test
2485     @IR(failOn = {IRNode.STORE_VECTOR})
2486     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"},
2487     //     applyIf = {"UseVectorCmov", "false"},
2488     //     applyIfPlatform = {"riscv64", "true"})
2489     private static void testCMoveULLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
2490         for (int i = 0; i < a.length; i++) {
2491             long cc = c[i];
2492             long dd = d[i];
2493             r2[i] = cc + dd;
2494             r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2495         }
2496     }
2497 
2498     @Test
2499     @IR(failOn = {IRNode.STORE_VECTOR})
2500     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"},
2501     //     applyIf = {"UseVectorCmov", "false"},
2502     //     applyIfPlatform = {"riscv64", "true"})
2503     private static void testCMoveULLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) {
2504         for (int i = 0; i < a.length; i++) {
2505             long cc = c[i];
2506             long dd = d[i];
2507             r2[i] = cc + dd;
2508             r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2509         }
2510     }
2511 
2512     //     L fo F
2513     @Test
2514     @IR(failOn = {IRNode.STORE_VECTOR})
2515     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"},
2516         applyIf = {"UseVectorCmov", "false"},
2517         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2518     private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
2519         for (int i = 0; i < a.length; i++) {
2520             float cc = c[i];
2521             float dd = d[i];
2522             r2[i] = cc + dd;
2523             r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
2524         }
2525     }
2526 
2527     @Test
2528     @IR(failOn = {IRNode.STORE_VECTOR})
2529     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"},
2530         applyIf = {"UseVectorCmov", "false"},
2531         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2532     private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
2533         for (int i = 0; i < a.length; i++) {
2534             float cc = c[i];
2535             float dd = d[i];
2536             r2[i] = cc + dd;
2537             r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
2538         }
2539     }
2540 
2541     @Test
2542     @IR(failOn = {IRNode.STORE_VECTOR})
2543     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"},
2544         applyIf = {"UseVectorCmov", "false"},
2545         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2546     private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
2547         for (int i = 0; i < a.length; i++) {
2548             float cc = c[i];
2549             float dd = d[i];
2550             r2[i] = cc + dd;
2551             r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
2552         }
2553     }
2554 
2555     @Test
2556     @IR(failOn = {IRNode.STORE_VECTOR})
2557     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"},
2558         applyIf = {"UseVectorCmov", "false"},
2559         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2560     private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
2561         for (int i = 0; i < a.length; i++) {
2562             float cc = c[i];
2563             float dd = d[i];
2564             r2[i] = cc + dd;
2565             r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2566         }
2567     }
2568 
2569     @Test
2570     @IR(failOn = {IRNode.STORE_VECTOR})
2571     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"},
2572         applyIf = {"UseVectorCmov", "false"},
2573         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2574     private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
2575         for (int i = 0; i < a.length; i++) {
2576             float cc = c[i];
2577             float dd = d[i];
2578             r2[i] = cc + dd;
2579             r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2580         }
2581     }
2582 
2583     @Test
2584     @IR(failOn = {IRNode.STORE_VECTOR})
2585     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"},
2586         applyIf = {"UseVectorCmov", "false"},
2587         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2588     private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) {
2589         for (int i = 0; i < a.length; i++) {
2590             float cc = c[i];
2591             float dd = d[i];
2592             r2[i] = cc + dd;
2593             r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2594         }
2595     }
2596 
2597     //     L fo D
2598     @Test
2599     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2600                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2601                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2602                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2603                   IRNode.STORE_VECTOR, ">0"},
2604         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
2605         applyIf = {"UseVectorCmov", "true"})
2606     @IR(failOn = {IRNode.STORE_VECTOR},
2607         applyIf = {"UseVectorCmov", "false"})
2608     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"},
2609         applyIf = {"UseVectorCmov", "false"},
2610         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2611     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
2612     private static void testCMoveULEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
2613         for (int i = 0; i < a.length; i++) {
2614             double cc = c[i];
2615             double dd = d[i];
2616             r2[i] = cc + dd;
2617             r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd;
2618         }
2619     }
2620 
2621     @Test
2622     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2623                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2624                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2625                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2626                   IRNode.STORE_VECTOR, ">0"},
2627         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
2628         applyIf = {"UseVectorCmov", "true"})
2629     @IR(failOn = {IRNode.STORE_VECTOR},
2630         applyIf = {"UseVectorCmov", "false"})
2631     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"},
2632         applyIf = {"UseVectorCmov", "false"},
2633         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2634     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
2635     private static void testCMoveULNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
2636         for (int i = 0; i < a.length; i++) {
2637             double cc = c[i];
2638             double dd = d[i];
2639             r2[i] = cc + dd;
2640             r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd;
2641         }
2642     }
2643 
2644     @Test
2645     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2646                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2647                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2648                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2649                   IRNode.STORE_VECTOR, ">0"},
2650         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
2651         applyIf = {"UseVectorCmov", "true"})
2652     @IR(failOn = {IRNode.STORE_VECTOR},
2653         applyIf = {"UseVectorCmov", "false"})
2654     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"},
2655         applyIf = {"UseVectorCmov", "false"},
2656         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2657     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
2658     private static void testCMoveULGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
2659         for (int i = 0; i < a.length; i++) {
2660             double cc = c[i];
2661             double dd = d[i];
2662             r2[i] = cc + dd;
2663             r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd;
2664         }
2665     }
2666 
2667     @Test
2668     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2669                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2670                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2671                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2672                   IRNode.STORE_VECTOR, ">0"},
2673         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
2674         applyIf = {"UseVectorCmov", "true"})
2675     @IR(failOn = {IRNode.STORE_VECTOR},
2676         applyIf = {"UseVectorCmov", "false"})
2677     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"},
2678         applyIf = {"UseVectorCmov", "false"},
2679         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2680     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
2681     private static void testCMoveULGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
2682         for (int i = 0; i < a.length; i++) {
2683             double cc = c[i];
2684             double dd = d[i];
2685             r2[i] = cc + dd;
2686             r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd;
2687         }
2688     }
2689 
2690     @Test
2691     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2692                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2693                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2694                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2695                   IRNode.STORE_VECTOR, ">0"},
2696         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
2697         applyIf = {"UseVectorCmov", "true"})
2698     @IR(failOn = {IRNode.STORE_VECTOR},
2699         applyIf = {"UseVectorCmov", "false"})
2700     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"},
2701         applyIf = {"UseVectorCmov", "false"},
2702         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2703     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
2704     private static void testCMoveULLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
2705         for (int i = 0; i < a.length; i++) {
2706             double cc = c[i];
2707             double dd = d[i];
2708             r2[i] = cc + dd;
2709             r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd;
2710         }
2711     }
2712 
2713     @Test
2714     @IR(counts = {IRNode.LOAD_VECTOR_L,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2715                   IRNode.LOAD_VECTOR_D,     IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2716                   IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2717                   IRNode.VECTOR_BLEND_D,    IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0",
2718                   IRNode.STORE_VECTOR, ">0"},
2719         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"},
2720         applyIf = {"UseVectorCmov", "true"})
2721     @IR(failOn = {IRNode.STORE_VECTOR},
2722         applyIf = {"UseVectorCmov", "false"})
2723     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"},
2724         applyIf = {"UseVectorCmov", "false"},
2725         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2726     // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4.
2727     private static void testCMoveULLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) {
2728         for (int i = 0; i < a.length; i++) {
2729             double cc = c[i];
2730             double dd = d[i];
2731             r2[i] = cc + dd;
2732             r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd;
2733         }
2734     }
2735 
2736     @Test
2737     @IR(failOn = {IRNode.STORE_VECTOR})
2738     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_F, ">0"},
2739     //     applyIf = {"UseVectorCmov", "false"},
2740     //     applyIfPlatform = {"riscv64", "true"})
2741     private static void testCMoveFGTforI(float[] a, float[] b, int[] c, int[] d, int[] r, int[] r2) {
2742         for (int i = 0; i < a.length; i++) {
2743             int cc = c[i];
2744             int dd = d[i];
2745             r2[i] = cc + dd;
2746             r[i] = (a[i] > b[i]) ? cc : dd;
2747         }
2748     }
2749 
2750     @Test
2751     @IR(failOn = {IRNode.STORE_VECTOR})
2752     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_F, ">0"},
2753     //     applyIf = {"UseVectorCmov", "false"},
2754     //     applyIfPlatform = {"riscv64", "true"})
2755     private static void testCMoveFGTforL(float[] a, float[] b, long[] c, long[] d, long[] r, long[] r2) {
2756         for (int i = 0; i < a.length; i++) {
2757             long cc = c[i];
2758             long dd = d[i];
2759             r2[i] = cc + dd;
2760             r[i] = (a[i] > b[i]) ? cc : dd;
2761         }
2762     }
2763 
2764     @Test
2765     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
2766                   IRNode.VECTOR_MASK_CMP_F, ">0",
2767                   IRNode.VECTOR_BLEND_F, ">0",
2768                   IRNode.STORE_VECTOR, ">0"},
2769         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2770         applyIf = {"UseVectorCmov", "true"})
2771     @IR(failOn = {IRNode.STORE_VECTOR},
2772         applyIf = {"UseVectorCmov", "false"})
2773     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
2774         applyIf = {"UseVectorCmov", "false"},
2775         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2776     private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, float[] r, float[] r2) {
2777         for (int i = 0; i < a.length; i++) {
2778             float cc = c[i];
2779             float dd = d[i];
2780             r2[i] = cc + dd;
2781             r[i] = (a[i] > b[i]) ? cc : dd;
2782         }
2783     }
2784 
2785     @Test
2786     @IR(failOn = {IRNode.STORE_VECTOR})
2787     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_F, ">0"},
2788         applyIf = {"UseVectorCmov", "false"},
2789         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2790     private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] d, double[] r, double[] r2) {
2791         for (int i = 0; i < a.length; i++) {
2792             double cc = c[i];
2793             double dd = d[i];
2794             r2[i] = cc + dd;
2795             r[i] = (a[i] > b[i]) ? cc : dd;
2796         }
2797     }
2798 
2799     @Test
2800     @IR(failOn = {IRNode.STORE_VECTOR})
2801     // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_D, ">0"},
2802     //     applyIf = {"UseVectorCmov", "false"},
2803     //     applyIfPlatform = {"riscv64", "true"})
2804     private static void testCMoveDGTforI(double[] a, double[] b, int[] c, int[] d, int[] r, int[] r2) {
2805         for (int i = 0; i < a.length; i++) {
2806             int cc = c[i];
2807             int dd = d[i];
2808             r2[i] = cc + dd;
2809             r[i] = (a[i] > b[i]) ? cc : dd;
2810         }
2811     }
2812 
2813     @Test
2814     @IR(failOn = {IRNode.STORE_VECTOR})
2815     // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_D, ">0"},
2816     //     applyIf = {"UseVectorCmov", "false"},
2817     //     applyIfPlatform = {"riscv64", "true"})
2818     private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, long[] r, long[] r2) {
2819         for (int i = 0; i < a.length; i++) {
2820             long cc = c[i];
2821             long dd = d[i];
2822             r2[i] = cc + dd;
2823             r[i] = (a[i] > b[i]) ? cc : dd;
2824         }
2825     }
2826 
2827     @Test
2828     @IR(failOn = {IRNode.STORE_VECTOR})
2829     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_D, ">0"},
2830         applyIf = {"UseVectorCmov", "false"},
2831         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2832     private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] d, float[] r, float[] r2) {
2833         for (int i = 0; i < a.length; i++) {
2834             float cc = c[i];
2835             float dd = d[i];
2836             r2[i] = cc + dd;
2837             r[i] = (a[i] > b[i]) ? cc : dd;
2838         }
2839     }
2840 
2841     @Test
2842     @IR(counts = {IRNode.LOAD_VECTOR_D, ">0",
2843                   IRNode.VECTOR_MASK_CMP_D, ">0",
2844                   IRNode.VECTOR_BLEND_D, ">0",
2845                   IRNode.STORE_VECTOR, ">0"},
2846         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2847         applyIf = {"UseVectorCmov", "true"})
2848     @IR(failOn = {IRNode.STORE_VECTOR},
2849         applyIf = {"UseVectorCmov", "false"})
2850     @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"},
2851         applyIf = {"UseVectorCmov", "false"},
2852         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2853     private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[] d, double[] r, double[] r2) {
2854         for (int i = 0; i < a.length; i++) {
2855             double cc = c[i];
2856             double dd = d[i];
2857             r2[i] = cc + dd;
2858             r[i] = (a[i] > b[i]) ? cc : dd;
2859         }
2860     }
2861 
2862     // Use some constants in the comparison
2863     @Test
2864     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
2865                   IRNode.VECTOR_MASK_CMP_F, ">0",
2866                   IRNode.VECTOR_BLEND_F, ">0",
2867                   IRNode.STORE_VECTOR, ">0"},
2868         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2869         applyIf = {"UseVectorCmov", "true"})
2870     @IR(failOn = {IRNode.STORE_VECTOR},
2871         applyIf = {"UseVectorCmov", "false"})
2872     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
2873         applyIf = {"UseVectorCmov", "false"},
2874         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2875     private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float[] d, float[] r, float[] r2) {
2876         for (int i = 0; i < b.length; i++) {
2877             float cc = c[i];
2878             float dd = d[i];
2879             r2[i] = cc + dd;
2880             r[i] = (a > b[i]) ? cc : dd;
2881         }
2882     }
2883 
2884     @Test
2885     @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
2886                   IRNode.VECTOR_MASK_CMP_F, ">0",
2887                   IRNode.VECTOR_BLEND_F, ">0",
2888                   IRNode.STORE_VECTOR, ">0"},
2889         applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"},
2890         applyIf = {"UseVectorCmov", "true"})
2891     @IR(failOn = {IRNode.STORE_VECTOR},
2892         applyIf = {"UseVectorCmov", "false"})
2893     @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"},
2894         applyIf = {"UseVectorCmov", "false"},
2895         applyIfPlatformOr = {"riscv64", "true", "x64", "true", "aarch64", "true"})
2896     private static void testCMoveFGTforFCmpCon2(float[] a, float b, float[] c, float[] d, float[] r, float[] r2) {
2897         for (int i = 0; i < a.length; i++) {
2898             float cc = c[i];
2899             float dd = d[i];
2900             r2[i] = cc + dd;
2901             r[i] = (a[i] > b) ? cc : dd;
2902         }
2903     }
2904 
2905     // A case that is currently not supported and is not expected to vectorize
2906     @Test
2907     @IR(failOn = {IRNode.STORE_VECTOR})
2908     private static void testCMoveVDUnsupported() {
2909         double[] doublec = new double[SIZE];
2910         int seed = 1001;
2911         for (int i = 0; i < doublec.length; i++) {
2912             doublec[i] = (i % 2 == 0) ? seed + i : seed - i;
2913         }
2914     }
2915 
2916     @Warmup(0)
2917     @Run(test = {"testCMoveVFGT", "testCMoveVFLT","testCMoveVDLE", "testCMoveVDGE", "testCMoveVFEQ", "testCMoveVDNE",
2918                  "testCMoveVFGTSwap", "testCMoveVFLTSwap","testCMoveVDLESwap", "testCMoveVDGESwap",
2919                  "testCMoveFGTforFConst", "testCMoveFGEforFConst", "testCMoveFLTforFConst",
2920                  "testCMoveFLEforFConst", "testCMoveFEQforFConst", "testCMoveFNEQforFConst",
2921                  "testCMoveDGTforDConst", "testCMoveDGEforDConst", "testCMoveDLTforDConst",
2922                  "testCMoveDLEforDConst", "testCMoveDEQforDConst", "testCMoveDNEQforDConst",
2923                  "testCMoveFLTforFConstH2", "testCMoveFLEforFConstH2",
2924                  "testCMoveFYYforFConstH2", "testCMoveFXXforFConstH2",
2925                  "testCMoveDLTforDConstH2", "testCMoveDLEforDConstH2",
2926                  "testCMoveDYYforDConstH2", "testCMoveDXXforDConstH2"})
2927     private void testCMove_runner() {
2928         float[] floata = new float[SIZE];
2929         float[] floatb = new float[SIZE];
2930         float[] floatc = new float[SIZE];
2931         double[] doublea = new double[SIZE];
2932         double[] doubleb = new double[SIZE];
2933         double[] doublec = new double[SIZE];
2934 
2935         init(floata);
2936         init(floatb);
2937         init(doublea);
2938         init(doubleb);
2939 
2940         testCMoveVFGT(floata, floatb, floatc);
2941         testCMoveVDLE(doublea, doubleb, doublec);
2942         for (int i = 0; i < SIZE; i++) {
2943             Asserts.assertEquals(floatc[i], cmoveFloatGT(floata[i], floatb[i]));
2944             Asserts.assertEquals(doublec[i], cmoveDoubleLE(doublea[i], doubleb[i]));
2945         }
2946 
2947         testCMoveVFLT(floata, floatb, floatc);
2948         testCMoveVDGE(doublea, doubleb, doublec);
2949         for (int i = 0; i < SIZE; i++) {
2950             Asserts.assertEquals(floatc[i], cmoveFloatLT(floata[i], floatb[i]));
2951             Asserts.assertEquals(doublec[i], cmoveDoubleGE(doublea[i], doubleb[i]));
2952         }
2953 
2954         // Ensure we frequently have equals
2955         for (int i = 0; i < SIZE; i++) {
2956             if (i % 3 == 0) {
2957                 floatb[i] = floata[i];
2958                 doubleb[i] = doublea[i];
2959             }
2960         }
2961 
2962         testCMoveVFEQ(floata, floatb, floatc);
2963         testCMoveVDNE(doublea, doubleb, doublec);
2964         for (int i = 0; i < SIZE; i++) {
2965             Asserts.assertEquals(floatc[i], cmoveFloatEQ(floata[i], floatb[i]));
2966             Asserts.assertEquals(doublec[i], cmoveDoubleNE(doublea[i], doubleb[i]));
2967         }
2968 
2969         testCMoveVFGTSwap(floata, floatb, floatc);
2970         testCMoveVDLESwap(doublea, doubleb, doublec);
2971         for (int i = 0; i < SIZE; i++) {
2972             Asserts.assertEquals(floatc[i], cmoveFloatGTSwap(floata[i], floatb[i]));
2973             Asserts.assertEquals(doublec[i], cmoveDoubleLESwap(doublea[i], doubleb[i]));
2974         }
2975 
2976         testCMoveVFLTSwap(floata, floatb, floatc);
2977         testCMoveVDGESwap(doublea, doubleb, doublec);
2978         for (int i = 0; i < SIZE; i++) {
2979             Asserts.assertEquals(floatc[i], cmoveFloatLTSwap(floata[i], floatb[i]));
2980             Asserts.assertEquals(doublec[i], cmoveDoubleGESwap(doublea[i], doubleb[i]));
2981         }
2982 
2983         // Extensions: compare 2 values, and pick from 2 consts
2984         testCMoveFGTforFConst(floata, floatb, floatc);
2985         testCMoveDGTforDConst(doublea, doubleb, doublec);
2986         for (int i = 0; i < SIZE; i++) {
2987             Asserts.assertEquals(floatc[i], cmoveFGTforFConst(floata[i], floatb[i]));
2988             Asserts.assertEquals(doublec[i], cmoveDGTforDConst(doublea[i], doubleb[i]));
2989         }
2990 
2991         testCMoveFGEforFConst(floata, floatb, floatc);
2992         testCMoveDGEforDConst(doublea, doubleb, doublec);
2993         for (int i = 0; i < SIZE; i++) {
2994             Asserts.assertEquals(floatc[i], cmoveFGEforFConst(floata[i], floatb[i]));
2995             Asserts.assertEquals(doublec[i], cmoveDGEforDConst(doublea[i], doubleb[i]));
2996         }
2997 
2998         testCMoveFLTforFConst(floata, floatb, floatc);
2999         testCMoveDLTforDConst(doublea, doubleb, doublec);
3000         for (int i = 0; i < SIZE; i++) {
3001             Asserts.assertEquals(floatc[i], cmoveFLTforFConst(floata[i], floatb[i]));
3002             Asserts.assertEquals(doublec[i], cmoveDLTforDConst(doublea[i], doubleb[i]));
3003         }
3004 
3005         testCMoveFLEforFConst(floata, floatb, floatc);
3006         testCMoveDLEforDConst(doublea, doubleb, doublec);
3007         for (int i = 0; i < SIZE; i++) {
3008             Asserts.assertEquals(floatc[i], cmoveFLEforFConst(floata[i], floatb[i]));
3009             Asserts.assertEquals(doublec[i], cmoveDLEforDConst(doublea[i], doubleb[i]));
3010         }
3011 
3012         testCMoveFEQforFConst(floata, floatb, floatc);
3013         testCMoveDEQforDConst(doublea, doubleb, doublec);
3014         for (int i = 0; i < SIZE; i++) {
3015             Asserts.assertEquals(floatc[i], cmoveFEQforFConst(floata[i], floatb[i]));
3016             Asserts.assertEquals(doublec[i], cmoveDEQforDConst(doublea[i], doubleb[i]));
3017         }
3018 
3019         testCMoveFNEQforFConst(floata, floatb, floatc);
3020         testCMoveDNEQforDConst(doublea, doubleb, doublec);
3021         for (int i = 0; i < SIZE; i++) {
3022             Asserts.assertEquals(floatc[i], cmoveFNEQforFConst(floata[i], floatb[i]));
3023             Asserts.assertEquals(doublec[i], cmoveDNEQforDConst(doublea[i], doubleb[i]));
3024         }
3025 
3026         // Hand-unrolled (H2) examples:
3027         testCMoveFLTforFConstH2(floata, floatb, floatc);
3028         testCMoveDLTforDConstH2(doublea, doubleb, doublec);
3029         for (int i = 0; i < SIZE; i++) {
3030             Asserts.assertEquals(floatc[i], cmoveFLTforFConst(floata[i], floatb[i]));
3031             Asserts.assertEquals(doublec[i], cmoveDLTforDConst(doublea[i], doubleb[i]));
3032         }
3033 
3034         testCMoveFLEforFConstH2(floata, floatb, floatc);
3035         testCMoveDLEforDConstH2(doublea, doubleb, doublec);
3036         for (int i = 0; i < SIZE; i++) {
3037             Asserts.assertEquals(floatc[i], cmoveFLEforFConst(floata[i], floatb[i]));
3038             Asserts.assertEquals(doublec[i], cmoveDLEforDConst(doublea[i], doubleb[i]));
3039         }
3040 
3041         testCMoveFYYforFConstH2(floata, floatb, floatc);
3042         testCMoveDYYforDConstH2(doublea, doubleb, doublec);
3043         for (int i = 0; i < SIZE; i+=2) {
3044             Asserts.assertEquals(floatc[i+0], cmoveFLEforFConst(floata[i+0], floatb[i+0]));
3045             Asserts.assertEquals(doublec[i+0], cmoveDLEforDConst(doublea[i+0], doubleb[i+0]));
3046             Asserts.assertEquals(floatc[i+1], cmoveFLTforFConst(floata[i+1], floatb[i+1]));
3047             Asserts.assertEquals(doublec[i+1], cmoveDLTforDConst(doublea[i+1], doubleb[i+1]));
3048         }
3049 
3050         testCMoveFXXforFConstH2(floata, floatb, floatc);
3051         testCMoveDXXforDConstH2(doublea, doubleb, doublec);
3052         for (int i = 0; i < SIZE; i+=2) {
3053             Asserts.assertEquals(floatc[i+0], cmoveFLTforFConst(floata[i+0], floatb[i+0]));
3054             Asserts.assertEquals(doublec[i+0], cmoveDLTforDConst(doublea[i+0], doubleb[i+0]));
3055             Asserts.assertEquals(floatc[i+1], cmoveFLEforFConst(floata[i+1], floatb[i+1]));
3056             Asserts.assertEquals(doublec[i+1], cmoveDLEforDConst(doublea[i+1], doubleb[i+1]));
3057         }
3058     }
3059 
3060     @Warmup(0)
3061     @Run(test = {// Signed
3062                  //     I for I
3063                  "testCMoveIEQforI",
3064                  "testCMoveINEforI",
3065                  "testCMoveIGTforI",
3066                  "testCMoveIGEforI",
3067                  "testCMoveILTforI",
3068                  "testCMoveILEforI",
3069                  //     I for L
3070                  "testCMoveIEQforL",
3071                  "testCMoveINEforL",
3072                  "testCMoveIGTforL",
3073                  "testCMoveIGEforL",
3074                  "testCMoveILTforL",
3075                  "testCMoveILEforL",
3076                  //     I for F
3077                  "testCMoveIEQforF",
3078                  "testCMoveINEforF",
3079                  "testCMoveIGTforF",
3080                  "testCMoveIGEforF",
3081                  "testCMoveILTforF",
3082                  "testCMoveILEforF",
3083                  //     I for D
3084                  "testCMoveIEQforD",
3085                  "testCMoveINEforD",
3086                  "testCMoveIGTforD",
3087                  "testCMoveIGEforD",
3088                  "testCMoveILTforD",
3089                  "testCMoveILEforD",
3090                  //     L for I
3091                  "testCMoveLEQforI",
3092                  "testCMoveLNEforI",
3093                  "testCMoveLGTforI",
3094                  "testCMoveLGEforI",
3095                  "testCMoveLLTforI",
3096                  "testCMoveLLEforI",
3097                  //     L for L
3098                  "testCMoveLEQforL",
3099                  "testCMoveLNEforL",
3100                  "testCMoveLGTforL",
3101                  "testCMoveLGEforL",
3102                  "testCMoveLLTforL",
3103                  "testCMoveLLEforL",
3104                  //     L for F
3105                  "testCMoveLEQforF",
3106                  "testCMoveLNEforF",
3107                  "testCMoveLGTforF",
3108                  "testCMoveLGEforF",
3109                  "testCMoveLLTforF",
3110                  "testCMoveLLEforF",
3111                  //     L for D
3112                  "testCMoveLEQforD",
3113                  "testCMoveLNEforD",
3114                  "testCMoveLGTforD",
3115                  "testCMoveLGEforD",
3116                  "testCMoveLLTforD",
3117                  "testCMoveLLEforD",
3118                  // Unsigned
3119                  //     I for I
3120                  "testCMoveUIEQforI",
3121                  "testCMoveUINEforI",
3122                  "testCMoveUIGTforI",
3123                  "testCMoveUIGEforI",
3124                  "testCMoveUILTforI",
3125                  "testCMoveUILEforI",
3126                  //     I for L
3127                  "testCMoveUIEQforL",
3128                  "testCMoveUINEforL",
3129                  "testCMoveUIGTforL",
3130                  "testCMoveUIGEforL",
3131                  "testCMoveUILTforL",
3132                  "testCMoveUILEforL",
3133                  //     I for F
3134                  "testCMoveUIEQforF",
3135                  "testCMoveUINEforF",
3136                  "testCMoveUIGTforF",
3137                  "testCMoveUIGEforF",
3138                  "testCMoveUILTforF",
3139                  "testCMoveUILEforF",
3140                  //     I for D
3141                  "testCMoveUIEQforD",
3142                  "testCMoveUINEforD",
3143                  "testCMoveUIGTforD",
3144                  "testCMoveUIGEforD",
3145                  "testCMoveUILTforD",
3146                  "testCMoveUILEforD",
3147                  //     L for I
3148                  "testCMoveULEQforI",
3149                  "testCMoveULNEforI",
3150                  "testCMoveULGTforI",
3151                  "testCMoveULGEforI",
3152                  "testCMoveULLTforI",
3153                  "testCMoveULLEforI",
3154                  //     L for L
3155                  "testCMoveULEQforL",
3156                  "testCMoveULNEforL",
3157                  "testCMoveULGTforL",
3158                  "testCMoveULGEforL",
3159                  "testCMoveULLTforL",
3160                  "testCMoveULLEforL",
3161                  //     L for F
3162                  "testCMoveULEQforF",
3163                  "testCMoveULNEforF",
3164                  "testCMoveULGTforF",
3165                  "testCMoveULGEforF",
3166                  "testCMoveULLTforF",
3167                  "testCMoveULLEforF",
3168                  //     L for D
3169                  "testCMoveULEQforD",
3170                  "testCMoveULNEforD",
3171                  "testCMoveULGTforD",
3172                  "testCMoveULGEforD",
3173                  "testCMoveULLTforD",
3174                  "testCMoveULLEforD",
3175                  // Float
3176                  "testCMoveFGTforI",
3177                  "testCMoveFGTforL",
3178                  "testCMoveFGTforF",
3179                  "testCMoveFGTforD",
3180                  "testCMoveDGTforI",
3181                  "testCMoveDGTforL",
3182                  "testCMoveDGTforF",
3183                  "testCMoveDGTforD",
3184                  "testCMoveFGTforFCmpCon1",
3185                  "testCMoveFGTforFCmpCon2"})
3186     private void testCMove_runner_two() {
3187         int[] aI = new int[SIZE];
3188         int[] bI = new int[SIZE];
3189         int[] cI = new int[SIZE];
3190         int[] dI = new int[SIZE];
3191         int[] rI = new int[SIZE];
3192         long[] aL = new long[SIZE];
3193         long[] bL = new long[SIZE];
3194         long[] cL = new long[SIZE];
3195         long[] dL = new long[SIZE];
3196         long[] rL = new long[SIZE];
3197         float[] aF = new float[SIZE];
3198         float[] bF = new float[SIZE];
3199         float[] cF = new float[SIZE];
3200         float[] dF = new float[SIZE];
3201         float[] rF = new float[SIZE];
3202         double[] aD = new double[SIZE];
3203         double[] bD = new double[SIZE];
3204         double[] cD = new double[SIZE];
3205         double[] dD = new double[SIZE];
3206         double[] rD = new double[SIZE];
3207 
3208         init(aI);
3209         init(bI);
3210         init(cI);
3211         init(dI);
3212         init(aL);
3213         init(bL);
3214         init(cL);
3215         init(dL);
3216         init(aF);
3217         init(bF);
3218         init(cF);
3219         init(dF);
3220         init(aD);
3221         init(bD);
3222         init(cD);
3223         init(dD);
3224 
3225         // Signed
3226         //     I for I
3227         testCMoveIEQforI(aI, bI, cI, dI, rI, rI);
3228         for (int i = 0; i < SIZE; i++) {
3229             Asserts.assertEquals(rI[i], cmoveIEQforI(aI[i], bI[i], cI[i], dI[i]));
3230         }
3231 
3232         testCMoveINEforI(aI, bI, cI, dI, rI, rI);
3233         for (int i = 0; i < SIZE; i++) {
3234             Asserts.assertEquals(rI[i], cmoveINEforI(aI[i], bI[i], cI[i], dI[i]));
3235         }
3236 
3237         testCMoveIGTforI(aI, bI, cI, dI, rI, rI);
3238         for (int i = 0; i < SIZE; i++) {
3239             Asserts.assertEquals(rI[i], cmoveIGTforI(aI[i], bI[i], cI[i], dI[i]));
3240         }
3241 
3242         testCMoveIGEforI(aI, bI, cI, dI, rI, rI);
3243         for (int i = 0; i < SIZE; i++) {
3244             Asserts.assertEquals(rI[i], cmoveIGEforI(aI[i], bI[i], cI[i], dI[i]));
3245         }
3246 
3247         testCMoveILTforI(aI, bI, cI, dI, rI, rI);
3248         for (int i = 0; i < SIZE; i++) {
3249             Asserts.assertEquals(rI[i], cmoveILTforI(aI[i], bI[i], cI[i], dI[i]));
3250         }
3251 
3252         testCMoveILEforI(aI, bI, cI, dI, rI, rI);
3253         for (int i = 0; i < SIZE; i++) {
3254             Asserts.assertEquals(rI[i], cmoveILEforI(aI[i], bI[i], cI[i], dI[i]));
3255         }
3256 
3257         //     I for L
3258         testCMoveIEQforL(aI, bI, cL, dL, rL, rL);
3259         for (int i = 0; i < SIZE; i++) {
3260             Asserts.assertEquals(rL[i], cmoveIEQforL(aI[i], bI[i], cL[i], dL[i]));
3261         }
3262 
3263         testCMoveINEforL(aI, bI, cL, dL, rL, rL);
3264         for (int i = 0; i < SIZE; i++) {
3265             Asserts.assertEquals(rL[i], cmoveINEforL(aI[i], bI[i], cL[i], dL[i]));
3266         }
3267 
3268         testCMoveIGTforL(aI, bI, cL, dL, rL, rL);
3269         for (int i = 0; i < SIZE; i++) {
3270             Asserts.assertEquals(rL[i], cmoveIGTforL(aI[i], bI[i], cL[i], dL[i]));
3271         }
3272 
3273         testCMoveIGEforL(aI, bI, cL, dL, rL, rL);
3274         for (int i = 0; i < SIZE; i++) {
3275             Asserts.assertEquals(rL[i], cmoveIGEforL(aI[i], bI[i], cL[i], dL[i]));
3276         }
3277 
3278         testCMoveILTforL(aI, bI, cL, dL, rL, rL);
3279         for (int i = 0; i < SIZE; i++) {
3280             Asserts.assertEquals(rL[i], cmoveILTforL(aI[i], bI[i], cL[i], dL[i]));
3281         }
3282 
3283         testCMoveILEforL(aI, bI, cL, dL, rL, rL);
3284         for (int i = 0; i < SIZE; i++) {
3285             Asserts.assertEquals(rL[i], cmoveILEforL(aI[i], bI[i], cL[i], dL[i]));
3286         }
3287 
3288         //     I for F
3289         testCMoveIEQforF(aI, bI, cF, dF, rF, rF);
3290         for (int i = 0; i < SIZE; i++) {
3291             Asserts.assertEquals(rF[i], cmoveIEQforF(aI[i], bI[i], cF[i], dF[i]));
3292         }
3293 
3294         testCMoveINEforF(aI, bI, cF, dF, rF, rF);
3295         for (int i = 0; i < SIZE; i++) {
3296             Asserts.assertEquals(rF[i], cmoveINEforF(aI[i], bI[i], cF[i], dF[i]));
3297         }
3298 
3299         testCMoveIGTforF(aI, bI, cF, dF, rF, rF);
3300         for (int i = 0; i < SIZE; i++) {
3301             Asserts.assertEquals(rF[i], cmoveIGTforF(aI[i], bI[i], cF[i], dF[i]));
3302         }
3303 
3304         testCMoveIGEforF(aI, bI, cF, dF, rF, rF);
3305         for (int i = 0; i < SIZE; i++) {
3306             Asserts.assertEquals(rF[i], cmoveIGEforF(aI[i], bI[i], cF[i], dF[i]));
3307         }
3308 
3309         testCMoveILTforF(aI, bI, cF, dF, rF, rF);
3310         for (int i = 0; i < SIZE; i++) {
3311             Asserts.assertEquals(rF[i], cmoveILTforF(aI[i], bI[i], cF[i], dF[i]));
3312         }
3313 
3314         testCMoveILEforF(aI, bI, cF, dF, rF, rF);
3315         for (int i = 0; i < SIZE; i++) {
3316             Asserts.assertEquals(rF[i], cmoveILEforF(aI[i], bI[i], cF[i], dF[i]));
3317         }
3318 
3319         //     I for D
3320         testCMoveIEQforD(aI, bI, cD, dD, rD, rD);
3321         for (int i = 0; i < SIZE; i++) {
3322             Asserts.assertEquals(rD[i], cmoveIEQforD(aI[i], bI[i], cD[i], dD[i]));
3323         }
3324 
3325         testCMoveINEforD(aI, bI, cD, dD, rD, rD);
3326         for (int i = 0; i < SIZE; i++) {
3327             Asserts.assertEquals(rD[i], cmoveINEforD(aI[i], bI[i], cD[i], dD[i]));
3328         }
3329 
3330         testCMoveIGTforD(aI, bI, cD, dD, rD, rD);
3331         for (int i = 0; i < SIZE; i++) {
3332             Asserts.assertEquals(rD[i], cmoveIGTforD(aI[i], bI[i], cD[i], dD[i]));
3333         }
3334 
3335         testCMoveIGEforD(aI, bI, cD, dD, rD, rD);
3336         for (int i = 0; i < SIZE; i++) {
3337             Asserts.assertEquals(rD[i], cmoveIGEforD(aI[i], bI[i], cD[i], dD[i]));
3338         }
3339 
3340         testCMoveILTforD(aI, bI, cD, dD, rD, rD);
3341         for (int i = 0; i < SIZE; i++) {
3342             Asserts.assertEquals(rD[i], cmoveILTforD(aI[i], bI[i], cD[i], dD[i]));
3343         }
3344 
3345         testCMoveILEforD(aI, bI, cD, dD, rD, rD);
3346         for (int i = 0; i < SIZE; i++) {
3347             Asserts.assertEquals(rD[i], cmoveILEforD(aI[i], bI[i], cD[i], dD[i]));
3348         }
3349 
3350         //     L for I
3351         testCMoveLEQforI(aL, bL, cI, dI, rI, rI);
3352         for (int i = 0; i < SIZE; i++) {
3353             Asserts.assertEquals(rI[i], cmoveLEQforI(aL[i], bL[i], cI[i], dI[i]));
3354         }
3355 
3356         testCMoveLNEforI(aL, bL, cI, dI, rI, rI);
3357         for (int i = 0; i < SIZE; i++) {
3358             Asserts.assertEquals(rI[i], cmoveLNEforI(aL[i], bL[i], cI[i], dI[i]));
3359         }
3360 
3361         testCMoveLGTforI(aL, bL, cI, dI, rI, rI);
3362         for (int i = 0; i < SIZE; i++) {
3363             Asserts.assertEquals(rI[i], cmoveLGTforI(aL[i], bL[i], cI[i], dI[i]));
3364         }
3365 
3366         testCMoveLGEforI(aL, bL, cI, dI, rI, rI);
3367         for (int i = 0; i < SIZE; i++) {
3368             Asserts.assertEquals(rI[i], cmoveLGEforI(aL[i], bL[i], cI[i], dI[i]));
3369         }
3370 
3371         testCMoveLLTforI(aL, bL, cI, dI, rI, rI);
3372         for (int i = 0; i < SIZE; i++) {
3373             Asserts.assertEquals(rI[i], cmoveLLTforI(aL[i], bL[i], cI[i], dI[i]));
3374         }
3375 
3376         testCMoveLLEforI(aL, bL, cI, dI, rI, rI);
3377         for (int i = 0; i < SIZE; i++) {
3378             Asserts.assertEquals(rI[i], cmoveLLEforI(aL[i], bL[i], cI[i], dI[i]));
3379         }
3380 
3381         //     L for L
3382         testCMoveLEQforL(aL, bL, cL, dL, rL, rL);
3383         for (int i = 0; i < SIZE; i++) {
3384             Asserts.assertEquals(rL[i], cmoveLEQforL(aL[i], bL[i], cL[i], dL[i]));
3385         }
3386 
3387         testCMoveLNEforL(aL, bL, cL, dL, rL, rL);
3388         for (int i = 0; i < SIZE; i++) {
3389             Asserts.assertEquals(rL[i], cmoveLNEforL(aL[i], bL[i], cL[i], dL[i]));
3390         }
3391 
3392         testCMoveLGTforL(aL, bL, cL, dL, rL, rL);
3393         for (int i = 0; i < SIZE; i++) {
3394             Asserts.assertEquals(rL[i], cmoveLGTforL(aL[i], bL[i], cL[i], dL[i]));
3395         }
3396 
3397         testCMoveLGEforL(aL, bL, cL, dL, rL, rL);
3398         for (int i = 0; i < SIZE; i++) {
3399             Asserts.assertEquals(rL[i], cmoveLGEforL(aL[i], bL[i], cL[i], dL[i]));
3400         }
3401 
3402         testCMoveLLTforL(aL, bL, cL, dL, rL, rL);
3403         for (int i = 0; i < SIZE; i++) {
3404             Asserts.assertEquals(rL[i], cmoveLLTforL(aL[i], bL[i], cL[i], dL[i]));
3405         }
3406 
3407         testCMoveLLEforL(aL, bL, cL, dL, rL, rL);
3408         for (int i = 0; i < SIZE; i++) {
3409             Asserts.assertEquals(rL[i], cmoveLLEforL(aL[i], bL[i], cL[i], dL[i]));
3410         }
3411 
3412         //     L for F
3413         testCMoveLEQforF(aL, bL, cF, dF, rF, rF);
3414         for (int i = 0; i < SIZE; i++) {
3415             Asserts.assertEquals(rF[i], cmoveLEQforF(aL[i], bL[i], cF[i], dF[i]));
3416         }
3417 
3418         testCMoveLNEforF(aL, bL, cF, dF, rF, rF);
3419         for (int i = 0; i < SIZE; i++) {
3420             Asserts.assertEquals(rF[i], cmoveLNEforF(aL[i], bL[i], cF[i], dF[i]));
3421         }
3422 
3423         testCMoveLGTforF(aL, bL, cF, dF, rF, rF);
3424         for (int i = 0; i < SIZE; i++) {
3425             Asserts.assertEquals(rF[i], cmoveLGTforF(aL[i], bL[i], cF[i], dF[i]));
3426         }
3427 
3428         testCMoveLGEforF(aL, bL, cF, dF, rF, rF);
3429         for (int i = 0; i < SIZE; i++) {
3430             Asserts.assertEquals(rF[i], cmoveLGEforF(aL[i], bL[i], cF[i], dF[i]));
3431         }
3432 
3433         testCMoveLLTforF(aL, bL, cF, dF, rF, rF);
3434         for (int i = 0; i < SIZE; i++) {
3435             Asserts.assertEquals(rF[i], cmoveLLTforF(aL[i], bL[i], cF[i], dF[i]));
3436         }
3437 
3438         testCMoveLLEforF(aL, bL, cF, dF, rF, rF);
3439         for (int i = 0; i < SIZE; i++) {
3440             Asserts.assertEquals(rF[i], cmoveLLEforF(aL[i], bL[i], cF[i], dF[i]));
3441         }
3442 
3443         //     L for D
3444         testCMoveLEQforD(aL, bL, cD, dD, rD, rD);
3445         for (int i = 0; i < SIZE; i++) {
3446             Asserts.assertEquals(rD[i], cmoveLEQforD(aL[i], bL[i], cD[i], dD[i]));
3447         }
3448 
3449         testCMoveLNEforD(aL, bL, cD, dD, rD, rD);
3450         for (int i = 0; i < SIZE; i++) {
3451             Asserts.assertEquals(rD[i], cmoveLNEforD(aL[i], bL[i], cD[i], dD[i]));
3452         }
3453 
3454         testCMoveLGTforD(aL, bL, cD, dD, rD, rD);
3455         for (int i = 0; i < SIZE; i++) {
3456             Asserts.assertEquals(rD[i], cmoveLGTforD(aL[i], bL[i], cD[i], dD[i]));
3457         }
3458 
3459         testCMoveLGEforD(aL, bL, cD, dD, rD, rD);
3460         for (int i = 0; i < SIZE; i++) {
3461             Asserts.assertEquals(rD[i], cmoveLGEforD(aL[i], bL[i], cD[i], dD[i]));
3462         }
3463 
3464         testCMoveLLTforD(aL, bL, cD, dD, rD, rD);
3465         for (int i = 0; i < SIZE; i++) {
3466             Asserts.assertEquals(rD[i], cmoveLLTforD(aL[i], bL[i], cD[i], dD[i]));
3467         }
3468 
3469         testCMoveLLEforD(aL, bL, cD, dD, rD, rD);
3470         for (int i = 0; i < SIZE; i++) {
3471             Asserts.assertEquals(rD[i], cmoveLLEforD(aL[i], bL[i], cD[i], dD[i]));
3472         }
3473 
3474         // Unsigned
3475         //     I for I
3476         testCMoveUIEQforI(aI, bI, cI, dI, rI, rI);
3477         for (int i = 0; i < SIZE; i++) {
3478             Asserts.assertEquals(rI[i], cmoveUIEQforI(aI[i], bI[i], cI[i], dI[i]));
3479         }
3480 
3481         testCMoveUINEforI(aI, bI, cI, dI, rI, rI);
3482         for (int i = 0; i < SIZE; i++) {
3483             Asserts.assertEquals(rI[i], cmoveUINEforI(aI[i], bI[i], cI[i], dI[i]));
3484         }
3485 
3486         testCMoveUIGTforI(aI, bI, cI, dI, rI, rI);
3487         for (int i = 0; i < SIZE; i++) {
3488             Asserts.assertEquals(rI[i], cmoveUIGTforI(aI[i], bI[i], cI[i], dI[i]));
3489         }
3490 
3491         testCMoveUIGEforI(aI, bI, cI, dI, rI, rI);
3492         for (int i = 0; i < SIZE; i++) {
3493             Asserts.assertEquals(rI[i], cmoveUIGEforI(aI[i], bI[i], cI[i], dI[i]));
3494         }
3495 
3496         testCMoveUILTforI(aI, bI, cI, dI, rI, rI);
3497         for (int i = 0; i < SIZE; i++) {
3498             Asserts.assertEquals(rI[i], cmoveUILTforI(aI[i], bI[i], cI[i], dI[i]));
3499         }
3500 
3501         testCMoveUILEforI(aI, bI, cI, dI, rI, rI);
3502         for (int i = 0; i < SIZE; i++) {
3503             Asserts.assertEquals(rI[i], cmoveUILEforI(aI[i], bI[i], cI[i], dI[i]));
3504         }
3505 
3506         //     I for L
3507         testCMoveUIEQforL(aI, bI, cL, dL, rL, rL);
3508         for (int i = 0; i < SIZE; i++) {
3509             Asserts.assertEquals(rL[i], cmoveUIEQforL(aI[i], bI[i], cL[i], dL[i]));
3510         }
3511 
3512         testCMoveUINEforL(aI, bI, cL, dL, rL, rL);
3513         for (int i = 0; i < SIZE; i++) {
3514             Asserts.assertEquals(rL[i], cmoveUINEforL(aI[i], bI[i], cL[i], dL[i]));
3515         }
3516 
3517         testCMoveUIGTforL(aI, bI, cL, dL, rL, rL);
3518         for (int i = 0; i < SIZE; i++) {
3519             Asserts.assertEquals(rL[i], cmoveUIGTforL(aI[i], bI[i], cL[i], dL[i]));
3520         }
3521 
3522         testCMoveUIGEforL(aI, bI, cL, dL, rL, rL);
3523         for (int i = 0; i < SIZE; i++) {
3524             Asserts.assertEquals(rL[i], cmoveUIGEforL(aI[i], bI[i], cL[i], dL[i]));
3525         }
3526 
3527         testCMoveUILTforL(aI, bI, cL, dL, rL, rL);
3528         for (int i = 0; i < SIZE; i++) {
3529             Asserts.assertEquals(rL[i], cmoveUILTforL(aI[i], bI[i], cL[i], dL[i]));
3530         }
3531 
3532         testCMoveUILEforL(aI, bI, cL, dL, rL, rL);
3533         for (int i = 0; i < SIZE; i++) {
3534             Asserts.assertEquals(rL[i], cmoveUILEforL(aI[i], bI[i], cL[i], dL[i]));
3535         }
3536 
3537         //     I for F
3538         testCMoveUIEQforF(aI, bI, cF, dF, rF, rF);
3539         for (int i = 0; i < SIZE; i++) {
3540             Asserts.assertEquals(rF[i], cmoveUIEQforF(aI[i], bI[i], cF[i], dF[i]));
3541         }
3542 
3543         testCMoveUINEforF(aI, bI, cF, dF, rF, rF);
3544         for (int i = 0; i < SIZE; i++) {
3545             Asserts.assertEquals(rF[i], cmoveUINEforF(aI[i], bI[i], cF[i], dF[i]));
3546         }
3547 
3548         testCMoveUIGTforF(aI, bI, cF, dF, rF, rF);
3549         for (int i = 0; i < SIZE; i++) {
3550             Asserts.assertEquals(rF[i], cmoveUIGTforF(aI[i], bI[i], cF[i], dF[i]));
3551         }
3552 
3553         testCMoveUIGEforF(aI, bI, cF, dF, rF, rF);
3554         for (int i = 0; i < SIZE; i++) {
3555             Asserts.assertEquals(rF[i], cmoveUIGEforF(aI[i], bI[i], cF[i], dF[i]));
3556         }
3557 
3558         testCMoveUILTforF(aI, bI, cF, dF, rF, rF);
3559         for (int i = 0; i < SIZE; i++) {
3560             Asserts.assertEquals(rF[i], cmoveUILTforF(aI[i], bI[i], cF[i], dF[i]));
3561         }
3562 
3563         testCMoveUILEforF(aI, bI, cF, dF, rF, rF);
3564         for (int i = 0; i < SIZE; i++) {
3565             Asserts.assertEquals(rF[i], cmoveUILEforF(aI[i], bI[i], cF[i], dF[i]));
3566         }
3567 
3568         //     I for D
3569         testCMoveUIEQforD(aI, bI, cD, dD, rD, rD);
3570         for (int i = 0; i < SIZE; i++) {
3571             Asserts.assertEquals(rD[i], cmoveUIEQforD(aI[i], bI[i], cD[i], dD[i]));
3572         }
3573 
3574         testCMoveUINEforD(aI, bI, cD, dD, rD, rD);
3575         for (int i = 0; i < SIZE; i++) {
3576             Asserts.assertEquals(rD[i], cmoveUINEforD(aI[i], bI[i], cD[i], dD[i]));
3577         }
3578 
3579         testCMoveUIGTforD(aI, bI, cD, dD, rD, rD);
3580         for (int i = 0; i < SIZE; i++) {
3581             Asserts.assertEquals(rD[i], cmoveUIGTforD(aI[i], bI[i], cD[i], dD[i]));
3582         }
3583 
3584         testCMoveUIGEforD(aI, bI, cD, dD, rD, rD);
3585         for (int i = 0; i < SIZE; i++) {
3586             Asserts.assertEquals(rD[i], cmoveUIGEforD(aI[i], bI[i], cD[i], dD[i]));
3587         }
3588 
3589         testCMoveUILTforD(aI, bI, cD, dD, rD, rD);
3590         for (int i = 0; i < SIZE; i++) {
3591             Asserts.assertEquals(rD[i], cmoveUILTforD(aI[i], bI[i], cD[i], dD[i]));
3592         }
3593 
3594         testCMoveUILEforD(aI, bI, cD, dD, rD, rD);
3595         for (int i = 0; i < SIZE; i++) {
3596             Asserts.assertEquals(rD[i], cmoveUILEforD(aI[i], bI[i], cD[i], dD[i]));
3597         }
3598 
3599         //     L for I
3600         testCMoveULEQforI(aL, bL, cI, dI, rI, rI);
3601         for (int i = 0; i < SIZE; i++) {
3602             Asserts.assertEquals(rI[i], cmoveULEQforI(aL[i], bL[i], cI[i], dI[i]));
3603         }
3604 
3605         testCMoveULNEforI(aL, bL, cI, dI, rI, rI);
3606         for (int i = 0; i < SIZE; i++) {
3607             Asserts.assertEquals(rI[i], cmoveULNEforI(aL[i], bL[i], cI[i], dI[i]));
3608         }
3609 
3610         testCMoveULGTforI(aL, bL, cI, dI, rI, rI);
3611         for (int i = 0; i < SIZE; i++) {
3612             Asserts.assertEquals(rI[i], cmoveULGTforI(aL[i], bL[i], cI[i], dI[i]));
3613         }
3614 
3615         testCMoveULGEforI(aL, bL, cI, dI, rI, rI);
3616         for (int i = 0; i < SIZE; i++) {
3617             Asserts.assertEquals(rI[i], cmoveULGEforI(aL[i], bL[i], cI[i], dI[i]));
3618         }
3619 
3620         testCMoveULLTforI(aL, bL, cI, dI, rI, rI);
3621         for (int i = 0; i < SIZE; i++) {
3622             Asserts.assertEquals(rI[i], cmoveULLTforI(aL[i], bL[i], cI[i], dI[i]));
3623         }
3624 
3625         testCMoveULLEforI(aL, bL, cI, dI, rI, rI);
3626         for (int i = 0; i < SIZE; i++) {
3627             Asserts.assertEquals(rI[i], cmoveULLEforI(aL[i], bL[i], cI[i], dI[i]));
3628         }
3629 
3630         //     L for L
3631         testCMoveULEQforL(aL, bL, cL, dL, rL, rL);
3632         for (int i = 0; i < SIZE; i++) {
3633             Asserts.assertEquals(rL[i], cmoveULEQforL(aL[i], bL[i], cL[i], dL[i]));
3634         }
3635 
3636         testCMoveULNEforL(aL, bL, cL, dL, rL, rL);
3637         for (int i = 0; i < SIZE; i++) {
3638             Asserts.assertEquals(rL[i], cmoveULNEforL(aL[i], bL[i], cL[i], dL[i]));
3639         }
3640 
3641         testCMoveULGTforL(aL, bL, cL, dL, rL, rL);
3642         for (int i = 0; i < SIZE; i++) {
3643             Asserts.assertEquals(rL[i], cmoveULGTforL(aL[i], bL[i], cL[i], dL[i]));
3644         }
3645 
3646         testCMoveULGEforL(aL, bL, cL, dL, rL, rL);
3647         for (int i = 0; i < SIZE; i++) {
3648             Asserts.assertEquals(rL[i], cmoveULGEforL(aL[i], bL[i], cL[i], dL[i]));
3649         }
3650 
3651         testCMoveULLTforL(aL, bL, cL, dL, rL, rL);
3652         for (int i = 0; i < SIZE; i++) {
3653             Asserts.assertEquals(rL[i], cmoveULLTforL(aL[i], bL[i], cL[i], dL[i]));
3654         }
3655 
3656         testCMoveULLEforL(aL, bL, cL, dL, rL, rL);
3657         for (int i = 0; i < SIZE; i++) {
3658             Asserts.assertEquals(rL[i], cmoveULLEforL(aL[i], bL[i], cL[i], dL[i]));
3659         }
3660 
3661         //     L for F
3662         testCMoveULEQforF(aL, bL, cF, dF, rF, rF);
3663         for (int i = 0; i < SIZE; i++) {
3664             Asserts.assertEquals(rF[i], cmoveULEQforF(aL[i], bL[i], cF[i], dF[i]));
3665         }
3666 
3667         testCMoveULNEforF(aL, bL, cF, dF, rF, rF);
3668         for (int i = 0; i < SIZE; i++) {
3669             Asserts.assertEquals(rF[i], cmoveULNEforF(aL[i], bL[i], cF[i], dF[i]));
3670         }
3671 
3672         testCMoveULGTforF(aL, bL, cF, dF, rF, rF);
3673         for (int i = 0; i < SIZE; i++) {
3674             Asserts.assertEquals(rF[i], cmoveULGTforF(aL[i], bL[i], cF[i], dF[i]));
3675         }
3676 
3677         testCMoveULGEforF(aL, bL, cF, dF, rF, rF);
3678         for (int i = 0; i < SIZE; i++) {
3679             Asserts.assertEquals(rF[i], cmoveULGEforF(aL[i], bL[i], cF[i], dF[i]));
3680         }
3681 
3682         testCMoveULLTforF(aL, bL, cF, dF, rF, rF);
3683         for (int i = 0; i < SIZE; i++) {
3684             Asserts.assertEquals(rF[i], cmoveULLTforF(aL[i], bL[i], cF[i], dF[i]));
3685         }
3686 
3687         testCMoveULLEforF(aL, bL, cF, dF, rF, rF);
3688         for (int i = 0; i < SIZE; i++) {
3689             Asserts.assertEquals(rF[i], cmoveULLEforF(aL[i], bL[i], cF[i], dF[i]));
3690         }
3691 
3692         //     L for D
3693         testCMoveULEQforD(aL, bL, cD, dD, rD, rD);
3694         for (int i = 0; i < SIZE; i++) {
3695             Asserts.assertEquals(rD[i], cmoveULEQforD(aL[i], bL[i], cD[i], dD[i]));
3696         }
3697 
3698         testCMoveULNEforD(aL, bL, cD, dD, rD, rD);
3699         for (int i = 0; i < SIZE; i++) {
3700             Asserts.assertEquals(rD[i], cmoveULNEforD(aL[i], bL[i], cD[i], dD[i]));
3701         }
3702 
3703         testCMoveULGTforD(aL, bL, cD, dD, rD, rD);
3704         for (int i = 0; i < SIZE; i++) {
3705             Asserts.assertEquals(rD[i], cmoveULGTforD(aL[i], bL[i], cD[i], dD[i]));
3706         }
3707 
3708         testCMoveULGEforD(aL, bL, cD, dD, rD, rD);
3709         for (int i = 0; i < SIZE; i++) {
3710             Asserts.assertEquals(rD[i], cmoveULGEforD(aL[i], bL[i], cD[i], dD[i]));
3711         }
3712 
3713         testCMoveULLTforD(aL, bL, cD, dD, rD, rD);
3714         for (int i = 0; i < SIZE; i++) {
3715             Asserts.assertEquals(rD[i], cmoveULLTforD(aL[i], bL[i], cD[i], dD[i]));
3716         }
3717 
3718         testCMoveULLEforD(aL, bL, cD, dD, rD, rD);
3719         for (int i = 0; i < SIZE; i++) {
3720             Asserts.assertEquals(rD[i], cmoveULLEforD(aL[i], bL[i], cD[i], dD[i]));
3721         }
3722 
3723         // Float
3724         testCMoveFGTforI(aF, bF, cI, dI, rI, rI);
3725         for (int i = 0; i < SIZE; i++) {
3726             Asserts.assertEquals(rI[i], cmoveFGTforI(aF[i], bF[i], cI[i], dI[i]));
3727         }
3728 
3729         testCMoveFGTforL(aF, bF, cL, dL, rL, rL);
3730         for (int i = 0; i < SIZE; i++) {
3731             Asserts.assertEquals(rL[i], cmoveFGTforL(aF[i], bF[i], cL[i], dL[i]));
3732         }
3733 
3734         testCMoveFGTforF(aF, bF, cF, dF, rF, rF);
3735         for (int i = 0; i < SIZE; i++) {
3736             Asserts.assertEquals(rF[i], cmoveFGTforF(aF[i], bF[i], cF[i], dF[i]));
3737         }
3738 
3739         testCMoveFGTforD(aF, bF, cD, dD, rD, rD);
3740         for (int i = 0; i < SIZE; i++) {
3741             Asserts.assertEquals(rD[i], cmoveFGTforD(aF[i], bF[i], cD[i], dD[i]));
3742         }
3743 
3744         testCMoveDGTforI(aD, bD, cI, dI, rI, rI);
3745         for (int i = 0; i < SIZE; i++) {
3746             Asserts.assertEquals(rI[i], cmoveDGTforI(aD[i], bD[i], cI[i], dI[i]));
3747         }
3748 
3749         testCMoveDGTforL(aD, bD, cL, dL, rL, rL);
3750         for (int i = 0; i < SIZE; i++) {
3751             Asserts.assertEquals(rL[i], cmoveDGTforL(aD[i], bD[i], cL[i], dL[i]));
3752         }
3753 
3754         testCMoveDGTforF(aD, bD, cF, dF, rF, rF);
3755         for (int i = 0; i < SIZE; i++) {
3756             Asserts.assertEquals(rF[i], cmoveDGTforF(aD[i], bD[i], cF[i], dF[i]));
3757         }
3758 
3759         testCMoveDGTforD(aD, bD, cD, dD, rD, rD);
3760         for (int i = 0; i < SIZE; i++) {
3761             Asserts.assertEquals(rD[i], cmoveDGTforD(aD[i], bD[i], cD[i], dD[i]));
3762         }
3763 
3764         // Use some constants/invariants in the comparison
3765         testCMoveFGTforFCmpCon1(aF[0], bF, cF, dF, rF, rF);
3766         for (int i = 0; i < SIZE; i++) {
3767             Asserts.assertEquals(rF[i], cmoveFGTforF(aF[0], bF[i], cF[i], dF[i]));
3768         }
3769 
3770         testCMoveFGTforFCmpCon2(aF, bF[0], cF, dF, rF, rF);
3771         for (int i = 0; i < SIZE; i++) {
3772             Asserts.assertEquals(rF[i], cmoveFGTforF(aF[i], bF[0], cF[i], dF[i]));
3773         }
3774     }
3775 
3776     private static void init(int[] a) {
3777         for (int i = 0; i < SIZE; i++) {
3778             a[i] = RANDOM.nextInt();
3779         }
3780     }
3781 
3782     private static void init(long[] a) {
3783         for (int i = 0; i < SIZE; i++) {
3784             a[i] = RANDOM.nextLong();
3785         }
3786     }
3787 
3788     private static void init(float[] a) {
3789         for (int i = 0; i < SIZE; i++) {
3790             a[i] = switch(RANDOM.nextInt() % 20) {
3791                 case 0  -> Float.NaN;
3792                 case 1  -> 0;
3793                 case 2  -> 1;
3794                 case 3  -> Float.POSITIVE_INFINITY;
3795                 case 4  -> Float.NEGATIVE_INFINITY;
3796                 case 5  -> Float.MAX_VALUE;
3797                 case 6  -> Float.MIN_VALUE;
3798                 case 7, 8, 9 -> RANDOM.nextFloat();
3799                 default -> Float.intBitsToFloat(RANDOM.nextInt());
3800             };
3801         }
3802     }
3803 
3804     private static void init(double[] a) {
3805         for (int i = 0; i < SIZE; i++) {
3806             a[i] = switch(RANDOM.nextInt() % 20) {
3807                 case 0  -> Double.NaN;
3808                 case 1  -> 0;
3809                 case 2  -> 1;
3810                 case 3  -> Double.POSITIVE_INFINITY;
3811                 case 4  -> Double.NEGATIVE_INFINITY;
3812                 case 5  -> Double.MAX_VALUE;
3813                 case 6  -> Double.MIN_VALUE;
3814                 case 7, 8, 9 -> RANDOM.nextDouble();
3815                 default -> Double.longBitsToDouble(RANDOM.nextLong());
3816             };
3817         }
3818     }
3819 }