From 86350bbae4eca944670c1edef1fb25fa24d70801 Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 20 May 2025 19:36:34 +0000 Subject: [PATCH 01/32] initial commit --- src/hotspot/share/opto/superword.cpp | 3 ++- src/hotspot/share/opto/vectornode.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 5e34249aee810..741216ed1f0e0 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2353,7 +2353,8 @@ bool SuperWord::is_velt_basic_type_compatible_use_def(Node* use, Node* def) cons } // Default case: input size of use equals output size of def. - return type2aelembytes(use_bt) == type2aelembytes(def_bt); + return (type2aelembytes(use_bt) == type2aelembytes(def_bt)) || + (use->is_CMove() && def->is_Bool()); } // Return nullptr if success, else failure message diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 05ef64af70432..65eeb2214ffb2 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -86,6 +86,10 @@ int VectorNode::opcode(int sopc, BasicType bt) { return (bt == T_FLOAT ? Op_FmaVF : 0); case Op_FmaHF: return (bt == T_SHORT ? Op_FmaVHF : 0); + case Op_CMoveI: + return (bt == T_INT ? Op_VectorBlend : 0); + case Op_CMoveL: + return (bt == T_LONG ? Op_VectorBlend : 0); case Op_CMoveF: return (bt == T_FLOAT ? Op_VectorBlend : 0); case Op_CMoveD: From 58a7f7a37e1311860d19640fc2707aa1ee6fc989 Mon Sep 17 00:00:00 2001 From: hamlin Date: Wed, 21 May 2025 06:13:38 +0000 Subject: [PATCH 02/32] disable cmovei/l => vectorblend --- src/hotspot/share/opto/vectornode.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 65eeb2214ffb2..05ef64af70432 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -86,10 +86,6 @@ int VectorNode::opcode(int sopc, BasicType bt) { return (bt == T_FLOAT ? Op_FmaVF : 0); case Op_FmaHF: return (bt == T_SHORT ? Op_FmaVHF : 0); - case Op_CMoveI: - return (bt == T_INT ? Op_VectorBlend : 0); - case Op_CMoveL: - return (bt == T_LONG ? Op_VectorBlend : 0); case Op_CMoveF: return (bt == T_FLOAT ? Op_VectorBlend : 0); case Op_CMoveD: From e967feac194d82b1bb8fb5a1e9814bc9bbed4875 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 22 May 2025 20:11:49 +0000 Subject: [PATCH 03/32] split from pr 25341 --- src/hotspot/cpu/aarch64/matcher_aarch64.hpp | 15 +++++++++++++++ src/hotspot/cpu/arm/matcher_arm.hpp | 14 ++++++++++++++ src/hotspot/cpu/ppc/matcher_ppc.hpp | 14 ++++++++++++++ src/hotspot/cpu/riscv/matcher_riscv.hpp | 14 ++++++++++++++ src/hotspot/cpu/s390/matcher_s390.hpp | 14 ++++++++++++++ src/hotspot/cpu/x86/matcher_x86.hpp | 14 ++++++++++++++ src/hotspot/share/opto/superword.cpp | 14 +++++++++++--- src/hotspot/share/opto/vectornode.cpp | 19 +++++++++++++++++++ src/hotspot/share/opto/vectornode.hpp | 5 +++++ 9 files changed, 120 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp index 0fbc2ef141e8b..58f0faf103ac0 100644 --- a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp @@ -204,4 +204,19 @@ static bool is_feat_fp16_supported() { return (VM_Version::supports_fphp() && VM_Version::supports_asimdhp()); } + + static bool supports_vectorize_cmove_bool_unconditionally() { + return false; + } + + static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + switch (cmove_opc) { + case Op_CMoveF: + case Op_CMoveD: + return true; + default: + return false; + } + } + #endif // CPU_AARCH64_MATCHER_AARCH64_HPP diff --git a/src/hotspot/cpu/arm/matcher_arm.hpp b/src/hotspot/cpu/arm/matcher_arm.hpp index 66fe8ac330eb5..fa5b54358da68 100644 --- a/src/hotspot/cpu/arm/matcher_arm.hpp +++ b/src/hotspot/cpu/arm/matcher_arm.hpp @@ -193,4 +193,18 @@ return false; } + static bool supports_vectorize_cmove_bool_unconditionally() { + return false; + } + + static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + switch (cmove_opc) { + case Op_CMoveF: + case Op_CMoveD: + return true; + default: + return false; + } + } + #endif // CPU_ARM_MATCHER_ARM_HPP diff --git a/src/hotspot/cpu/ppc/matcher_ppc.hpp b/src/hotspot/cpu/ppc/matcher_ppc.hpp index 666bec9e0c802..03d618165db3e 100644 --- a/src/hotspot/cpu/ppc/matcher_ppc.hpp +++ b/src/hotspot/cpu/ppc/matcher_ppc.hpp @@ -204,4 +204,18 @@ return false; } + static bool supports_vectorize_cmove_bool_unconditionally() { + return false; + } + + static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + switch (cmove_opc) { + case Op_CMoveF: + case Op_CMoveD: + return true; + default: + return false; + } + } + #endif // CPU_PPC_MATCHER_PPC_HPP diff --git a/src/hotspot/cpu/riscv/matcher_riscv.hpp b/src/hotspot/cpu/riscv/matcher_riscv.hpp index 1b490a07f92a6..3e9af4d3d443f 100644 --- a/src/hotspot/cpu/riscv/matcher_riscv.hpp +++ b/src/hotspot/cpu/riscv/matcher_riscv.hpp @@ -199,4 +199,18 @@ return false; } + static bool supports_vectorize_cmove_bool_unconditionally() { + return true; + } + + static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + switch (cmove_opc) { + case Op_CMoveF: + case Op_CMoveD: + return true; + default: + return false; + } + } + #endif // CPU_RISCV_MATCHER_RISCV_HPP diff --git a/src/hotspot/cpu/s390/matcher_s390.hpp b/src/hotspot/cpu/s390/matcher_s390.hpp index e4c277c63a8b9..fc118d2c0b790 100644 --- a/src/hotspot/cpu/s390/matcher_s390.hpp +++ b/src/hotspot/cpu/s390/matcher_s390.hpp @@ -196,4 +196,18 @@ return false; } + static bool supports_vectorize_cmove_bool_unconditionally() { + return false; + } + + static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + switch (cmove_opc) { + case Op_CMoveF: + case Op_CMoveD: + return true; + default: + return false; + } + } + #endif // CPU_S390_MATCHER_S390_HPP diff --git a/src/hotspot/cpu/x86/matcher_x86.hpp b/src/hotspot/cpu/x86/matcher_x86.hpp index 41486c244b247..b7453b5f27529 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -236,4 +236,18 @@ } } + static bool supports_vectorize_cmove_bool_unconditionally() { + return false; + } + + static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + switch (cmove_opc) { + case Op_CMoveF: + case Op_CMoveD: + return true; + default: + return false; + } + } + #endif // CPU_X86_MATCHER_X86_HPP diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 741216ed1f0e0..fc08b7fcfcde1 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2352,9 +2352,17 @@ bool SuperWord::is_velt_basic_type_compatible_use_def(Node* use, Node* def) cons type2aelembytes(use_bt) == 4; } - // Default case: input size of use equals output size of def. - return (type2aelembytes(use_bt) == type2aelembytes(def_bt)) || - (use->is_CMove() && def->is_Bool()); + // Input size of use equals output size of def + if (type2aelembytes(use_bt) == type2aelembytes(def_bt)) { + return true; + } + + if (use->is_CMove() && def->is_Bool() && + VectorNode::is_vectorize_cmove_bool_unconditionally_supported()) { + return true; + } + + return false; } // Return nullptr if success, else failure message diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 05ef64af70432..2976efec7c7a9 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -86,6 +86,10 @@ int VectorNode::opcode(int sopc, BasicType bt) { return (bt == T_FLOAT ? Op_FmaVF : 0); case Op_FmaHF: return (bt == T_SHORT ? Op_FmaVHF : 0); + case Op_CMoveI: + return (bt == T_INT ? Op_VectorBlend : 0); + case Op_CMoveL: + return (bt == T_LONG ? Op_VectorBlend : 0); case Op_CMoveF: return (bt == T_FLOAT ? Op_VectorBlend : 0); case Op_CMoveD: @@ -429,6 +433,9 @@ bool VectorNode::implemented(int opc, uint vlen, BasicType bt) { if (VectorNode::is_vector_integral_negate(vopc)) { return is_vector_integral_negate_supported(vopc, vlen, bt, false); } + if (vopc == Op_VectorBlend) { + return VectorBlendNode::implemented(opc); + } return vopc > 0 && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, bt); } return false; @@ -511,6 +518,10 @@ bool VectorNode::is_populate_index_supported(BasicType bt) { return Matcher::match_rule_supported_vector(Op_PopulateIndex, vlen, bt); } +bool VectorNode::is_vectorize_cmove_bool_unconditionally_supported() { + return Matcher::supports_vectorize_cmove_bool_unconditionally(); +} + bool VectorNode::is_shift_opcode(int opc) { switch (opc) { case Op_LShiftI: @@ -2187,6 +2198,14 @@ Node* VectorBlendNode::Identity(PhaseGVN* phase) { } return this; } + +bool VectorBlendNode::implemented(int opc) { + assert(opc == Op_CMoveF || opc == Op_CMoveD || + opc == Op_CMoveI || opc == Op_CMoveL || + opc == Op_CMoveN || opc == Op_CMoveP, "must"); + return Matcher::supports_transform_cmove_to_vectorblend(opc); +} + static bool is_replicate_uint_constant(const Node* n) { return n->Opcode() == Op_Replicate && n->in(1)->is_Con() && diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index e72c3880c7983..7fd6863b54338 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -110,6 +110,9 @@ class VectorNode : public TypeNode { static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt); static bool is_vector_integral_negate_supported(int opc, uint vlen, BasicType bt, bool use_predicate); static bool is_populate_index_supported(BasicType bt); + // Supports to vectorize CMove which uses Bool unconditionally? + // Otherwise only same type size of CMove and Bool will be supported for this transformation. + static bool is_vectorize_cmove_bool_unconditionally_supported(); // Return true if every bit in this vector is 1. static bool is_all_ones_vector(Node* n); // Return true if every bit in this vector is 0. @@ -1736,6 +1739,8 @@ class VectorBlendNode : public VectorNode { Node* vec1() const { return in(1); } Node* vec2() const { return in(2); } Node* vec_mask() const { return in(3); } + + static bool implemented(int opc); }; class VectorRearrangeNode : public VectorNode { From e27247ba8fb95ab7b4872c63fb684cb95344d573 Mon Sep 17 00:00:00 2001 From: hamlin Date: Fri, 12 Sep 2025 09:04:32 +0000 Subject: [PATCH 04/32] initial commit --- src/hotspot/cpu/riscv/nativeInst_riscv.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp index 9722fd49d4d3a..72cc95a595dbf 100644 --- a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp +++ b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp @@ -28,6 +28,7 @@ #include "code/compiledIC.hpp" #include "nativeInst_riscv.hpp" #include "oops/oop.inline.hpp" +#include "runtime/atomicAccess.hpp" #include "runtime/handles.hpp" #include "runtime/orderAccess.hpp" #include "runtime/safepoint.hpp" @@ -99,10 +100,10 @@ void NativeCall::optimize_call(address dest, bool mt_safe) { if (Assembler::reachable_from_branch_at(jmp_ins_pc, dest)) { int64_t distance = dest - jmp_ins_pc; uint32_t new_jal = Assembler::encode_jal(ra, distance); - Atomic::store((uint32_t *)jmp_ins_pc, new_jal); + AtomicAccess::store((uint32_t *)jmp_ins_pc, new_jal); } else if (!MacroAssembler::is_jalr_at(jmp_ins_pc)) { // The jalr is always identical: jalr ra, 0(t1) uint32_t new_jalr = Assembler::encode_jalr(ra, t1, 0); - Atomic::store((uint32_t *)jmp_ins_pc, new_jalr); + AtomicAccess::store((uint32_t *)jmp_ins_pc, new_jalr); } else { // No change to instruction stream return; From 2ba466b7b52a9e1ab97042ae399ffa18546328cd Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 4 Nov 2025 20:08:54 +0000 Subject: [PATCH 05/32] disable riscv --- src/hotspot/cpu/riscv/matcher_riscv.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/riscv/matcher_riscv.hpp b/src/hotspot/cpu/riscv/matcher_riscv.hpp index 3e9af4d3d443f..d959324365c33 100644 --- a/src/hotspot/cpu/riscv/matcher_riscv.hpp +++ b/src/hotspot/cpu/riscv/matcher_riscv.hpp @@ -200,7 +200,7 @@ } static bool supports_vectorize_cmove_bool_unconditionally() { - return true; + return false; } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { From 2a0e1ad82091a8046f6e13c2d27a271f46a68461 Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 4 Nov 2025 20:24:15 +0000 Subject: [PATCH 06/32] disable Op_CMoveI/Op_CMoveL in VectorNode::opcode --- src/hotspot/share/opto/vectornode.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 0ece1db288334..8c0b0b3c288fe 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -86,10 +86,6 @@ int VectorNode::opcode(int sopc, BasicType bt) { return (bt == T_FLOAT ? Op_FmaVF : 0); case Op_FmaHF: return (bt == T_SHORT ? Op_FmaVHF : 0); - case Op_CMoveI: - return (bt == T_INT ? Op_VectorBlend : 0); - case Op_CMoveL: - return (bt == T_LONG ? Op_VectorBlend : 0); case Op_CMoveF: return (bt == T_FLOAT ? Op_VectorBlend : 0); case Op_CMoveD: From 9e5f137fd83b86b710ea0af28f66d6c35db108fa Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 4 Nov 2025 20:59:06 +0000 Subject: [PATCH 07/32] revert supports_transform_cmove_to_vectorblend for all cpus --- src/hotspot/cpu/aarch64/matcher_aarch64.hpp | 8 +------- src/hotspot/cpu/arm/matcher_arm.hpp | 8 +------- src/hotspot/cpu/ppc/matcher_ppc.hpp | 8 +------- src/hotspot/cpu/riscv/matcher_riscv.hpp | 8 +------- src/hotspot/cpu/s390/matcher_s390.hpp | 8 +------- src/hotspot/cpu/x86/matcher_x86.hpp | 8 +------- 6 files changed, 6 insertions(+), 42 deletions(-) diff --git a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp index 58f0faf103ac0..78efebbae1f23 100644 --- a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp @@ -210,13 +210,7 @@ } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { - switch (cmove_opc) { - case Op_CMoveF: - case Op_CMoveD: - return true; - default: - return false; - } + return false; } #endif // CPU_AARCH64_MATCHER_AARCH64_HPP diff --git a/src/hotspot/cpu/arm/matcher_arm.hpp b/src/hotspot/cpu/arm/matcher_arm.hpp index fa5b54358da68..442bb0a40070f 100644 --- a/src/hotspot/cpu/arm/matcher_arm.hpp +++ b/src/hotspot/cpu/arm/matcher_arm.hpp @@ -198,13 +198,7 @@ } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { - switch (cmove_opc) { - case Op_CMoveF: - case Op_CMoveD: - return true; - default: - return false; - } + return false; } #endif // CPU_ARM_MATCHER_ARM_HPP diff --git a/src/hotspot/cpu/ppc/matcher_ppc.hpp b/src/hotspot/cpu/ppc/matcher_ppc.hpp index 908d2d172ba80..91c4825facccf 100644 --- a/src/hotspot/cpu/ppc/matcher_ppc.hpp +++ b/src/hotspot/cpu/ppc/matcher_ppc.hpp @@ -208,13 +208,7 @@ } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { - switch (cmove_opc) { - case Op_CMoveF: - case Op_CMoveD: - return true; - default: - return false; - } + return false; } #endif // CPU_PPC_MATCHER_PPC_HPP diff --git a/src/hotspot/cpu/riscv/matcher_riscv.hpp b/src/hotspot/cpu/riscv/matcher_riscv.hpp index d959324365c33..8499182e7f1dd 100644 --- a/src/hotspot/cpu/riscv/matcher_riscv.hpp +++ b/src/hotspot/cpu/riscv/matcher_riscv.hpp @@ -204,13 +204,7 @@ } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { - switch (cmove_opc) { - case Op_CMoveF: - case Op_CMoveD: - return true; - default: - return false; - } + return false; } #endif // CPU_RISCV_MATCHER_RISCV_HPP diff --git a/src/hotspot/cpu/s390/matcher_s390.hpp b/src/hotspot/cpu/s390/matcher_s390.hpp index fc118d2c0b790..bdadfa1929286 100644 --- a/src/hotspot/cpu/s390/matcher_s390.hpp +++ b/src/hotspot/cpu/s390/matcher_s390.hpp @@ -201,13 +201,7 @@ } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { - switch (cmove_opc) { - case Op_CMoveF: - case Op_CMoveD: - return true; - default: - return false; - } + return false; } #endif // CPU_S390_MATCHER_S390_HPP diff --git a/src/hotspot/cpu/x86/matcher_x86.hpp b/src/hotspot/cpu/x86/matcher_x86.hpp index b7453b5f27529..580515434c857 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -241,13 +241,7 @@ } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { - switch (cmove_opc) { - case Op_CMoveF: - case Op_CMoveD: - return true; - default: - return false; - } + return false; } #endif // CPU_X86_MATCHER_X86_HPP From bc0c9b3fa2af8c21b51545f90ee58720f413dcb9 Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 4 Nov 2025 22:23:02 +0000 Subject: [PATCH 08/32] fix JDK-8371297: assert in BoolTest --- src/hotspot/share/opto/vtransform.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/opto/vtransform.cpp b/src/hotspot/share/opto/vtransform.cpp index 46e8f43cb657d..40c5206bccb95 100644 --- a/src/hotspot/share/opto/vtransform.cpp +++ b/src/hotspot/share/opto/vtransform.cpp @@ -1421,8 +1421,9 @@ void VTransformReinterpretVectorNode::print_spec() const { void VTransformBoolVectorNode::print_spec() const { VTransformVectorNode::print_spec(); - const BoolTest bt(_test._mask); - tty->print(" test="); + BoolTest::mask m = BoolTest::mask(_test._mask & ~BoolTest::unsigned_compare); + const BoolTest bt(m); + tty->print(" test=%s", m == _test._mask ? "" : "unsigned "); bt.dump_on(tty); } #endif From f34c74b7dde9e0e4922ed191f4761924c1e2d9bb Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 4 Nov 2025 23:06:30 +0000 Subject: [PATCH 09/32] initial commit --- .../cpu/riscv/c2_MacroAssembler_riscv.cpp | 81 +++ .../cpu/riscv/c2_MacroAssembler_riscv.hpp | 10 + .../cpu/riscv/macroAssembler_riscv.cpp | 503 +++++++++++++++++- .../cpu/riscv/macroAssembler_riscv.hpp | 16 + src/hotspot/cpu/riscv/matcher_riscv.hpp | 10 +- src/hotspot/cpu/riscv/riscv.ad | 317 ++++++++++- src/hotspot/cpu/riscv/riscv_v.ad | 2 + .../c2/irTests/TestVectorConditionalMove.java | 326 +++++++++--- 8 files changed, 1176 insertions(+), 89 deletions(-) diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp index 154b62db47fdf..d18dcc90cf51e 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp @@ -2067,6 +2067,87 @@ void C2_MacroAssembler::enc_cmove_cmp_fp(int cmpFlag, FloatRegister op1, FloatRe } } +void C2_MacroAssembler::enc_cmove_fp_cmp(int cmpFlag, + Register op1, Register op2, Register tmp1, Register tmp2, + FloatRegister dst, FloatRegister src, bool is_single) { + bool is_unsigned = (cmpFlag & unsigned_branch_mask) == unsigned_branch_mask; + int op_select = cmpFlag & (~unsigned_branch_mask); + + switch (op_select) { + case BoolTest::eq: + cmov_fp_eq(op1, op2, tmp1, tmp2, dst, src, is_single); + break; + case BoolTest::ne: + cmov_fp_ne(op1, op2, tmp1, tmp2, dst, src, is_single); + break; + case BoolTest::le: + if (is_unsigned) { + cmov_fp_leu(op1, op2, tmp1, tmp2, dst, src, is_single); + } else { + cmov_fp_le(op1, op2, tmp1, tmp2, dst, src, is_single); + } + break; + case BoolTest::ge: + if (is_unsigned) { + cmov_fp_geu(op1, op2, tmp1, tmp2, dst, src, is_single); + } else { + cmov_fp_ge(op1, op2, tmp1, tmp2, dst, src, is_single); + } + break; + case BoolTest::lt: + if (is_unsigned) { + cmov_fp_ltu(op1, op2, tmp1, tmp2, dst, src, is_single); + } else { + cmov_fp_lt(op1, op2, tmp1, tmp2, dst, src, is_single); + } + break; + case BoolTest::gt: + if (is_unsigned) { + cmov_fp_gtu(op1, op2, tmp1, tmp2, dst, src, is_single); + } else { + cmov_fp_gt(op1, op2, tmp1, tmp2, dst, src, is_single); + } + break; + default: + assert(false, "unsupported compare condition"); + ShouldNotReachHere(); + } +} + +void C2_MacroAssembler::enc_cmove_fp_cmp_fp(int cmpFlag, + FloatRegister op1, FloatRegister op2, + Register tmp1, Register tmp2, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single) { + int op_select = cmpFlag & (~unsigned_branch_mask); + + switch (op_select) { + case BoolTest::eq: + cmov_fp_cmp_fp_eq(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + break; + case BoolTest::ne: + cmov_fp_cmp_fp_ne(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + break; + case BoolTest::le: + cmov_fp_cmp_fp_le(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + break; + case BoolTest::ge: + assert(false, "Should go to BoolTest::le case"); + ShouldNotReachHere(); + break; + case BoolTest::lt: + cmov_fp_cmp_fp_lt(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + break; + case BoolTest::gt: + assert(false, "Should go to BoolTest::lt case"); + ShouldNotReachHere(); + break; + default: + assert(false, "unsupported compare condition"); + ShouldNotReachHere(); + } +} + // Set dst to NaN if any NaN input. void C2_MacroAssembler::minmax_fp(FloatRegister dst, FloatRegister src1, FloatRegister src2, FLOAT_TYPE ft, bool is_min) { diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp index 2d5339dc153c8..6ed1bce63441e 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp @@ -132,6 +132,16 @@ FloatRegister op1, FloatRegister op2, Register dst, Register src, bool is_single); + void enc_cmove_fp_cmp(int cmpFlag, + Register op1, Register op2, Register tmp1, Register tmp2, + FloatRegister dst, FloatRegister src, bool is_single); + + void enc_cmove_fp_cmp_fp(int cmpFlag, + FloatRegister op1, FloatRegister op2, + Register tmp1, Register tmp2, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single); + void spill(Register r, bool is64, int offset) { is64 ? sd(r, Address(sp, offset)) : sw(r, Address(sp, offset)); diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 700e42e6194ce..871c942e5ed83 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -1240,7 +1240,309 @@ void MacroAssembler::cmov_gtu(Register cmp1, Register cmp2, Register dst, Regist bind(no_set); } -// ----------- cmove, compare float ----------- +// ----------- cmove float/double ----------- + +void MacroAssembler::cmov_fp_eq(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + xorr(t0, cmp1, cmp2); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0 , tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + bne(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_ne(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + xorr(t0, cmp1, cmp2); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_nez(tmpDst, tmpDst, t0); + czero_eqz(t0 , tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + beq(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_le(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + slt(t0, cmp2, cmp1); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + bgt(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_leu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + sltu(t0, cmp2, cmp1); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + bgtu(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_ge(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + slt(t0, cmp1, cmp2); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + blt(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_geu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + sltu(t0, cmp1, cmp2); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + bltu(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_lt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + slt(t0, cmp1, cmp2); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_nez(tmpDst, tmpDst, t0); + czero_eqz(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + bge(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_ltu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + sltu(t0, cmp1, cmp2); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_nez(tmpDst, tmpDst, t0); + czero_eqz(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + bgeu(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_gt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + slt(t0, cmp2, cmp1); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_nez(tmpDst, tmpDst, t0); + czero_eqz(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + ble(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +void MacroAssembler::cmov_fp_gtu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { + if (UseZicond) { + sltu(t0, cmp2, cmp1); + if (is_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_nez(tmpDst, tmpDst, t0); + czero_eqz(t0, tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (is_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + bleu(cmp1, cmp2, no_set); + if (is_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +// ----------- cmove, compare float/double ----------- // // For CmpF/D + CMoveI/L, ordered ones are quite straight and simple, // so, just list behaviour of unordered ones as follow. @@ -1397,6 +1699,205 @@ void MacroAssembler::cmov_cmp_fp_gt(FloatRegister cmp1, FloatRegister cmp2, Regi mv(dst, src); bind(no_set); } +// ----------- cmove float/double, compare float/double ----------- + +// Move src to dst only if cmp1 == cmp2, +// otherwise leave dst unchanged, including the case where one of them is NaN. +// Clarification: +// java code : cmp1 != cmp2 ? dst : src +// transformed to : CMove dst, (cmp1 eq cmp2), dst, src +void MacroAssembler::cmov_fp_cmp_fp_eq(FloatRegister cmp1, FloatRegister cmp2, + Register tmpDst, Register tmpSrc, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single) { + if (UseZicond) { + if (cmp_single) { + feq_s(t0, cmp1, cmp2); + } else { + feq_d(t0, cmp1, cmp2); + } + if (cmov_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_nez(tmpDst, tmpDst, t0); + czero_eqz(t0 , tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (cmov_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + if (cmp_single) { + // jump if cmp1 != cmp2, including the case of NaN + // not jump (i.e. move src to dst) if cmp1 == cmp2 + float_bne(cmp1, cmp2, no_set); + } else { + double_bne(cmp1, cmp2, no_set); + } + if (cmov_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +// Keep dst unchanged only if cmp1 == cmp2, +// otherwise move src to dst, including the case where one of them is NaN. +// Clarification: +// java code : cmp1 == cmp2 ? dst : src +// transformed to : CMove dst, (cmp1 ne cmp2), dst, src +void MacroAssembler::cmov_fp_cmp_fp_ne(FloatRegister cmp1, FloatRegister cmp2, + Register tmpDst, Register tmpSrc, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single) { + if (UseZicond) { + if (cmp_single) { + feq_s(t0, cmp1, cmp2); + } else { + feq_d(t0, cmp1, cmp2); + } + if (cmov_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0 , tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (cmov_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + if (cmp_single) { + // jump if cmp1 == cmp2 + // not jump (i.e. move src to dst) if cmp1 != cmp2, including the case of NaN + float_beq(cmp1, cmp2, no_set); + } else { + double_beq(cmp1, cmp2, no_set); + } + if (cmov_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +// When cmp1 <= cmp2 or any of them is NaN then dst = src, otherwise, dst = dst +// Clarification +// scenario 1: +// java code : cmp2 < cmp1 ? dst : src +// transformed to : CMove dst, (cmp1 le cmp2), dst, src +// scenario 2: +// java code : cmp1 > cmp2 ? dst : src +// transformed to : CMove dst, (cmp1 le cmp2), dst, src +void MacroAssembler::cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, + Register tmpDst, Register tmpSrc, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single) { + if (UseZicond) { + if (cmp_single) { + flt_s(t0, cmp2, cmp1); + } else { + flt_d(t0, cmp2, cmp1); + } + if (cmov_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0 , tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (cmov_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + if (cmp_single) { + // jump if cmp1 > cmp2 + // not jump (i.e. move src to dst) if cmp1 <= cmp2 or either is NaN + float_bgt(cmp1, cmp2, no_set); + } else { + double_bgt(cmp1, cmp2, no_set); + } + if (cmov_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + +// When cmp1 < cmp2 or any of them is NaN then dst = src, otherwise, dst = dst +// Clarification +// scenario 1: +// java code : cmp2 <= cmp1 ? dst : src +// transformed to : CMove dst, (cmp1 lt cmp2), dst, src +// scenario 2: +// java code : cmp1 >= cmp2 ? dst : src +// transformed to : CMove dst, (cmp1 lt cmp2), dst, src +void MacroAssembler::cmov_fp_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, + Register tmpDst, Register tmpSrc, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single) { + if (UseZicond) { + if (cmp_single) { + fle_s(t0, cmp2, cmp1); + } else { + fle_d(t0, cmp2, cmp1); + } + if (cmov_single) { + fmv_x_w(tmpDst, dst); + fmv_x_w(tmpSrc, src); + } else { + fmv_x_d(tmpDst, dst); + fmv_x_d(tmpSrc, src); + } + czero_eqz(tmpDst, tmpDst, t0); + czero_nez(t0 , tmpSrc, t0); + orr(tmpDst, tmpDst, t0); + if (cmov_single) { + fmv_w_x(dst, tmpDst); + } else { + fmv_d_x(dst, tmpDst); + } + return; + } + Label no_set; + if (cmp_single) { + // jump if cmp1 >= cmp2 + // not jump (i.e. move src to dst) if cmp1 < cmp2 or either is NaN + float_bge(cmp1, cmp2, no_set); + } else { + double_bge(cmp1, cmp2, no_set); + } + if (cmov_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} // Float compare branch instructions diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index 9e713e9027022..2c6e128cdc9ac 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -664,6 +664,22 @@ class MacroAssembler: public Assembler { void cmov_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, Register dst, Register src, bool is_single); void cmov_cmp_fp_gt(FloatRegister cmp1, FloatRegister cmp2, Register dst, Register src, bool is_single); + void cmov_fp_eq(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_ne(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_le(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_leu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_ge(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_geu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_lt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_ltu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_gt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_gtu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); + + void cmov_fp_cmp_fp_eq(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_ne(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + public: // We try to follow risc-v asm menomics. // But as we don't layout a reachable GOT, diff --git a/src/hotspot/cpu/riscv/matcher_riscv.hpp b/src/hotspot/cpu/riscv/matcher_riscv.hpp index 8499182e7f1dd..3e9af4d3d443f 100644 --- a/src/hotspot/cpu/riscv/matcher_riscv.hpp +++ b/src/hotspot/cpu/riscv/matcher_riscv.hpp @@ -200,11 +200,17 @@ } static bool supports_vectorize_cmove_bool_unconditionally() { - return false; + return true; } static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { - return false; + switch (cmove_opc) { + case Op_CMoveF: + case Op_CMoveD: + return true; + default: + return false; + } } #endif // CPU_RISCV_MATCHER_RISCV_HPP diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index 83c59af9113e9..7d4a95d45ba05 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -1933,8 +1933,6 @@ bool Matcher::match_rule_supported(int opcode) { case Op_SubHF: return UseZfh; - case Op_CMoveF: - case Op_CMoveD: case Op_CMoveP: case Op_CMoveN: return false; @@ -10464,6 +10462,321 @@ instruct cmovL_cmpP(iRegLNoSp dst, iRegL src, iRegP op1, iRegP op2, cmpOpU cop) ins_pipe(pipe_class_compare); %} +// --------- CMoveF --------- + +instruct cmovF_cmpI(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveF (Binary cop (CmpI op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpI\n\t" + %} + + ins_encode %{ + // __ stop("cmovF_cmpI"); + __ enc_cmove_fp_cmp($cop$$cmpcode, + as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovF_cmpU(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ + match(Set dst (CMoveF (Binary cop (CmpU op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpU\n\t" + %} + + ins_encode %{ + // __ stop("cmovF_cmpU"); + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovF_cmpL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveF (Binary cop (CmpL op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpL\n\t" + %} + + ins_encode %{ + // __ stop("cmovF_cmpL"); + __ enc_cmove_fp_cmp($cop$$cmpcode, + as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovF_cmpUL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ + match(Set dst (CMoveF (Binary cop (CmpUL op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpUL\n\t" + %} + + ins_encode %{ + // __ stop("cmovF_cmpUL"); + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovF_cmpF(fRegF dst, fRegF src, fRegF op1, fRegF op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveF (Binary cop (CmpF op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpF\n\t" + %} + + ins_encode %{ + // __ stop("cmovF_cmpF"); + __ enc_cmove_fp_cmp_fp($cop$$cmpcode, + as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), + true /* cmp_single */, true /* cmov_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovF_cmpD(fRegF dst, fRegF src, fRegD op1, fRegD op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveF (Binary cop (CmpD op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpD\n\t" + %} + + ins_encode %{ + // __ stop("cmovF_cmpD"); + __ enc_cmove_fp_cmp_fp($cop$$cmpcode | C2_MacroAssembler::double_branch_mask, + as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), + false /* cmp_single */, true /* cmov_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovF_cmpN(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveF (Binary cop (CmpN op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpN\n\t" + %} + + ins_encode %{ + // __ stop("cmovF_cmpN"); + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovF_cmpP(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveF (Binary cop (CmpP op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveF $dst, ($op1 $cop $op2), $dst, $src\t#@cmovF_cmpP\n\t" + %} + + ins_encode %{ + __ stop("cmovF_cmpP"); + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +// --------- CMoveD --------- + +instruct cmovD_cmpI(fRegD dst, fRegD src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveD (Binary cop (CmpI op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpI\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp($cop$$cmpcode, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovD_cmpU(fRegD dst, fRegD src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ + match(Set dst (CMoveD (Binary cop (CmpU op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpU\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovD_cmpL(fRegD dst, fRegD src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveD (Binary cop (CmpL op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpL\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp($cop$$cmpcode, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovD_cmpUL(fRegD dst, fRegD src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ + match(Set dst (CMoveD (Binary cop (CmpUL op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpUL\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovD_cmpF(fRegD dst, fRegD src, fRegF op1, fRegF op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveD (Binary cop (CmpF op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpF\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp_fp($cop$$cmpcode, + as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), + true /* cmp_single */, false /* cmov_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovD_cmpD(fRegD dst, fRegD src, fRegD op1, fRegD op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveD (Binary cop (CmpD op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpD\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp_fp($cop$$cmpcode | C2_MacroAssembler::double_branch_mask, + as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), + false /* cmp_single */, false /* cmov_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovD_cmpN(fRegD dst, fRegD src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveD (Binary cop (CmpN op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpN\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} + +instruct cmovD_cmpP(fRegD dst, fRegD src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ + match(Set dst (CMoveD (Binary cop (CmpP op1 op2)) (Binary dst src))); + effect(TEMP tmp1, TEMP tmp2); + ins_cost(ALU_COST + BRANCH_COST); + + format %{ + "CMoveD $dst, ($op1 $cop $op2), $dst, $src\t#@cmovD_cmpP\n\t" + %} + + ins_encode %{ + __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, + as_Register($op1$$reg), as_Register($op2$$reg), + as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); + %} + + ins_pipe(pipe_class_compare); +%} // ============================================================================ // Procedure Call/Return Instructions diff --git a/src/hotspot/cpu/riscv/riscv_v.ad b/src/hotspot/cpu/riscv/riscv_v.ad index fe323474d60de..196c6d3f4c48e 100644 --- a/src/hotspot/cpu/riscv/riscv_v.ad +++ b/src/hotspot/cpu/riscv/riscv_v.ad @@ -230,6 +230,7 @@ instruct vstoremask(vReg dst, vRegMask_V0 v0, immI size) %{ instruct vmaskcmp(vRegMask dst, vReg src1, vReg src2, immI cond) %{ predicate(Matcher::vector_element_basic_type(n) == T_BYTE || + Matcher::vector_element_basic_type(n) == T_CHAR || Matcher::vector_element_basic_type(n) == T_SHORT || Matcher::vector_element_basic_type(n) == T_INT || Matcher::vector_element_basic_type(n) == T_LONG); @@ -247,6 +248,7 @@ instruct vmaskcmp(vRegMask dst, vReg src1, vReg src2, immI cond) %{ instruct vmaskcmp_masked(vRegMask dst, vReg src1, vReg src2, immI cond, vRegMask_V0 v0) %{ predicate(Matcher::vector_element_basic_type(n) == T_BYTE || + Matcher::vector_element_basic_type(n) == T_CHAR || Matcher::vector_element_basic_type(n) == T_SHORT || Matcher::vector_element_basic_type(n) == T_INT || Matcher::vector_element_basic_type(n) == T_LONG); diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java index 4759add94e9cf..72458494db1c6 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java @@ -586,7 +586,7 @@ private double cmoveDGTforD(double a, double b, double c, double d) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVFGT(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] > b[i]) ? a[i] : b[i]; @@ -598,7 +598,7 @@ private static void testCMoveVFGT(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] > a[i]) ? a[i] : b[i]; @@ -610,7 +610,7 @@ private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVFLT(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] < b[i]) ? a[i] : b[i]; @@ -622,7 +622,7 @@ private static void testCMoveVFLT(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] < a[i]) ? a[i] : b[i]; @@ -634,7 +634,7 @@ private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVFEQ(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] == b[i]) ? a[i] : b[i]; @@ -646,7 +646,7 @@ private static void testCMoveVFEQ(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVDLE(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] <= b[i]) ? a[i] : b[i]; @@ -658,7 +658,7 @@ private static void testCMoveVDLE(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] <= a[i]) ? a[i] : b[i]; @@ -670,7 +670,7 @@ private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVDGE(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] >= b[i]) ? a[i] : b[i]; @@ -682,7 +682,7 @@ private static void testCMoveVDGE(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] >= a[i]) ? a[i] : b[i]; @@ -694,7 +694,7 @@ private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveVDNE(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] != b[i]) ? a[i] : b[i]; @@ -707,7 +707,7 @@ private static void testCMoveVDNE(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] > b[i]) ? 0.1f : -0.1f; @@ -719,7 +719,7 @@ private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] >= b[i]) ? 0.1f : -0.1f; @@ -731,7 +731,7 @@ private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] < b[i]) ? 0.1f : -0.1f; @@ -743,7 +743,7 @@ private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] <= b[i]) ? 0.1f : -0.1f; @@ -755,7 +755,7 @@ private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] == b[i]) ? 0.1f : -0.1f; @@ -767,7 +767,7 @@ private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] != b[i]) ? 0.1f : -0.1f; @@ -780,7 +780,7 @@ private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; @@ -798,7 +798,7 @@ private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; @@ -815,7 +815,7 @@ private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, "=0", IRNode.VECTOR_BLEND_F, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; @@ -828,7 +828,7 @@ private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, "=0", IRNode.VECTOR_BLEND_F, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFXXforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; @@ -841,7 +841,7 @@ private static void testCMoveFXXforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] > b[i]) ? 0.1 : -0.1; @@ -853,7 +853,7 @@ private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] >= b[i]) ? 0.1 : -0.1; @@ -865,7 +865,7 @@ private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] < b[i]) ? 0.1 : -0.1; @@ -877,7 +877,7 @@ private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] <= b[i]) ? 0.1 : -0.1; @@ -889,7 +889,7 @@ private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] == b[i]) ? 0.1 : -0.1; @@ -901,7 +901,7 @@ private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] != b[i]) ? 0.1 : -0.1; @@ -913,7 +913,7 @@ private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDLTforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; @@ -926,7 +926,7 @@ private static void testCMoveDLTforDConstH2(double[] a, double[] b, double[] c) IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDLEforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; @@ -939,7 +939,7 @@ private static void testCMoveDLEforDConstH2(double[] a, double[] b, double[] c) IRNode.VECTOR_MASK_CMP_D, "=0", IRNode.VECTOR_BLEND_D, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDYYforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; @@ -952,7 +952,7 @@ private static void testCMoveDYYforDConstH2(double[] a, double[] b, double[] c) IRNode.VECTOR_MASK_CMP_D, "=0", IRNode.VECTOR_BLEND_D, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDXXforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; @@ -1108,7 +1108,7 @@ private static void testCMoveILEforL(int[] a, int[] b, long[] c, long[] d, long[ IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1124,7 +1124,7 @@ private static void testCMoveIEQforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1140,7 +1140,7 @@ private static void testCMoveINEforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1156,7 +1156,7 @@ private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1172,7 +1172,7 @@ private static void testCMoveIGEforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1188,7 +1188,7 @@ private static void testCMoveILTforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1200,7 +1200,13 @@ private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, flo // I fo D @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1211,7 +1217,13 @@ private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1222,7 +1234,13 @@ private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1233,7 +1251,13 @@ private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1244,7 +1268,13 @@ private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1255,7 +1285,13 @@ private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1401,7 +1437,13 @@ private static void testCMoveLLEforL(long[] a, long[] b, long[] c, long[] d, lon // L fo F @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1412,7 +1454,13 @@ private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1423,7 +1471,13 @@ private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1434,7 +1488,13 @@ private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1445,7 +1505,13 @@ private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1456,7 +1522,13 @@ private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1473,7 +1545,7 @@ private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, f IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1490,7 +1562,7 @@ private static void testCMoveLEQforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1507,7 +1579,7 @@ private static void testCMoveLNEforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1524,7 +1596,7 @@ private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1541,7 +1613,7 @@ private static void testCMoveLGEforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1558,7 +1630,7 @@ private static void testCMoveLLTforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1711,7 +1783,7 @@ private static void testCMoveUILEforL(int[] a, int[] b, long[] c, long[] d, long IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveUIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1727,7 +1799,7 @@ private static void testCMoveUIEQforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveUINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1743,7 +1815,7 @@ private static void testCMoveUINEforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveUIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1759,7 +1831,7 @@ private static void testCMoveUIGTforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveUIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1775,7 +1847,7 @@ private static void testCMoveUIGEforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveUILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1791,7 +1863,7 @@ private static void testCMoveUILTforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1803,7 +1875,13 @@ private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, fl // I fo D @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1814,7 +1892,13 @@ private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1825,7 +1909,13 @@ private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1836,7 +1926,13 @@ private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1847,7 +1943,13 @@ private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1858,7 +1960,13 @@ private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveUILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -2004,7 +2112,13 @@ private static void testCMoveULLEforL(long[] a, long[] b, long[] c, long[] d, lo // L fo F @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2015,7 +2129,13 @@ private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2026,7 +2146,13 @@ private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2037,7 +2163,13 @@ private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2048,7 +2180,13 @@ private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2059,7 +2197,13 @@ private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2076,7 +2220,7 @@ private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2093,7 +2237,7 @@ private static void testCMoveULEQforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2110,7 +2254,7 @@ private static void testCMoveULNEforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2127,7 +2271,7 @@ private static void testCMoveULGTforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2144,7 +2288,7 @@ private static void testCMoveULGEforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2161,7 +2305,7 @@ private static void testCMoveULLTforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2199,7 +2343,7 @@ private static void testCMoveFGTforL(float[] a, float[] b, long[] c, long[] d, l IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2210,7 +2354,13 @@ private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", + IRNode.LOAD_VECTOR_D, ">0", + IRNode.VECTOR_MASK_CMP_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", + IRNode.VECTOR_BLEND_D, ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -2243,7 +2393,13 @@ private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, } @Test - @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.LOAD_VECTOR_D, ">0", + IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", + IRNode.VECTOR_MASK_CMP_D, ">0", + IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfCPUFeatureOr = {"rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2258,7 +2414,7 @@ private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -2274,7 +2430,7 @@ private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[ IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < b.length; i++) { float cc = c[i]; @@ -2289,7 +2445,7 @@ private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) private static void testCMoveFGTforFCmpCon2(float[] a, float b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2714,10 +2870,12 @@ private void testCMove_runner_two() { } // I for D + boolean passed = true; testCMoveIEQforD(aI, bI, cD, dD, rD, rD); for (int i = 0; i < SIZE; i++) { Asserts.assertEquals(rD[i], cmoveIEQforD(aI[i], bI[i], cD[i], dD[i])); } + Asserts.assertEquals(passed, true); testCMoveINEforD(aI, bI, cD, dD, rD, rD); for (int i = 0; i < SIZE; i++) { From 5b85c740a13daa24b66b6b6e621d82cdeac633a9 Mon Sep 17 00:00:00 2001 From: hamlin Date: Wed, 5 Nov 2025 09:32:15 +0000 Subject: [PATCH 10/32] fix code path change in VectorNode::implemented --- src/hotspot/share/opto/vectornode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 8c0b0b3c288fe..299d3f5b5b621 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -314,8 +314,8 @@ bool VectorNode::implemented(int opc, uint vlen, BasicType bt) { if (VectorNode::is_vector_integral_negate(vopc)) { return is_vector_integral_negate_supported(vopc, vlen, bt, false); } - if (vopc == Op_VectorBlend) { - return VectorBlendNode::implemented(opc); + if (vopc == Op_VectorBlend && VectorBlendNode::implemented(opc)) { + return true; } return vopc > 0 && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, bt); } From 81996cfe126ef5e160800c406c292ddb0b357905 Mon Sep 17 00:00:00 2001 From: hamlin Date: Wed, 5 Nov 2025 11:55:21 +0000 Subject: [PATCH 11/32] simplify --- src/hotspot/cpu/aarch64/matcher_aarch64.hpp | 6 +----- src/hotspot/cpu/arm/matcher_arm.hpp | 6 +----- src/hotspot/cpu/ppc/matcher_ppc.hpp | 6 +----- src/hotspot/cpu/riscv/matcher_riscv.hpp | 6 +----- src/hotspot/cpu/s390/matcher_s390.hpp | 6 +----- src/hotspot/cpu/x86/matcher_x86.hpp | 6 +----- src/hotspot/share/opto/superword.cpp | 7 ++----- src/hotspot/share/opto/vectornode.cpp | 14 ++------------ src/hotspot/share/opto/vectornode.hpp | 4 +--- 9 files changed, 11 insertions(+), 50 deletions(-) diff --git a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp index 78efebbae1f23..49eae1cc438a1 100644 --- a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp @@ -205,11 +205,7 @@ return (VM_Version::supports_fphp() && VM_Version::supports_asimdhp()); } - static bool supports_vectorize_cmove_bool_unconditionally() { - return false; - } - - static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + static bool supports_vector_different_use_def_size() { return false; } diff --git a/src/hotspot/cpu/arm/matcher_arm.hpp b/src/hotspot/cpu/arm/matcher_arm.hpp index 442bb0a40070f..28e9caf1ab084 100644 --- a/src/hotspot/cpu/arm/matcher_arm.hpp +++ b/src/hotspot/cpu/arm/matcher_arm.hpp @@ -193,11 +193,7 @@ return false; } - static bool supports_vectorize_cmove_bool_unconditionally() { - return false; - } - - static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + static bool supports_vector_different_use_def_size() { return false; } diff --git a/src/hotspot/cpu/ppc/matcher_ppc.hpp b/src/hotspot/cpu/ppc/matcher_ppc.hpp index 91c4825facccf..987b959aa3b43 100644 --- a/src/hotspot/cpu/ppc/matcher_ppc.hpp +++ b/src/hotspot/cpu/ppc/matcher_ppc.hpp @@ -203,11 +203,7 @@ return false; } - static bool supports_vectorize_cmove_bool_unconditionally() { - return false; - } - - static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + static bool supports_vector_different_use_def_size() { return false; } diff --git a/src/hotspot/cpu/riscv/matcher_riscv.hpp b/src/hotspot/cpu/riscv/matcher_riscv.hpp index 8499182e7f1dd..f3084758b28e8 100644 --- a/src/hotspot/cpu/riscv/matcher_riscv.hpp +++ b/src/hotspot/cpu/riscv/matcher_riscv.hpp @@ -199,11 +199,7 @@ return false; } - static bool supports_vectorize_cmove_bool_unconditionally() { - return false; - } - - static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + static bool supports_vector_different_use_def_size() { return false; } diff --git a/src/hotspot/cpu/s390/matcher_s390.hpp b/src/hotspot/cpu/s390/matcher_s390.hpp index bdadfa1929286..8ab5587aaba20 100644 --- a/src/hotspot/cpu/s390/matcher_s390.hpp +++ b/src/hotspot/cpu/s390/matcher_s390.hpp @@ -196,11 +196,7 @@ return false; } - static bool supports_vectorize_cmove_bool_unconditionally() { - return false; - } - - static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + static bool supports_vector_different_use_def_size() { return false; } diff --git a/src/hotspot/cpu/x86/matcher_x86.hpp b/src/hotspot/cpu/x86/matcher_x86.hpp index 580515434c857..d12cb7cb84276 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -236,11 +236,7 @@ } } - static bool supports_vectorize_cmove_bool_unconditionally() { - return false; - } - - static bool supports_transform_cmove_to_vectorblend(int cmove_opc) { + static bool supports_vector_different_use_def_size() { return false; } diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index c8e4e43b457d9..dea8be591d7ac 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2334,11 +2334,8 @@ bool SuperWord::is_velt_basic_type_compatible_use_def(Node* use, Node* def) cons // Input size of use equals output size of def if (type2aelembytes(use_bt) == type2aelembytes(def_bt)) { return true; - } - - if (use->is_CMove() && def->is_Bool() && - VectorNode::is_vectorize_cmove_bool_unconditionally_supported()) { - return true; + } else if (VectorNode::is_different_use_def_size_supported()) { + return use->is_CMove() && def->is_Bool(); } return false; diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 299d3f5b5b621..b6480c3a9652a 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -314,9 +314,6 @@ bool VectorNode::implemented(int opc, uint vlen, BasicType bt) { if (VectorNode::is_vector_integral_negate(vopc)) { return is_vector_integral_negate_supported(vopc, vlen, bt, false); } - if (vopc == Op_VectorBlend && VectorBlendNode::implemented(opc)) { - return true; - } return vopc > 0 && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, bt); } return false; @@ -409,8 +406,8 @@ bool VectorNode::is_populate_index_supported(BasicType bt) { return Matcher::match_rule_supported_vector(Op_PopulateIndex, vlen, bt); } -bool VectorNode::is_vectorize_cmove_bool_unconditionally_supported() { - return Matcher::supports_vectorize_cmove_bool_unconditionally(); +bool VectorNode::is_different_use_def_size_supported() { + return Matcher::supports_vector_different_use_def_size(); } bool VectorNode::is_shift_opcode(int opc) { @@ -2310,13 +2307,6 @@ Node* VectorBlendNode::Identity(PhaseGVN* phase) { return this; } -bool VectorBlendNode::implemented(int opc) { - assert(opc == Op_CMoveF || opc == Op_CMoveD || - opc == Op_CMoveI || opc == Op_CMoveL || - opc == Op_CMoveN || opc == Op_CMoveP, "must"); - return Matcher::supports_transform_cmove_to_vectorblend(opc); -} - static bool is_replicate_uint_constant(const Node* n) { return n->Opcode() == Op_Replicate && n->in(1)->is_Con() && diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index 330fe17e88d05..915e114cb252c 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -112,7 +112,7 @@ class VectorNode : public TypeNode { static bool is_populate_index_supported(BasicType bt); // Supports to vectorize CMove which uses Bool unconditionally? // Otherwise only same type size of CMove and Bool will be supported for this transformation. - static bool is_vectorize_cmove_bool_unconditionally_supported(); + static bool is_different_use_def_size_supported(); // Return true if every bit in this vector is 1. static bool is_all_ones_vector(Node* n); // Return true if every bit in this vector is 0. @@ -1734,8 +1734,6 @@ class VectorBlendNode : public VectorNode { Node* vec1() const { return in(1); } Node* vec2() const { return in(2); } Node* vec_mask() const { return in(3); } - - static bool implemented(int opc); }; class VectorRearrangeNode : public VectorNode { From 56b6e02938103436dc92001c9813212b5874b4ba Mon Sep 17 00:00:00 2001 From: hamlin Date: Wed, 5 Nov 2025 13:41:04 +0000 Subject: [PATCH 12/32] comments --- src/hotspot/share/opto/vectornode.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index 915e114cb252c..aba825081474e 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -110,8 +110,8 @@ class VectorNode : public TypeNode { static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt); static bool is_vector_integral_negate_supported(int opc, uint vlen, BasicType bt, bool use_predicate); static bool is_populate_index_supported(BasicType bt); - // Supports to vectorize CMove which uses Bool unconditionally? - // Otherwise only same type size of CMove and Bool will be supported for this transformation. + // Return true if every bit in this vector is 1, e.g. based on the comparison + // result of 2 floats, set a double result. static bool is_different_use_def_size_supported(); // Return true if every bit in this vector is 1. static bool is_all_ones_vector(Node* n); From caf9b1b0fad5e730ac0b4efc596d56fb8278df7b Mon Sep 17 00:00:00 2001 From: hamlin Date: Fri, 7 Nov 2025 10:20:11 +0000 Subject: [PATCH 13/32] add (scalar) cmove tests --- .../c2/irTests/TestScalarConditionalMove.java | 3072 +++++++++++++++++ .../c2/irTests/TestVectorConditionalMove.java | 6 +- .../compiler/lib/ir_framework/IRNode.java | 25 + 3 files changed, 3101 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java new file mode 100644 index 0000000000000..c9a5c887dcda2 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java @@ -0,0 +1,3072 @@ +/* + * Copyright (c) 2022, 2025, Arm Limited. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, Rivos Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.c2.irTests; + +import compiler.lib.ir_framework.*; +import java.util.Random; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; + +/* + * @test + * @summary Test conditional move. + * @requires vm.simpleArch == "riscv64" + * @library /test/lib / + * @run driver compiler.c2.irTests.TestScalarConditionalMove + */ + +public class TestScalarConditionalMove { + final private static int SIZE = 1024; + private static final Random RANDOM = Utils.getRandomInstance(); + + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders"); + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCompactObjectHeaders"); + } + + // Compare 2 values, and pick one of them + private float cmoveFloatGT(float a, float b) { + return (a > b) ? a : b; + } + + private float cmoveFloatGTSwap(float a, float b) { + return (b > a) ? a : b; + } + + private float cmoveFloatLT(float a, float b) { + return (a < b) ? a : b; + } + + private float cmoveFloatLTSwap(float a, float b) { + return (b < a) ? a : b; + } + + private float cmoveFloatEQ(float a, float b) { + return (a == b) ? a : b; + } + + private double cmoveDoubleLE(double a, double b) { + return (a <= b) ? a : b; + } + + private double cmoveDoubleLESwap(double a, double b) { + return (b <= a) ? a : b; + } + + private double cmoveDoubleGE(double a, double b) { + return (a >= b) ? a : b; + } + + private double cmoveDoubleGESwap(double a, double b) { + return (b >= a) ? a : b; + } + + private double cmoveDoubleNE(double a, double b) { + return (a != b) ? a : b; + } + + // Extensions: compare 2 values, and pick from 2 consts + private float cmoveFGTforFConst(float a, float b) { + return (a > b) ? 0.1f : -0.1f; + } + + private float cmoveFGEforFConst(float a, float b) { + return (a >= b) ? 0.1f : -0.1f; + } + + private float cmoveFLTforFConst(float a, float b) { + return (a < b) ? 0.1f : -0.1f; + } + + private float cmoveFLEforFConst(float a, float b) { + return (a <= b) ? 0.1f : -0.1f; + } + + private float cmoveFEQforFConst(float a, float b) { + return (a == b) ? 0.1f : -0.1f; + } + + private float cmoveFNEQforFConst(float a, float b) { + return (a != b) ? 0.1f : -0.1f; + } + + private double cmoveDGTforDConst(double a, double b) { + return (a > b) ? 0.1 : -0.1; + } + + private double cmoveDGEforDConst(double a, double b) { + return (a >= b) ? 0.1 : -0.1; + } + + private double cmoveDLTforDConst(double a, double b) { + return (a < b) ? 0.1 : -0.1; + } + + private double cmoveDLEforDConst(double a, double b) { + return (a <= b) ? 0.1 : -0.1; + } + + private double cmoveDEQforDConst(double a, double b) { + return (a == b) ? 0.1 : -0.1; + } + + private double cmoveDNEQforDConst(double a, double b) { + return (a != b) ? 0.1 : -0.1; + } + + // Extension: Compare 2 ILFD values, and pick from 2 ILFD values + // Signed comparison: I/L + // I for I + private int cmoveIEQforI(int a, int b, int c, int d) { + return (a == b) ? c : d; + } + + private int cmoveINEforI(int a, int b, int c, int d) { + return (a != b) ? c : d; + } + + private int cmoveIGTforI(int a, int b, int c, int d) { + return (a > b) ? c : d; + } + + private int cmoveIGEforI(int a, int b, int c, int d) { + return (a >= b) ? c : d; + } + + private int cmoveILTforI(int a, int b, int c, int d) { + return (a < b) ? c : d; + } + + private int cmoveILEforI(int a, int b, int c, int d) { + return (a <= b) ? c : d; + } + + // I for L + private long cmoveIEQforL(int a, int b, long c, long d) { + return (a == b) ? c : d; + } + + private long cmoveINEforL(int a, int b, long c, long d) { + return (a != b) ? c : d; + } + + private long cmoveIGTforL(int a, int b, long c, long d) { + return (a > b) ? c : d; + } + + private long cmoveIGEforL(int a, int b, long c, long d) { + return (a >= b) ? c : d; + } + + private long cmoveILTforL(int a, int b, long c, long d) { + return (a < b) ? c : d; + } + + private long cmoveILEforL(int a, int b, long c, long d) { + return (a <= b) ? c : d; + } + + // I for F + private float cmoveIEQforF(int a, int b, float c, float d) { + return (a == b) ? c : d; + } + + private float cmoveINEforF(int a, int b, float c, float d) { + return (a != b) ? c : d; + } + + private float cmoveIGTforF(int a, int b, float c, float d) { + return (a > b) ? c : d; + } + + private float cmoveIGEforF(int a, int b, float c, float d) { + return (a >= b) ? c : d; + } + + private float cmoveILTforF(int a, int b, float c, float d) { + return (a < b) ? c : d; + } + + private float cmoveILEforF(int a, int b, float c, float d) { + return (a <= b) ? c : d; + } + + // I for D + private double cmoveIEQforD(int a, int b, double c, double d) { + return (a == b) ? c : d; + } + + private double cmoveINEforD(int a, int b, double c, double d) { + return (a != b) ? c : d; + } + + private double cmoveIGTforD(int a, int b, double c, double d) { + return (a > b) ? c : d; + } + + private double cmoveIGEforD(int a, int b, double c, double d) { + return (a >= b) ? c : d; + } + + private double cmoveILTforD(int a, int b, double c, double d) { + return (a < b) ? c : d; + } + + private double cmoveILEforD(int a, int b, double c, double d) { + return (a <= b) ? c : d; + } + + // L for I + private int cmoveLEQforI(long a, long b, int c, int d) { + return (a == b) ? c : d; + } + + private int cmoveLNEforI(long a, long b, int c, int d) { + return (a != b) ? c : d; + } + + private int cmoveLGTforI(long a, long b, int c, int d) { + return (a > b) ? c : d; + } + + private int cmoveLGEforI(long a, long b, int c, int d) { + return (a >= b) ? c : d; + } + + private int cmoveLLTforI(long a, long b, int c, int d) { + return (a < b) ? c : d; + } + + private int cmoveLLEforI(long a, long b, int c, int d) { + return (a <= b) ? c : d; + } + + // L for L + private long cmoveLEQforL(long a, long b, long c, long d) { + return (a == b) ? c : d; + } + + private long cmoveLNEforL(long a, long b, long c, long d) { + return (a != b) ? c : d; + } + + private long cmoveLGTforL(long a, long b, long c, long d) { + return (a > b) ? c : d; + } + + private long cmoveLGEforL(long a, long b, long c, long d) { + return (a >= b) ? c : d; + } + + private long cmoveLLTforL(long a, long b, long c, long d) { + return (a < b) ? c : d; + } + + private long cmoveLLEforL(long a, long b, long c, long d) { + return (a <= b) ? c : d; + } + + // L for F + private float cmoveLEQforF(long a, long b, float c, float d) { + return (a == b) ? c : d; + } + + private float cmoveLNEforF(long a, long b, float c, float d) { + return (a != b) ? c : d; + } + + private float cmoveLGTforF(long a, long b, float c, float d) { + return (a > b) ? c : d; + } + + private float cmoveLGEforF(long a, long b, float c, float d) { + return (a >= b) ? c : d; + } + + private float cmoveLLTforF(long a, long b, float c, float d) { + return (a < b) ? c : d; + } + + private float cmoveLLEforF(long a, long b, float c, float d) { + return (a <= b) ? c : d; + } + + // L for D + private double cmoveLEQforD(long a, long b, double c, double d) { + return (a == b) ? c : d; + } + + private double cmoveLNEforD(long a, long b, double c, double d) { + return (a != b) ? c : d; + } + + private double cmoveLGTforD(long a, long b, double c, double d) { + return (a > b) ? c : d; + } + + private double cmoveLGEforD(long a, long b, double c, double d) { + return (a >= b) ? c : d; + } + + private double cmoveLLTforD(long a, long b, double c, double d) { + return (a < b) ? c : d; + } + + private double cmoveLLEforD(long a, long b, double c, double d) { + return (a <= b) ? c : d; + } + + // Unsigned comparison: I/L + // I for I + private int cmoveUIEQforI(int a, int b, int c, int d) { + return Integer.compareUnsigned(a, b) == 0 ? c : d; + } + + private int cmoveUINEforI(int a, int b, int c, int d) { + return Integer.compareUnsigned(a, b) != 0 ? c : d; + } + + private int cmoveUIGTforI(int a, int b, int c, int d) { + return Integer.compareUnsigned(a, b) > 0 ? c : d; + } + + private int cmoveUIGEforI(int a, int b, int c, int d) { + return Integer.compareUnsigned(a, b) >= 0 ? c : d; + } + + private int cmoveUILTforI(int a, int b, int c, int d) { + return Integer.compareUnsigned(a, b) < 0 ? c : d; + } + + private int cmoveUILEforI(int a, int b, int c, int d) { + return Integer.compareUnsigned(a, b) <= 0 ? c : d; + } + + // I for L + private long cmoveUIEQforL(int a, int b, long c, long d) { + return Integer.compareUnsigned(a, b) == 0 ? c : d; + } + + private long cmoveUINEforL(int a, int b, long c, long d) { + return Integer.compareUnsigned(a, b) != 0 ? c : d; + } + + private long cmoveUIGTforL(int a, int b, long c, long d) { + return Integer.compareUnsigned(a, b) > 0 ? c : d; + } + + private long cmoveUIGEforL(int a, int b, long c, long d) { + return Integer.compareUnsigned(a, b) >= 0 ? c : d; + } + + private long cmoveUILTforL(int a, int b, long c, long d) { + return Integer.compareUnsigned(a, b) < 0 ? c : d; + } + + private long cmoveUILEforL(int a, int b, long c, long d) { + return Integer.compareUnsigned(a, b) <= 0 ? c : d; + } + + // I for F + private float cmoveUIEQforF(int a, int b, float c, float d) { + return Integer.compareUnsigned(a, b) == 0 ? c : d; + } + + private float cmoveUINEforF(int a, int b, float c, float d) { + return Integer.compareUnsigned(a, b) != 0 ? c : d; + } + + private float cmoveUIGTforF(int a, int b, float c, float d) { + return Integer.compareUnsigned(a, b) > 0 ? c : d; + } + + private float cmoveUIGEforF(int a, int b, float c, float d) { + return Integer.compareUnsigned(a, b) >= 0 ? c : d; + } + + private float cmoveUILTforF(int a, int b, float c, float d) { + return Integer.compareUnsigned(a, b) < 0 ? c : d; + } + + private float cmoveUILEforF(int a, int b, float c, float d) { + return Integer.compareUnsigned(a, b) <= 0 ? c : d; + } + + // I for D + private double cmoveUIEQforD(int a, int b, double c, double d) { + return Integer.compareUnsigned(a, b) == 0 ? c : d; + } + + private double cmoveUINEforD(int a, int b, double c, double d) { + return Integer.compareUnsigned(a, b) != 0 ? c : d; + } + + private double cmoveUIGTforD(int a, int b, double c, double d) { + return Integer.compareUnsigned(a, b) > 0 ? c : d; + } + + private double cmoveUIGEforD(int a, int b, double c, double d) { + return Integer.compareUnsigned(a, b) >= 0 ? c : d; + } + + private double cmoveUILTforD(int a, int b, double c, double d) { + return Integer.compareUnsigned(a, b) < 0 ? c : d; + } + + private double cmoveUILEforD(int a, int b, double c, double d) { + return Integer.compareUnsigned(a, b) <= 0 ? c : d; + } + + // L for I + private int cmoveULEQforI(long a, long b, int c, int d) { + return Long.compareUnsigned(a, b) == 0 ? c : d; + } + + private int cmoveULNEforI(long a, long b, int c, int d) { + return Long.compareUnsigned(a, b) != 0 ? c : d; + } + + private int cmoveULGTforI(long a, long b, int c, int d) { + return Long.compareUnsigned(a, b) > 0 ? c : d; + } + + private int cmoveULGEforI(long a, long b, int c, int d) { + return Long.compareUnsigned(a, b) >= 0 ? c : d; + } + + private int cmoveULLTforI(long a, long b, int c, int d) { + return Long.compareUnsigned(a, b) < 0 ? c : d; + } + + private int cmoveULLEforI(long a, long b, int c, int d) { + return Long.compareUnsigned(a, b) <= 0 ? c : d; + } + + // L for L + private long cmoveULEQforL(long a, long b, long c, long d) { + return Long.compareUnsigned(a, b) == 0 ? c : d; + } + + private long cmoveULNEforL(long a, long b, long c, long d) { + return Long.compareUnsigned(a, b) != 0 ? c : d; + } + + private long cmoveULGTforL(long a, long b, long c, long d) { + return Long.compareUnsigned(a, b) > 0 ? c : d; + } + + private long cmoveULGEforL(long a, long b, long c, long d) { + return Long.compareUnsigned(a, b) >= 0 ? c : d; + } + + private long cmoveULLTforL(long a, long b, long c, long d) { + return Long.compareUnsigned(a, b) < 0 ? c : d; + } + + private long cmoveULLEforL(long a, long b, long c, long d) { + return Long.compareUnsigned(a, b) <= 0 ? c : d; + } + + // L for F + private float cmoveULEQforF(long a, long b, float c, float d) { + return Long.compareUnsigned(a, b) == 0 ? c : d; + } + + private float cmoveULNEforF(long a, long b, float c, float d) { + return Long.compareUnsigned(a, b) != 0 ? c : d; + } + + private float cmoveULGTforF(long a, long b, float c, float d) { + return Long.compareUnsigned(a, b) > 0 ? c : d; + } + + private float cmoveULGEforF(long a, long b, float c, float d) { + return Long.compareUnsigned(a, b) >= 0 ? c : d; + } + + private float cmoveULLTforF(long a, long b, float c, float d) { + return Long.compareUnsigned(a, b) < 0 ? c : d; + } + + private float cmoveULLEforF(long a, long b, float c, float d) { + return Long.compareUnsigned(a, b) <= 0 ? c : d; + } + + // L for D + private double cmoveULEQforD(long a, long b, double c, double d) { + return Long.compareUnsigned(a, b) == 0 ? c : d; + } + + private double cmoveULNEforD(long a, long b, double c, double d) { + return Long.compareUnsigned(a, b) != 0 ? c : d; + } + + private double cmoveULGTforD(long a, long b, double c, double d) { + return Long.compareUnsigned(a, b) > 0 ? c : d; + } + + private double cmoveULGEforD(long a, long b, double c, double d) { + return Long.compareUnsigned(a, b) >= 0 ? c : d; + } + + private double cmoveULLTforD(long a, long b, double c, double d) { + return Long.compareUnsigned(a, b) < 0 ? c : d; + } + + private double cmoveULLEforD(long a, long b, double c, double d) { + return Long.compareUnsigned(a, b) <= 0 ? c : d; + } + + // Float comparison + private int cmoveFGTforI(float a, float b, int c, int d) { + return (a > b) ? c : d; + } + + private long cmoveFGTforL(float a, float b, long c, long d) { + return (a > b) ? c : d; + } + + private float cmoveFGTforF(float a, float b, float c, float d) { + return (a > b) ? c : d; + } + + private double cmoveFGTforD(float a, float b, double c, double d) { + return (a > b) ? c : d; + } + + private int cmoveDGTforI(double a, double b, int c, int d) { + return (a > b) ? c : d; + } + + private long cmoveDGTforL(double a, double b, long c, long d) { + return (a > b) ? c : d; + } + + private float cmoveDGTforF(double a, double b, float c, float d) { + return (a > b) ? c : d; + } + + private double cmoveDGTforD(double a, double b, double c, double d) { + return (a > b) ? c : d; + } + + // Compare 2 values, and pick one of them + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveVFGT(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] > b[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (b[i] > a[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveVFLT(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] < b[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (b[i] < a[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveVFEQ(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] == b[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveVDLE(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] <= b[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (b[i] <= a[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveVDGE(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] >= b[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (b[i] >= a[i]) ? a[i] : b[i]; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveVDNE(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] != b[i]) ? a[i] : b[i]; + } + } + + // Extensions: compare 2 values, and pick from 2 consts + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] > b[i]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] >= b[i]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] < b[i]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] <= b[i]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] == b[i]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] != b[i]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; + c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; + c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; + c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFXXforFConstH2(float[] a, float[] b, float[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; + c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] > b[i]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] >= b[i]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] < b[i]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] <= b[i]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] == b[i]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i++) { + c[i] = (a[i] != b[i]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDLTforDConstH2(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; + c[i+1] = (a[i+1] < b[i+1]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDLEforDConstH2(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; + c[i+1] = (a[i+1] <= b[i+1]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDYYforDConstH2(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; + c[i+1] = (a[i+1] < b[i+1]) ? 0.1 : -0.1; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDXXforDConstH2(double[] a, double[] b, double[] c) { + for (int i = 0; i < a.length; i+=2) { + c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; + c[i+1] = (a[i+1] <= b[i+1]) ? 0.1 : -0.1; + } + } + + // Extension: Compare 2 ILFD values, and pick from 2 ILFD values + // Note: + // To guarantee that CMove is introduced, I need to perform the loads before the branch. To ensure they + // do not float down into the branches, I compute a value, and store it to r2 (same as r, except that the + // compilation does not know that). + // So far, CMoveI/L is not guaranteed to be generated, so @IR not verify CMOVE_I/L. + // + // Signed comparison: I/L + // I fo I + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // I fo L + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // I fo F + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // I fo D + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // L fo I + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) + private static void testCMoveLEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // L fo L + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // L fo F + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // L fo D + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] >= b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] < b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) + private static void testCMoveLLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] <= b[i]) ? cc : dd; + } + } + + // Unsigned comparison: I/L + // I fo I + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + // I fo L + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + // I fo F + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + // I fo D + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) + private static void testCMoveUILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + // L fo I + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + // L fo L + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + // L fo F + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + // L fo D + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) + private static void testCMoveULLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGTforI(float[] a, float[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGTforL(float[] a, float[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDGTforI(double[] a, double[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) + private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b[i]) ? cc : dd; + } + } + + // Use some constants in the comparison + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < b.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a > b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) + private static void testCMoveFGTforFCmpCon2(float[] a, float b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] > b) ? cc : dd; + } + } + + // A case that is currently not supported and is not expected to vectorize + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + private static void testCMoveVDUnsupported() { + double[] doublec = new double[SIZE]; + int seed = 1001; + for (int i = 0; i < doublec.length; i++) { + doublec[i] = (i % 2 == 0) ? seed + i : seed - i; + } + } + + @Warmup(0) + @Run(test = {"testCMoveVFGT", "testCMoveVFLT","testCMoveVDLE", "testCMoveVDGE", "testCMoveVFEQ", "testCMoveVDNE", + "testCMoveVFGTSwap", "testCMoveVFLTSwap","testCMoveVDLESwap", "testCMoveVDGESwap", + "testCMoveFGTforFConst", "testCMoveFGEforFConst", "testCMoveFLTforFConst", + "testCMoveFLEforFConst", "testCMoveFEQforFConst", "testCMoveFNEQforFConst", + "testCMoveDGTforDConst", "testCMoveDGEforDConst", "testCMoveDLTforDConst", + "testCMoveDLEforDConst", "testCMoveDEQforDConst", "testCMoveDNEQforDConst", + "testCMoveFLTforFConstH2", "testCMoveFLEforFConstH2", + "testCMoveFYYforFConstH2", "testCMoveFXXforFConstH2", + "testCMoveDLTforDConstH2", "testCMoveDLEforDConstH2", + "testCMoveDYYforDConstH2", "testCMoveDXXforDConstH2"}) + private void testCMove_runner() { + float[] floata = new float[SIZE]; + float[] floatb = new float[SIZE]; + float[] floatc = new float[SIZE]; + double[] doublea = new double[SIZE]; + double[] doubleb = new double[SIZE]; + double[] doublec = new double[SIZE]; + + init(floata); + init(floatb); + init(doublea); + init(doubleb); + + testCMoveVFGT(floata, floatb, floatc); + testCMoveVDLE(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFloatGT(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDoubleLE(doublea[i], doubleb[i])); + } + + testCMoveVFLT(floata, floatb, floatc); + testCMoveVDGE(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFloatLT(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDoubleGE(doublea[i], doubleb[i])); + } + + // Ensure we frequently have equals + for (int i = 0; i < SIZE; i++) { + if (i % 3 == 0) { + floatb[i] = floata[i]; + doubleb[i] = doublea[i]; + } + } + + testCMoveVFEQ(floata, floatb, floatc); + testCMoveVDNE(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFloatEQ(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDoubleNE(doublea[i], doubleb[i])); + } + + testCMoveVFGTSwap(floata, floatb, floatc); + testCMoveVDLESwap(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFloatGTSwap(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDoubleLESwap(doublea[i], doubleb[i])); + } + + testCMoveVFLTSwap(floata, floatb, floatc); + testCMoveVDGESwap(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFloatLTSwap(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDoubleGESwap(doublea[i], doubleb[i])); + } + + // Extensions: compare 2 values, and pick from 2 consts + testCMoveFGTforFConst(floata, floatb, floatc); + testCMoveDGTforDConst(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFGTforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDGTforDConst(doublea[i], doubleb[i])); + } + + testCMoveFGEforFConst(floata, floatb, floatc); + testCMoveDGEforDConst(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFGEforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDGEforDConst(doublea[i], doubleb[i])); + } + + testCMoveFLTforFConst(floata, floatb, floatc); + testCMoveDLTforDConst(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFLTforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDLTforDConst(doublea[i], doubleb[i])); + } + + testCMoveFLEforFConst(floata, floatb, floatc); + testCMoveDLEforDConst(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFLEforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDLEforDConst(doublea[i], doubleb[i])); + } + + testCMoveFEQforFConst(floata, floatb, floatc); + testCMoveDEQforDConst(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFEQforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDEQforDConst(doublea[i], doubleb[i])); + } + + testCMoveFNEQforFConst(floata, floatb, floatc); + testCMoveDNEQforDConst(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFNEQforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDNEQforDConst(doublea[i], doubleb[i])); + } + + // Hand-unrolled (H2) examples: + testCMoveFLTforFConstH2(floata, floatb, floatc); + testCMoveDLTforDConstH2(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFLTforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDLTforDConst(doublea[i], doubleb[i])); + } + + testCMoveFLEforFConstH2(floata, floatb, floatc); + testCMoveDLEforDConstH2(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(floatc[i], cmoveFLEforFConst(floata[i], floatb[i])); + Asserts.assertEquals(doublec[i], cmoveDLEforDConst(doublea[i], doubleb[i])); + } + + testCMoveFYYforFConstH2(floata, floatb, floatc); + testCMoveDYYforDConstH2(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i+=2) { + Asserts.assertEquals(floatc[i+0], cmoveFLEforFConst(floata[i+0], floatb[i+0])); + Asserts.assertEquals(doublec[i+0], cmoveDLEforDConst(doublea[i+0], doubleb[i+0])); + Asserts.assertEquals(floatc[i+1], cmoveFLTforFConst(floata[i+1], floatb[i+1])); + Asserts.assertEquals(doublec[i+1], cmoveDLTforDConst(doublea[i+1], doubleb[i+1])); + } + + testCMoveFXXforFConstH2(floata, floatb, floatc); + testCMoveDXXforDConstH2(doublea, doubleb, doublec); + for (int i = 0; i < SIZE; i+=2) { + Asserts.assertEquals(floatc[i+0], cmoveFLTforFConst(floata[i+0], floatb[i+0])); + Asserts.assertEquals(doublec[i+0], cmoveDLTforDConst(doublea[i+0], doubleb[i+0])); + Asserts.assertEquals(floatc[i+1], cmoveFLEforFConst(floata[i+1], floatb[i+1])); + Asserts.assertEquals(doublec[i+1], cmoveDLEforDConst(doublea[i+1], doubleb[i+1])); + } + } + + @Warmup(0) + @Run(test = {// Signed + // I for I + "testCMoveIEQforI", + "testCMoveINEforI", + "testCMoveIGTforI", + "testCMoveIGEforI", + "testCMoveILTforI", + "testCMoveILEforI", + // I for L + "testCMoveIEQforL", + "testCMoveINEforL", + "testCMoveIGTforL", + "testCMoveIGEforL", + "testCMoveILTforL", + "testCMoveILEforL", + // I for F + "testCMoveIEQforF", + "testCMoveINEforF", + "testCMoveIGTforF", + "testCMoveIGEforF", + "testCMoveILTforF", + "testCMoveILEforF", + // I for D + "testCMoveIEQforD", + "testCMoveINEforD", + "testCMoveIGTforD", + "testCMoveIGEforD", + "testCMoveILTforD", + "testCMoveILEforD", + // L for I + "testCMoveLEQforI", + "testCMoveLNEforI", + "testCMoveLGTforI", + "testCMoveLGEforI", + "testCMoveLLTforI", + "testCMoveLLEforI", + // L for L + "testCMoveLEQforL", + "testCMoveLNEforL", + "testCMoveLGTforL", + "testCMoveLGEforL", + "testCMoveLLTforL", + "testCMoveLLEforL", + // L for F + "testCMoveLEQforF", + "testCMoveLNEforF", + "testCMoveLGTforF", + "testCMoveLGEforF", + "testCMoveLLTforF", + "testCMoveLLEforF", + // L for D + "testCMoveLEQforD", + "testCMoveLNEforD", + "testCMoveLGTforD", + "testCMoveLGEforD", + "testCMoveLLTforD", + "testCMoveLLEforD", + // Unsigned + // I for I + "testCMoveUIEQforI", + "testCMoveUINEforI", + "testCMoveUIGTforI", + "testCMoveUIGEforI", + "testCMoveUILTforI", + "testCMoveUILEforI", + // I for L + "testCMoveUIEQforL", + "testCMoveUINEforL", + "testCMoveUIGTforL", + "testCMoveUIGEforL", + "testCMoveUILTforL", + "testCMoveUILEforL", + // I for F + "testCMoveUIEQforF", + "testCMoveUINEforF", + "testCMoveUIGTforF", + "testCMoveUIGEforF", + "testCMoveUILTforF", + "testCMoveUILEforF", + // I for D + "testCMoveUIEQforD", + "testCMoveUINEforD", + "testCMoveUIGTforD", + "testCMoveUIGEforD", + "testCMoveUILTforD", + "testCMoveUILEforD", + // L for I + "testCMoveULEQforI", + "testCMoveULNEforI", + "testCMoveULGTforI", + "testCMoveULGEforI", + "testCMoveULLTforI", + "testCMoveULLEforI", + // L for L + "testCMoveULEQforL", + "testCMoveULNEforL", + "testCMoveULGTforL", + "testCMoveULGEforL", + "testCMoveULLTforL", + "testCMoveULLEforL", + // L for F + "testCMoveULEQforF", + "testCMoveULNEforF", + "testCMoveULGTforF", + "testCMoveULGEforF", + "testCMoveULLTforF", + "testCMoveULLEforF", + // L for D + "testCMoveULEQforD", + "testCMoveULNEforD", + "testCMoveULGTforD", + "testCMoveULGEforD", + "testCMoveULLTforD", + "testCMoveULLEforD", + // Float + "testCMoveFGTforI", + "testCMoveFGTforL", + "testCMoveFGTforF", + "testCMoveFGTforD", + "testCMoveDGTforI", + "testCMoveDGTforL", + "testCMoveDGTforF", + "testCMoveDGTforD", + "testCMoveFGTforFCmpCon1", + "testCMoveFGTforFCmpCon2"}) + private void testCMove_runner_two() { + int[] aI = new int[SIZE]; + int[] bI = new int[SIZE]; + int[] cI = new int[SIZE]; + int[] dI = new int[SIZE]; + int[] rI = new int[SIZE]; + long[] aL = new long[SIZE]; + long[] bL = new long[SIZE]; + long[] cL = new long[SIZE]; + long[] dL = new long[SIZE]; + long[] rL = new long[SIZE]; + float[] aF = new float[SIZE]; + float[] bF = new float[SIZE]; + float[] cF = new float[SIZE]; + float[] dF = new float[SIZE]; + float[] rF = new float[SIZE]; + double[] aD = new double[SIZE]; + double[] bD = new double[SIZE]; + double[] cD = new double[SIZE]; + double[] dD = new double[SIZE]; + double[] rD = new double[SIZE]; + + init(aI); + init(bI); + init(cI); + init(dI); + init(aL); + init(bL); + init(cL); + init(dL); + init(aF); + init(bF); + init(cF); + init(dF); + init(aD); + init(bD); + init(cD); + init(dD); + + // Signed + // I for I + testCMoveIEQforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveIEQforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveINEforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveINEforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveIGTforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveIGTforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveIGEforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveIGEforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveILTforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveILTforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveILEforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveILEforI(aI[i], bI[i], cI[i], dI[i])); + } + + // I for L + testCMoveIEQforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveIEQforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveINEforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveINEforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveIGTforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveIGTforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveIGEforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveIGEforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveILTforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveILTforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveILEforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveILEforL(aI[i], bI[i], cL[i], dL[i])); + } + + // I for F + testCMoveIEQforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveIEQforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveINEforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveINEforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveIGTforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveIGTforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveIGEforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveIGEforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveILTforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveILTforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveILEforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveILEforF(aI[i], bI[i], cF[i], dF[i])); + } + + // I for D + boolean passed = true; + testCMoveIEQforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveIEQforD(aI[i], bI[i], cD[i], dD[i])); + } + Asserts.assertEquals(passed, true); + + testCMoveINEforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveINEforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveIGTforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveIGTforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveIGEforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveIGEforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveILTforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveILTforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveILEforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveILEforD(aI[i], bI[i], cD[i], dD[i])); + } + + // L for I + testCMoveLEQforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveLEQforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveLNEforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveLNEforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveLGTforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveLGTforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveLGEforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveLGEforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveLLTforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveLLTforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveLLEforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveLLEforI(aL[i], bL[i], cI[i], dI[i])); + } + + // L for L + testCMoveLEQforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveLEQforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveLNEforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveLNEforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveLGTforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveLGTforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveLGEforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveLGEforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveLLTforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveLLTforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveLLEforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveLLEforL(aL[i], bL[i], cL[i], dL[i])); + } + + // L for F + testCMoveLEQforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveLEQforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveLNEforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveLNEforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveLGTforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveLGTforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveLGEforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveLGEforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveLLTforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveLLTforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveLLEforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveLLEforF(aL[i], bL[i], cF[i], dF[i])); + } + + // L for D + testCMoveLEQforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveLEQforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveLNEforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveLNEforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveLGTforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveLGTforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveLGEforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveLGEforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveLLTforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveLLTforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveLLEforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveLLEforD(aL[i], bL[i], cD[i], dD[i])); + } + + // Unsigned + // I for I + testCMoveUIEQforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveUIEQforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveUINEforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveUINEforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveUIGTforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveUIGTforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveUIGEforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveUIGEforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveUILTforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveUILTforI(aI[i], bI[i], cI[i], dI[i])); + } + + testCMoveUILEforI(aI, bI, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveUILEforI(aI[i], bI[i], cI[i], dI[i])); + } + + // I for L + testCMoveUIEQforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveUIEQforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveUINEforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveUINEforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveUIGTforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveUIGTforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveUIGEforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveUIGEforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveUILTforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveUILTforL(aI[i], bI[i], cL[i], dL[i])); + } + + testCMoveUILEforL(aI, bI, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveUILEforL(aI[i], bI[i], cL[i], dL[i])); + } + + // I for F + testCMoveUIEQforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveUIEQforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveUINEforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveUINEforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveUIGTforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveUIGTforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveUIGEforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveUIGEforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveUILTforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveUILTforF(aI[i], bI[i], cF[i], dF[i])); + } + + testCMoveUILEforF(aI, bI, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveUILEforF(aI[i], bI[i], cF[i], dF[i])); + } + + // I for D + testCMoveUIEQforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveUIEQforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveUINEforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveUINEforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveUIGTforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveUIGTforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveUIGEforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveUIGEforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveUILTforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveUILTforD(aI[i], bI[i], cD[i], dD[i])); + } + + testCMoveUILEforD(aI, bI, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveUILEforD(aI[i], bI[i], cD[i], dD[i])); + } + + // L for I + testCMoveULEQforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveULEQforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveULNEforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveULNEforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveULGTforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveULGTforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveULGEforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveULGEforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveULLTforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveULLTforI(aL[i], bL[i], cI[i], dI[i])); + } + + testCMoveULLEforI(aL, bL, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveULLEforI(aL[i], bL[i], cI[i], dI[i])); + } + + // L for L + testCMoveULEQforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveULEQforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveULNEforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveULNEforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveULGTforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveULGTforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveULGEforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveULGEforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveULLTforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveULLTforL(aL[i], bL[i], cL[i], dL[i])); + } + + testCMoveULLEforL(aL, bL, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveULLEforL(aL[i], bL[i], cL[i], dL[i])); + } + + // L for F + testCMoveULEQforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveULEQforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveULNEforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveULNEforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveULGTforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveULGTforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveULGEforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveULGEforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveULLTforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveULLTforF(aL[i], bL[i], cF[i], dF[i])); + } + + testCMoveULLEforF(aL, bL, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveULLEforF(aL[i], bL[i], cF[i], dF[i])); + } + + // L for D + testCMoveULEQforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveULEQforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveULNEforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveULNEforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveULGTforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveULGTforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveULGEforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveULGEforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveULLTforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveULLTforD(aL[i], bL[i], cD[i], dD[i])); + } + + testCMoveULLEforD(aL, bL, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveULLEforD(aL[i], bL[i], cD[i], dD[i])); + } + + // Float + testCMoveFGTforI(aF, bF, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveFGTforI(aF[i], bF[i], cI[i], dI[i])); + } + + testCMoveFGTforL(aF, bF, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveFGTforL(aF[i], bF[i], cL[i], dL[i])); + } + + testCMoveFGTforF(aF, bF, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveFGTforF(aF[i], bF[i], cF[i], dF[i])); + } + + testCMoveFGTforD(aF, bF, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveFGTforD(aF[i], bF[i], cD[i], dD[i])); + } + + testCMoveDGTforI(aD, bD, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveDGTforI(aD[i], bD[i], cI[i], dI[i])); + } + + testCMoveDGTforL(aD, bD, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveDGTforL(aD[i], bD[i], cL[i], dL[i])); + } + + testCMoveDGTforF(aD, bD, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveDGTforF(aD[i], bD[i], cF[i], dF[i])); + } + + testCMoveDGTforD(aD, bD, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveDGTforD(aD[i], bD[i], cD[i], dD[i])); + } + + // Use some constants/invariants in the comparison + testCMoveFGTforFCmpCon1(aF[0], bF, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveFGTforF(aF[0], bF[i], cF[i], dF[i])); + } + + testCMoveFGTforFCmpCon2(aF, bF[0], cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveFGTforF(aF[i], bF[0], cF[i], dF[i])); + } + } + + private static void init(int[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = RANDOM.nextInt(); + } + } + + private static void init(long[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = RANDOM.nextLong(); + } + } + + private static void init(float[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = switch(RANDOM.nextInt() % 20) { + case 0 -> Float.NaN; + case 1 -> 0; + case 2 -> 1; + case 3 -> Float.POSITIVE_INFINITY; + case 4 -> Float.NEGATIVE_INFINITY; + case 5 -> Float.MAX_VALUE; + case 6 -> Float.MIN_VALUE; + case 7, 8, 9 -> RANDOM.nextFloat(); + default -> Float.intBitsToFloat(RANDOM.nextInt()); + }; + } + } + + private static void init(double[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = switch(RANDOM.nextInt() % 20) { + case 0 -> Double.NaN; + case 1 -> 0; + case 2 -> 1; + case 3 -> Double.POSITIVE_INFINITY; + case 4 -> Double.NEGATIVE_INFINITY; + case 5 -> Double.MAX_VALUE; + case 6 -> Double.MIN_VALUE; + case 7, 8, 9 -> RANDOM.nextDouble(); + default -> Double.longBitsToDouble(RANDOM.nextLong()); + }; + } + } +} diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java index 72458494db1c6..bf08688cf4219 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java @@ -1,6 +1,7 @@ /* - * Copyright (c) 2022, Arm Limited. All rights reserved. - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Arm Limited. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -966,6 +967,7 @@ private static void testCMoveDXXforDConstH2(double[] a, double[] b, double[] c) // do not float down into the branches, I compute a value, and store it to r2 (same as r, except that the // compilation does not know that). // So far, vectorization only works for CMoveF/D, with same data-width comparison (F/I for F, D/L for D). + // // Signed comparison: I/L // I fo I @Test diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java index 80429ad868aaf..5bfc6495db8ae 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java @@ -545,11 +545,36 @@ public class IRNode { trapNodes(CLASS_CHECK_TRAP, "class_check"); } + public static final String CMOVE_F = PREFIX + "CMOVE_F" + POSTFIX; + static { + beforeMatchingNameRegex(CMOVE_F, "CMoveF"); + } + + public static final String CMOVE_D = PREFIX + "CMOVE_D" + POSTFIX; + static { + beforeMatchingNameRegex(CMOVE_D, "CMoveD"); + } + public static final String CMOVE_I = PREFIX + "CMOVE_I" + POSTFIX; static { beforeMatchingNameRegex(CMOVE_I, "CMoveI"); } + public static final String CMOVE_L = PREFIX + "CMOVE_L" + POSTFIX; + static { + beforeMatchingNameRegex(CMOVE_L, "CMoveL"); + } + + public static final String CMP_F = PREFIX + "CMP_F" + POSTFIX; + static { + beforeMatchingNameRegex(CMP_F, "CmpF"); + } + + public static final String CMP_D = PREFIX + "CMP_D" + POSTFIX; + static { + beforeMatchingNameRegex(CMP_D, "CmpD"); + } + public static final String CMP_I = PREFIX + "CMP_I" + POSTFIX; static { beforeMatchingNameRegex(CMP_I, "CmpI"); From 767d863a4c09490bfb0fe4b405fa737a6fde2972 Mon Sep 17 00:00:00 2001 From: hamlin Date: Fri, 7 Nov 2025 11:54:43 +0000 Subject: [PATCH 14/32] add jmh tests --- .../bench/java/lang/ClassComparison.java | 45 ++- .../openjdk/bench/java/lang/FPComparison.java | 176 +++++++++-- .../bench/java/lang/IntegerComparison.java | 290 +++++++++++++++++- .../bench/java/lang/LongComparison.java | 289 ++++++++++++++++- .../bench/java/lang/PointerComparison.java | 45 ++- 5 files changed, 773 insertions(+), 72 deletions(-) diff --git a/test/micro/org/openjdk/bench/java/lang/ClassComparison.java b/test/micro/org/openjdk/bench/java/lang/ClassComparison.java index 2a768f243e2bf..15e631bb7fce5 100644 --- a/test/micro/org/openjdk/bench/java/lang/ClassComparison.java +++ b/test/micro/org/openjdk/bench/java/lang/ClassComparison.java @@ -44,12 +44,8 @@ public class ClassComparison { Class[] c2; int[] res; long[] resLong; - Object[] resObject; - Object ro1; - Object ro2; - Object[] resClass; - Class rc1; - Class rc2; + float[] resFloat; + double[] resDouble; @Setup public void setup() { @@ -58,12 +54,8 @@ public void setup() { c2 = new Class[INVOCATIONS]; res = new int[INVOCATIONS]; resLong = new long[INVOCATIONS]; - resObject = new Object[INVOCATIONS]; - ro1 = new Object(); - ro2 = new Object(); - resClass = new Class[INVOCATIONS]; - rc1 = Float.class; - rc2 = Double.class; + resFloat = new float[INVOCATIONS]; + resDouble = new double[INVOCATIONS]; for (int i = 0; i < INVOCATIONS; i++) { c1[i] = random.nextBoolean() ? Float.class : Double.class; } @@ -86,6 +78,7 @@ public void notEqualClass() { } } + @Benchmark public void equalClassResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (c1[i] == c2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -98,4 +91,32 @@ public void notEqualClassResLong() { resLong[i] = (c1[i] != c2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; } } + + @Benchmark + public void equalClassResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (c1[i] == c2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void notEqualClassResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (c1[i] != c2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void equalClassResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (c1[i] == c2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void notEqualClassResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (c1[i] != c2[i]) ? 0.1 : 0.2; + } + } } diff --git a/test/micro/org/openjdk/bench/java/lang/FPComparison.java b/test/micro/org/openjdk/bench/java/lang/FPComparison.java index 8074ada325797..18b2b79c7bde4 100644 --- a/test/micro/org/openjdk/bench/java/lang/FPComparison.java +++ b/test/micro/org/openjdk/bench/java/lang/FPComparison.java @@ -37,34 +37,18 @@ public class FPComparison { static final int INVOCATIONS = 1024; - float[] f1; - double[] d1; - float[] f2; - double[] d2; - int[] res; - long[] resLong; - Object[] resObject; - Object ro1; - Object ro2; - Class[] resClass; - Class rc1; - Class rc2; + static final float[] f1 = new float[INVOCATIONS]; + static final double[] d1 = new double[INVOCATIONS]; + static final float[] f2 = new float[INVOCATIONS]; + static final double[] d2 = new double[INVOCATIONS]; + static final int[] res = new int[INVOCATIONS];; + static final long[] resLong = new long[INVOCATIONS]; + static final float[] resFloat = new float[INVOCATIONS]; + static final double[] resDouble = new double[INVOCATIONS]; @Setup public void setup() { var random = RandomGenerator.getDefault(); - f1 = new float[INVOCATIONS]; - d1 = new double[INVOCATIONS]; - f2 = new float[INVOCATIONS]; - d2 = new double[INVOCATIONS]; - res = new int[INVOCATIONS]; - resLong = new long[INVOCATIONS]; - resObject = new Object[INVOCATIONS]; - ro1 = new Object(); - ro2 = new Object(); - resClass = new Class[INVOCATIONS]; - rc1 = Float.class; - rc2 = Double.class; for (int i = 0; i < INVOCATIONS; i++) { int type = random.nextInt(5); if (type == 1) { @@ -274,4 +258,148 @@ public void greaterEqualDoubleResLong() { resLong[i] = (d1[i] >= d2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; } } + + // --------- result: float --------- + + @Benchmark + public void equalFloatResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (f1[i] == f2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void equalDoubleResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (d1[i] == d2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessFloatResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (f1[i] < f2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessDoubleResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (d1[i] < d2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessEqualFloatResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (f1[i] <= f2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessEqualDoubleResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (d1[i] <= d2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterFloatResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (f1[i] > f2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterDoubleResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (d1[i] > d2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterEqualFloatResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (f1[i] >= f2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterEqualDoubleResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (d1[i] >= d2[i]) ? 0.1f : 0.2f; + } + } + + // --------- result: double --------- + + @Benchmark + public void equalFloatResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (f1[i] == f2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void equalDoubleResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (d1[i] == d2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessFloatResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (f1[i] < f2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessDoubleResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (d1[i] < d2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessEqualFloatResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (f1[i] <= f2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessEqualDoubleResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (d1[i] <= d2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterFloatResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (f1[i] > f2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterDoubleResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (d1[i] > d2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterEqualFloatResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (f1[i] >= f2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterEqualDoubleResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (d1[i] >= d2[i]) ? 0.1 : 0.2; + } + } } diff --git a/test/micro/org/openjdk/bench/java/lang/IntegerComparison.java b/test/micro/org/openjdk/bench/java/lang/IntegerComparison.java index 1853be8497d87..832d398fc3d27 100644 --- a/test/micro/org/openjdk/bench/java/lang/IntegerComparison.java +++ b/test/micro/org/openjdk/bench/java/lang/IntegerComparison.java @@ -42,12 +42,8 @@ public class IntegerComparison { int[] i2; int[] res; long[] resLong; - Object[] resObject; - Object ro1; - Object ro2; - Object[] resClass; - Class rc1; - Class rc2; + float[] resFloat; + double[] resDouble; @Setup public void setup() { @@ -56,18 +52,17 @@ public void setup() { i2 = new int[INVOCATIONS]; res = new int[INVOCATIONS]; resLong = new long[INVOCATIONS]; - resObject = new Object[INVOCATIONS]; - ro1 = new Object(); - ro2 = new Object(); - resClass = new Class[INVOCATIONS]; - rc1 = Float.class; - rc2 = Double.class; + resFloat = new float[INVOCATIONS]; + resDouble = new double[INVOCATIONS]; for (int i = 0; i < INVOCATIONS; i++) { i1[i] = random.nextInt(INVOCATIONS); i2[i] = random.nextInt(INVOCATIONS); } } + // --------- result: int --------- + // Signed comparison + @Benchmark public void equalInteger() { for (int i = 0; i < INVOCATIONS; i++) { @@ -110,8 +105,55 @@ public void greaterEqualInteger() { } } + // Unsigned comparison + + @Benchmark + public void equalIntegerUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Integer.compareUnsigned(i1[i], i2[i]) == 0 ? 1 : 2; + } + } + + @Benchmark + public void notEqualIntegerUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Integer.compareUnsigned(i1[i], i2[i]) != 0 ? 1 : 2; + } + } + + @Benchmark + public void lessIntegerUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Integer.compareUnsigned(i1[i], i2[i]) < 0 ? 1 : 2; + } + } + + @Benchmark + public void lessEqualIntegerUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Integer.compareUnsigned(i1[i], i2[i]) <= 0 ? 1 : 2; + } + } + + @Benchmark + public void greaterIntegerUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Integer.compareUnsigned(i1[i], i2[i]) > 0 ? 1 : 2; + } + } + + @Benchmark + public void greaterEqualIntegerUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Integer.compareUnsigned(i1[i], i2[i]) >= 0 ? 1 : 2; + } + } + + // --------- result: long --------- + // Signed comparison + @Benchmark public void equalIntegerResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (i1[i] == i2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -125,6 +167,7 @@ public void notEqualIntegerResLong() { } } + @Benchmark public void lessIntegerResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (i1[i] < i2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -138,6 +181,7 @@ public void lessEqualIntegerResLong() { } } + @Benchmark public void greaterIntegerResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (i1[i] > i2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -150,4 +194,226 @@ public void greaterEqualIntegerResLong() { resLong[i] = (i1[i] >= i2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; } } + + // Unsigned comparison + + @Benchmark + public void equalIntegerUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Integer.compareUnsigned(i1[i], i2[i]) == 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void notEqualIntegerUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Integer.compareUnsigned(i1[i], i2[i]) != 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void lessIntegerUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Integer.compareUnsigned(i1[i], i2[i]) < 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void lessEqualIntegerUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Integer.compareUnsigned(i1[i], i2[i]) <= 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void greaterIntegerUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Integer.compareUnsigned(i1[i], i2[i]) > 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void greaterEqualIntegerUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Integer.compareUnsigned(i1[i], i2[i]) >= 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + // --------- result: float --------- + // Signed comparison + + @Benchmark + public void equalIntegerResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (i1[i] == i2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void notEqualIntegerResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (i1[i] != i2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessIntegerResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (i1[i] < i2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessEqualIntegerResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (i1[i] <= i2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterIntegerResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (i1[i] > i2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterEqualIntegerResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (i1[i] >= i2[i]) ? 0.1f : 0.2f; + } + } + + // Unsigned comparison + + @Benchmark + public void equalIntegerUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Integer.compareUnsigned(i1[i], i2[i]) == 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void notEqualIntegerUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Integer.compareUnsigned(i1[i], i2[i]) != 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessIntegerUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Integer.compareUnsigned(i1[i], i2[i]) < 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessEqualIntegerUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Integer.compareUnsigned(i1[i], i2[i]) <= 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterIntegerUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Integer.compareUnsigned(i1[i], i2[i]) > 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterEqualIntegerUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Integer.compareUnsigned(i1[i], i2[i]) >= 0 ? 0.1f : 0.2f; + } + } + + // --------- result: double --------- + // Signed comparison + + @Benchmark + public void equalIntegerResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (i1[i] == i2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void notEqualIntegerResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (i1[i] != i2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessIntegerResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (i1[i] < i2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessEqualIntegerResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (i1[i] <= i2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterIntegerResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (i1[i] > i2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterEqualIntegerResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (i1[i] >= i2[i]) ? 0.1 : 0.2; + } + } + + // Unsigned comparison + + @Benchmark + public void equalIntegerUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Integer.compareUnsigned(i1[i], i2[i]) == 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void notEqualIntegerUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Integer.compareUnsigned(i1[i], i2[i]) != 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessIntegerUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Integer.compareUnsigned(i1[i], i2[i]) < 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessEqualIntegerUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Integer.compareUnsigned(i1[i], i2[i]) <= 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterIntegerUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Integer.compareUnsigned(i1[i], i2[i]) > 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterEqualIntegerUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Integer.compareUnsigned(i1[i], i2[i]) >= 0 ? 0.1 : 0.2; + } + } } diff --git a/test/micro/org/openjdk/bench/java/lang/LongComparison.java b/test/micro/org/openjdk/bench/java/lang/LongComparison.java index bed5ee245b2a7..a7317244c6f61 100644 --- a/test/micro/org/openjdk/bench/java/lang/LongComparison.java +++ b/test/micro/org/openjdk/bench/java/lang/LongComparison.java @@ -41,12 +41,8 @@ public class LongComparison { long[] l2; int[] res; long[] resLong; - Object[] resObject; - Object ro1; - Object ro2; - Object[] resClass; - Class rc1; - Class rc2; + float[] resFloat; + double[] resDouble; @Setup public void setup() { @@ -55,18 +51,17 @@ public void setup() { l2 = new long[INVOCATIONS]; res = new int[INVOCATIONS]; resLong = new long[INVOCATIONS]; - resObject = new Object[INVOCATIONS]; - ro1 = new Object(); - ro2 = new Object(); - resClass = new Class[INVOCATIONS]; - rc1 = Float.class; - rc2 = Double.class; + resFloat = new float[INVOCATIONS]; + resDouble = new double[INVOCATIONS]; for (int i = 0; i < INVOCATIONS; i++) { l1[i] = random.nextLong(INVOCATIONS); l2[i] = random.nextLong(INVOCATIONS); } } + // --------- result: int --------- + // Signed comparison + @Benchmark public void equalLong() { for (int i = 0; i < INVOCATIONS; i++) { @@ -109,8 +104,54 @@ public void greaterEqualLong() { } } + // Unsigned comparison + + @Benchmark + public void equalLongUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Long.compareUnsigned(l1[i], l2[i]) == 0 ? 1 : 2; + } + } + + @Benchmark + public void notEqualLongUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Long.compareUnsigned(l1[i], l2[i]) != 0 ? 1 : 2; + } + } + + @Benchmark + public void lessLongUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Long.compareUnsigned(l1[i], l2[i]) < 0 ? 1 : 2; + } + } + + @Benchmark + public void lessEqualLongUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Long.compareUnsigned(l1[i], l2[i]) <= 0 ? 1 : 2; + } + } + + @Benchmark + public void greaterLongUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Long.compareUnsigned(l1[i], l2[i]) > 0 ? 1 : 2; + } + } + + @Benchmark + public void greaterEqualLongUnsigned() { + for (int i = 0; i < INVOCATIONS; i++) { + res[i] = Long.compareUnsigned(l1[i], l2[i]) >= 0 ? 1 : 2; + } + } + // --------- result: long --------- + // Signed comparison + @Benchmark public void equalLongResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (l1[i] == l2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -124,6 +165,7 @@ public void notEqualLongResLong() { } } + @Benchmark public void lessLongResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (l1[i] < l2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -137,6 +179,7 @@ public void lessEqualLongResLong() { } } + @Benchmark public void greaterLongResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (l1[i] > l2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -149,4 +192,226 @@ public void greaterEqualLongResLong() { resLong[i] = (l1[i] >= l2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; } } + + // Unsigned comparison + + @Benchmark + public void equalLongUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Long.compareUnsigned(l1[i], l2[i]) == 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void notEqualLongUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Long.compareUnsigned(l1[i], l2[i]) != 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void lessLongUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Long.compareUnsigned(l1[i], l2[i]) < 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void lessEqualLongUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Long.compareUnsigned(l1[i], l2[i]) <= 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void greaterLongUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Long.compareUnsigned(l1[i], l2[i]) > 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + @Benchmark + public void greaterEqualLongUnsignedResLong() { + for (int i = 0; i < INVOCATIONS; i++) { + resLong[i] = Long.compareUnsigned(l1[i], l2[i]) >= 0 ? Long.MAX_VALUE : Long.MIN_VALUE; + } + } + + // --------- result: float --------- + // Signed comparison + + @Benchmark + public void equalLongResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (l1[i] == l2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void notEqualLongResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (l1[i] != l2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessLongResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (l1[i] < l2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessEqualLongResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (l1[i] <= l2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterLongResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (l1[i] > l2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterEqualLongResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (l1[i] >= l2[i]) ? 0.1f : 0.2f; + } + } + + // Unsigned comparison + + @Benchmark + public void equalLongUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Long.compareUnsigned(l1[i], l2[i]) == 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void notEqualLongUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Long.compareUnsigned(l1[i], l2[i]) != 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessLongUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Long.compareUnsigned(l1[i], l2[i]) < 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void lessEqualLongUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Long.compareUnsigned(l1[i], l2[i]) <= 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterLongUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Long.compareUnsigned(l1[i], l2[i]) > 0 ? 0.1f : 0.2f; + } + } + + @Benchmark + public void greaterEqualLongUnsignedResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = Long.compareUnsigned(l1[i], l2[i]) >= 0 ? 0.1f : 0.2f; + } + } + + // --------- result: double --------- + // Signed comparison + + @Benchmark + public void equalLongResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (l1[i] == l2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void notEqualLongResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (l1[i] != l2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessLongResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (l1[i] < l2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessEqualLongResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (l1[i] <= l2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterLongResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (l1[i] > l2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterEqualLongResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (l1[i] >= l2[i]) ? 0.1 : 0.2; + } + } + + // Unsigned comparison + + @Benchmark + public void equalLongUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Long.compareUnsigned(l1[i], l2[i]) == 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void notEqualLongUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Long.compareUnsigned(l1[i], l2[i]) != 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessLongUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Long.compareUnsigned(l1[i], l2[i]) < 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void lessEqualLongUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Long.compareUnsigned(l1[i], l2[i]) <= 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterLongUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Long.compareUnsigned(l1[i], l2[i]) > 0 ? 0.1 : 0.2; + } + } + + @Benchmark + public void greaterEqualLongUnsignedResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = Long.compareUnsigned(l1[i], l2[i]) >= 0 ? 0.1 : 0.2; + } + } } diff --git a/test/micro/org/openjdk/bench/java/lang/PointerComparison.java b/test/micro/org/openjdk/bench/java/lang/PointerComparison.java index b6bcf00861923..fc2fd95b1c00e 100644 --- a/test/micro/org/openjdk/bench/java/lang/PointerComparison.java +++ b/test/micro/org/openjdk/bench/java/lang/PointerComparison.java @@ -44,12 +44,8 @@ public class PointerComparison { Object[] o2; int[] res; long[] resLong; - Object[] resObject; - Object ro1; - Object ro2; - Object[] resClass; - Class rc1; - Class rc2; + float[] resFloat; + double[] resDouble; @Setup public void setup() { @@ -58,12 +54,8 @@ public void setup() { o2 = new Object[INVOCATIONS]; res = new int[INVOCATIONS]; resLong = new long[INVOCATIONS]; - resObject = new Object[INVOCATIONS]; - ro1 = new Object(); - ro2 = new Object(); - resClass = new Class[INVOCATIONS]; - rc1 = Float.class; - rc2 = Double.class; + resFloat = new float[INVOCATIONS]; + resDouble = new double[INVOCATIONS]; for (int i = 0; i < INVOCATIONS; i++) { o1[i] = new Object(); } @@ -86,6 +78,7 @@ public void notEqualObject() { } } + @Benchmark public void equalObjectResLong() { for (int i = 0; i < INVOCATIONS; i++) { resLong[i] = (o1[i] == o2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; @@ -98,4 +91,32 @@ public void notEqualObjectResLong() { resLong[i] = (o1[i] != o2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE; } } + + @Benchmark + public void equalObjecResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (o1[i] == o2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void notEqualObjecResFloat() { + for (int i = 0; i < INVOCATIONS; i++) { + resFloat[i] = (o1[i] != o2[i]) ? 0.1f : 0.2f; + } + } + + @Benchmark + public void equalObjecResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (o1[i] == o2[i]) ? 0.1 : 0.2; + } + } + + @Benchmark + public void notEqualObjecResDouble() { + for (int i = 0; i < INVOCATIONS; i++) { + resDouble[i] = (o1[i] != o2[i]) ? 0.1 : 0.2; + } + } } From cfbe0a655df61efa89336895dd315d6616e19e99 Mon Sep 17 00:00:00 2001 From: Hamlin Li Date: Tue, 11 Nov 2025 14:05:43 +0000 Subject: [PATCH 15/32] Update src/hotspot/share/opto/superword.cpp refactor `is_velt_basic_type_compatible_use_def` Co-authored-by: Emanuel Peter --- src/hotspot/share/opto/superword.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index dea8be591d7ac..c5d42444729eb 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2334,8 +2334,11 @@ bool SuperWord::is_velt_basic_type_compatible_use_def(Node* use, Node* def) cons // Input size of use equals output size of def if (type2aelembytes(use_bt) == type2aelembytes(def_bt)) { return true; - } else if (VectorNode::is_different_use_def_size_supported()) { - return use->is_CMove() && def->is_Bool(); + } + + // Allow CMove to have different type for comparision and moving. + if (VectorNode::is_different_use_def_size_supported() && return use->is_CMove() && def->is_Bool()) { + return true; } return false; From a89d26c47cc24bc88e99cc71761ac2afa22fa35d Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 11 Nov 2025 14:50:46 +0000 Subject: [PATCH 16/32] fix typo --- src/hotspot/share/opto/superword.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index c5d42444729eb..a90d9011c7379 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2337,7 +2337,7 @@ bool SuperWord::is_velt_basic_type_compatible_use_def(Node* use, Node* def) cons } // Allow CMove to have different type for comparision and moving. - if (VectorNode::is_different_use_def_size_supported() && return use->is_CMove() && def->is_Bool()) { + if (VectorNode::is_different_use_def_size_supported() && use->is_CMove() && def->is_Bool()) { return true; } From 0a4317212ce4964c83bbca39ba5a6808283b3486 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 19:29:14 +0000 Subject: [PATCH 17/32] clean stop --- src/hotspot/cpu/riscv/riscv.ad | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index cf8fa378346f9..8552ed5554af1 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -10488,7 +10488,6 @@ instruct cmovF_cmpI(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iReg %} ins_encode %{ - // __ stop("cmovF_cmpI"); __ enc_cmove_fp_cmp($cop$$cmpcode, as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); @@ -10507,7 +10506,6 @@ instruct cmovF_cmpU(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iReg %} ins_encode %{ - // __ stop("cmovF_cmpU"); __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); @@ -10526,7 +10524,6 @@ instruct cmovF_cmpL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iReg %} ins_encode %{ - // __ stop("cmovF_cmpL"); __ enc_cmove_fp_cmp($cop$$cmpcode, as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); @@ -10545,7 +10542,6 @@ instruct cmovF_cmpUL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iRe %} ins_encode %{ - // __ stop("cmovF_cmpUL"); __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); @@ -10564,7 +10560,6 @@ instruct cmovF_cmpF(fRegF dst, fRegF src, fRegF op1, fRegF op2, iRegI tmp1, iReg %} ins_encode %{ - // __ stop("cmovF_cmpF"); __ enc_cmove_fp_cmp_fp($cop$$cmpcode, as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), @@ -10585,7 +10580,6 @@ instruct cmovF_cmpD(fRegF dst, fRegF src, fRegD op1, fRegD op2, iRegI tmp1, iReg %} ins_encode %{ - // __ stop("cmovF_cmpD"); __ enc_cmove_fp_cmp_fp($cop$$cmpcode | C2_MacroAssembler::double_branch_mask, as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), @@ -10606,7 +10600,6 @@ instruct cmovF_cmpN(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iReg %} ins_encode %{ - // __ stop("cmovF_cmpN"); __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), @@ -10626,7 +10619,6 @@ instruct cmovF_cmpP(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iReg %} ins_encode %{ - __ stop("cmovF_cmpP"); __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), From ec132bb462b3e2bf41bad2e28c87b0c9d14096f3 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 19:55:57 +0000 Subject: [PATCH 18/32] remove Zicond code for CMoveFD --- .../cpu/riscv/c2_MacroAssembler_riscv.cpp | 32 +- .../cpu/riscv/c2_MacroAssembler_riscv.hpp | 7 +- .../cpu/riscv/macroAssembler_riscv.cpp | 306 +----------------- .../cpu/riscv/macroAssembler_riscv.hpp | 30 +- src/hotspot/cpu/riscv/riscv.ad | 68 ++-- 5 files changed, 62 insertions(+), 381 deletions(-) diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp index 120201257d3b9..74e6760a98108 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp @@ -2067,45 +2067,44 @@ void C2_MacroAssembler::enc_cmove_cmp_fp(int cmpFlag, FloatRegister op1, FloatRe } } -void C2_MacroAssembler::enc_cmove_fp_cmp(int cmpFlag, - Register op1, Register op2, Register tmp1, Register tmp2, +void C2_MacroAssembler::enc_cmove_fp_cmp(int cmpFlag, Register op1, Register op2, FloatRegister dst, FloatRegister src, bool is_single) { bool is_unsigned = (cmpFlag & unsigned_branch_mask) == unsigned_branch_mask; int op_select = cmpFlag & (~unsigned_branch_mask); switch (op_select) { case BoolTest::eq: - cmov_fp_eq(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_eq(op1, op2, dst, src, is_single); break; case BoolTest::ne: - cmov_fp_ne(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_ne(op1, op2, dst, src, is_single); break; case BoolTest::le: if (is_unsigned) { - cmov_fp_leu(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_leu(op1, op2, dst, src, is_single); } else { - cmov_fp_le(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_le(op1, op2, dst, src, is_single); } break; case BoolTest::ge: if (is_unsigned) { - cmov_fp_geu(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_geu(op1, op2, dst, src, is_single); } else { - cmov_fp_ge(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_ge(op1, op2, dst, src, is_single); } break; case BoolTest::lt: if (is_unsigned) { - cmov_fp_ltu(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_ltu(op1, op2, dst, src, is_single); } else { - cmov_fp_lt(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_lt(op1, op2, dst, src, is_single); } break; case BoolTest::gt: if (is_unsigned) { - cmov_fp_gtu(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_gtu(op1, op2, dst, src, is_single); } else { - cmov_fp_gt(op1, op2, tmp1, tmp2, dst, src, is_single); + cmov_fp_gt(op1, op2, dst, src, is_single); } break; default: @@ -2116,27 +2115,26 @@ void C2_MacroAssembler::enc_cmove_fp_cmp(int cmpFlag, void C2_MacroAssembler::enc_cmove_fp_cmp_fp(int cmpFlag, FloatRegister op1, FloatRegister op2, - Register tmp1, Register tmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single) { int op_select = cmpFlag & (~unsigned_branch_mask); switch (op_select) { case BoolTest::eq: - cmov_fp_cmp_fp_eq(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + cmov_fp_cmp_fp_eq(op1, op2, dst, src, cmp_single, cmov_single); break; case BoolTest::ne: - cmov_fp_cmp_fp_ne(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + cmov_fp_cmp_fp_ne(op1, op2, dst, src, cmp_single, cmov_single); break; case BoolTest::le: - cmov_fp_cmp_fp_le(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + cmov_fp_cmp_fp_le(op1, op2, dst, src, cmp_single, cmov_single); break; case BoolTest::ge: assert(false, "Should go to BoolTest::le case"); ShouldNotReachHere(); break; case BoolTest::lt: - cmov_fp_cmp_fp_lt(op1, op2, tmp1, tmp2, dst, src, cmp_single, cmov_single); + cmov_fp_cmp_fp_lt(op1, op2, dst, src, cmp_single, cmov_single); break; case BoolTest::gt: assert(false, "Should go to BoolTest::lt case"); diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp index cd41767196d02..fa87ceba29525 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp @@ -132,13 +132,10 @@ FloatRegister op1, FloatRegister op2, Register dst, Register src, bool is_single); - void enc_cmove_fp_cmp(int cmpFlag, - Register op1, Register op2, Register tmp1, Register tmp2, + void enc_cmove_fp_cmp(int cmpFlag, Register op1, Register op2, FloatRegister dst, FloatRegister src, bool is_single); - void enc_cmove_fp_cmp_fp(int cmpFlag, - FloatRegister op1, FloatRegister op2, - Register tmp1, Register tmp2, + void enc_cmove_fp_cmp_fp(int cmpFlag, FloatRegister op1, FloatRegister op2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 1da1ee5d5875a..f1566de44d977 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -1235,26 +1235,7 @@ void MacroAssembler::cmov_gtu(Register cmp1, Register cmp2, Register dst, Regist // ----------- cmove float/double ----------- -void MacroAssembler::cmov_fp_eq(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - xorr(t0, cmp1, cmp2); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0 , tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_eq(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; bne(cmp1, cmp2, no_set); if (is_single) { @@ -1265,26 +1246,7 @@ void MacroAssembler::cmov_fp_eq(Register cmp1, Register cmp2, Register tmpDst, R bind(no_set); } -void MacroAssembler::cmov_fp_ne(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - xorr(t0, cmp1, cmp2); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_nez(tmpDst, tmpDst, t0); - czero_eqz(t0 , tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_ne(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; beq(cmp1, cmp2, no_set); if (is_single) { @@ -1295,26 +1257,7 @@ void MacroAssembler::cmov_fp_ne(Register cmp1, Register cmp2, Register tmpDst, R bind(no_set); } -void MacroAssembler::cmov_fp_le(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - slt(t0, cmp2, cmp1); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_le(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; bgt(cmp1, cmp2, no_set); if (is_single) { @@ -1325,26 +1268,7 @@ void MacroAssembler::cmov_fp_le(Register cmp1, Register cmp2, Register tmpDst, R bind(no_set); } -void MacroAssembler::cmov_fp_leu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - sltu(t0, cmp2, cmp1); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_leu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; bgtu(cmp1, cmp2, no_set); if (is_single) { @@ -1355,26 +1279,7 @@ void MacroAssembler::cmov_fp_leu(Register cmp1, Register cmp2, Register tmpDst, bind(no_set); } -void MacroAssembler::cmov_fp_ge(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - slt(t0, cmp1, cmp2); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_ge(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; blt(cmp1, cmp2, no_set); if (is_single) { @@ -1385,26 +1290,7 @@ void MacroAssembler::cmov_fp_ge(Register cmp1, Register cmp2, Register tmpDst, R bind(no_set); } -void MacroAssembler::cmov_fp_geu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - sltu(t0, cmp1, cmp2); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_geu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; bltu(cmp1, cmp2, no_set); if (is_single) { @@ -1415,26 +1301,7 @@ void MacroAssembler::cmov_fp_geu(Register cmp1, Register cmp2, Register tmpDst, bind(no_set); } -void MacroAssembler::cmov_fp_lt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - slt(t0, cmp1, cmp2); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_nez(tmpDst, tmpDst, t0); - czero_eqz(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_lt(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; bge(cmp1, cmp2, no_set); if (is_single) { @@ -1445,26 +1312,7 @@ void MacroAssembler::cmov_fp_lt(Register cmp1, Register cmp2, Register tmpDst, R bind(no_set); } -void MacroAssembler::cmov_fp_ltu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - sltu(t0, cmp1, cmp2); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_nez(tmpDst, tmpDst, t0); - czero_eqz(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_ltu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; bgeu(cmp1, cmp2, no_set); if (is_single) { @@ -1475,26 +1323,7 @@ void MacroAssembler::cmov_fp_ltu(Register cmp1, Register cmp2, Register tmpDst, bind(no_set); } -void MacroAssembler::cmov_fp_gt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - slt(t0, cmp2, cmp1); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_nez(tmpDst, tmpDst, t0); - czero_eqz(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_gt(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; ble(cmp1, cmp2, no_set); if (is_single) { @@ -1505,26 +1334,7 @@ void MacroAssembler::cmov_fp_gt(Register cmp1, Register cmp2, Register tmpDst, R bind(no_set); } -void MacroAssembler::cmov_fp_gtu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single) { - if (UseZicond) { - sltu(t0, cmp2, cmp1); - if (is_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_nez(tmpDst, tmpDst, t0); - czero_eqz(t0, tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (is_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } +void MacroAssembler::cmov_fp_gtu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single) { Label no_set; bleu(cmp1, cmp2, no_set); if (is_single) { @@ -1700,32 +1510,8 @@ void MacroAssembler::cmov_cmp_fp_gt(FloatRegister cmp1, FloatRegister cmp2, Regi // java code : cmp1 != cmp2 ? dst : src // transformed to : CMove dst, (cmp1 eq cmp2), dst, src void MacroAssembler::cmov_fp_cmp_fp_eq(FloatRegister cmp1, FloatRegister cmp2, - Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single) { - if (UseZicond) { - if (cmp_single) { - feq_s(t0, cmp1, cmp2); - } else { - feq_d(t0, cmp1, cmp2); - } - if (cmov_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_nez(tmpDst, tmpDst, t0); - czero_eqz(t0 , tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (cmov_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } Label no_set; if (cmp_single) { // jump if cmp1 != cmp2, including the case of NaN @@ -1748,32 +1534,8 @@ void MacroAssembler::cmov_fp_cmp_fp_eq(FloatRegister cmp1, FloatRegister cmp2, // java code : cmp1 == cmp2 ? dst : src // transformed to : CMove dst, (cmp1 ne cmp2), dst, src void MacroAssembler::cmov_fp_cmp_fp_ne(FloatRegister cmp1, FloatRegister cmp2, - Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single) { - if (UseZicond) { - if (cmp_single) { - feq_s(t0, cmp1, cmp2); - } else { - feq_d(t0, cmp1, cmp2); - } - if (cmov_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0 , tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (cmov_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } Label no_set; if (cmp_single) { // jump if cmp1 == cmp2 @@ -1799,32 +1561,8 @@ void MacroAssembler::cmov_fp_cmp_fp_ne(FloatRegister cmp1, FloatRegister cmp2, // java code : cmp1 > cmp2 ? dst : src // transformed to : CMove dst, (cmp1 le cmp2), dst, src void MacroAssembler::cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, - Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single) { - if (UseZicond) { - if (cmp_single) { - flt_s(t0, cmp2, cmp1); - } else { - flt_d(t0, cmp2, cmp1); - } - if (cmov_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0 , tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (cmov_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } Label no_set; if (cmp_single) { // jump if cmp1 > cmp2 @@ -1850,32 +1588,8 @@ void MacroAssembler::cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, // java code : cmp1 >= cmp2 ? dst : src // transformed to : CMove dst, (cmp1 lt cmp2), dst, src void MacroAssembler::cmov_fp_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, - Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single) { - if (UseZicond) { - if (cmp_single) { - fle_s(t0, cmp2, cmp1); - } else { - fle_d(t0, cmp2, cmp1); - } - if (cmov_single) { - fmv_x_w(tmpDst, dst); - fmv_x_w(tmpSrc, src); - } else { - fmv_x_d(tmpDst, dst); - fmv_x_d(tmpSrc, src); - } - czero_eqz(tmpDst, tmpDst, t0); - czero_nez(t0 , tmpSrc, t0); - orr(tmpDst, tmpDst, t0); - if (cmov_single) { - fmv_w_x(dst, tmpDst); - } else { - fmv_d_x(dst, tmpDst); - } - return; - } Label no_set; if (cmp_single) { // jump if cmp1 >= cmp2 diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index b55bd161efd75..ab72a54bf15c7 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -665,21 +665,21 @@ class MacroAssembler: public Assembler { void cmov_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, Register dst, Register src, bool is_single); void cmov_cmp_fp_gt(FloatRegister cmp1, FloatRegister cmp2, Register dst, Register src, bool is_single); - void cmov_fp_eq(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_ne(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_le(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_leu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_ge(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_geu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_lt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_ltu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_gt(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - void cmov_fp_gtu(Register cmp1, Register cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool is_single); - - void cmov_fp_cmp_fp_eq(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); - void cmov_fp_cmp_fp_ne(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); - void cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); - void cmov_fp_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, Register tmpDst, Register tmpSrc, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_eq(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_ne(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_le(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_leu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_ge(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_geu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_lt(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_ltu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_gt(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + void cmov_fp_gtu(Register cmp1, Register cmp2, FloatRegister dst, FloatRegister src, bool is_single); + + void cmov_fp_cmp_fp_eq(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_ne(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); public: // We try to follow risc-v asm menomics. diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index 8552ed5554af1..94f9d227a2f3a 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -10478,9 +10478,8 @@ instruct cmovL_cmpP(iRegLNoSp dst, iRegL src, iRegP op1, iRegP op2, cmpOpU cop) %} // --------- CMoveF --------- -instruct cmovF_cmpI(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovF_cmpI(fRegF dst, fRegF src, iRegI op1, iRegI op2, cmpOp cop) %{ match(Set dst (CMoveF (Binary cop (CmpI op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10489,16 +10488,15 @@ instruct cmovF_cmpI(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode, - as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_Register($op1$$reg), as_Register($op2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpU(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ +instruct cmovF_cmpU(fRegF dst, fRegF src, iRegI op1, iRegI op2, cmpOpU cop) %{ match(Set dst (CMoveF (Binary cop (CmpU op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10507,16 +10505,15 @@ instruct cmovF_cmpU(fRegF dst, fRegF src, iRegI op1, iRegI op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, - as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_Register($op1$$reg), as_Register($op2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovF_cmpL(fRegF dst, fRegF src, iRegL op1, iRegL op2, cmpOp cop) %{ match(Set dst (CMoveF (Binary cop (CmpL op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10525,16 +10522,15 @@ instruct cmovF_cmpL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode, - as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_Register($op1$$reg), as_Register($op2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpUL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ +instruct cmovF_cmpUL(fRegF dst, fRegF src, iRegL op1, iRegL op2, cmpOpU cop) %{ match(Set dst (CMoveF (Binary cop (CmpUL op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10543,16 +10539,15 @@ instruct cmovF_cmpUL(fRegF dst, fRegF src, iRegL op1, iRegL op2, iRegI tmp1, iRe ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, - as_Register($op1$$reg), as_Register($op2$$reg), as_Register($tmp1$$reg), as_Register($tmp2$$reg), + as_Register($op1$$reg), as_Register($op2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpF(fRegF dst, fRegF src, fRegF op1, fRegF op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovF_cmpF(fRegF dst, fRegF src, fRegF op1, fRegF op2, cmpOp cop) %{ match(Set dst (CMoveF (Binary cop (CmpF op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10562,7 +10557,6 @@ instruct cmovF_cmpF(fRegF dst, fRegF src, fRegF op1, fRegF op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp_fp($cop$$cmpcode, as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* cmp_single */, true /* cmov_single */); %} @@ -10570,9 +10564,8 @@ instruct cmovF_cmpF(fRegF dst, fRegF src, fRegF op1, fRegF op2, iRegI tmp1, iReg ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpD(fRegF dst, fRegF src, fRegD op1, fRegD op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovF_cmpD(fRegF dst, fRegF src, fRegD op1, fRegD op2, cmpOp cop) %{ match(Set dst (CMoveF (Binary cop (CmpD op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10582,7 +10575,6 @@ instruct cmovF_cmpD(fRegF dst, fRegF src, fRegD op1, fRegD op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp_fp($cop$$cmpcode | C2_MacroAssembler::double_branch_mask, as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* cmp_single */, true /* cmov_single */); %} @@ -10590,9 +10582,8 @@ instruct cmovF_cmpD(fRegF dst, fRegF src, fRegD op1, fRegD op2, iRegI tmp1, iReg ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpN(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovF_cmpN(fRegF dst, fRegF src, iRegN op1, iRegN op2, cmpOp cop) %{ match(Set dst (CMoveF (Binary cop (CmpN op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10602,16 +10593,14 @@ instruct cmovF_cmpN(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpP(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovF_cmpP(fRegF dst, fRegF src, iRegN op1, iRegN op2, cmpOp cop) %{ match(Set dst (CMoveF (Binary cop (CmpP op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10621,7 +10610,6 @@ instruct cmovF_cmpP(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* is_single */); %} @@ -10630,9 +10618,8 @@ instruct cmovF_cmpP(fRegF dst, fRegF src, iRegN op1, iRegN op2, iRegI tmp1, iReg // --------- CMoveD --------- -instruct cmovD_cmpI(fRegD dst, fRegD src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovD_cmpI(fRegD dst, fRegD src, iRegI op1, iRegI op2, cmpOp cop) %{ match(Set dst (CMoveD (Binary cop (CmpI op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10642,16 +10629,14 @@ instruct cmovD_cmpI(fRegD dst, fRegD src, iRegI op1, iRegI op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpU(fRegD dst, fRegD src, iRegI op1, iRegI op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ +instruct cmovD_cmpU(fRegD dst, fRegD src, iRegI op1, iRegI op2, cmpOpU cop) %{ match(Set dst (CMoveD (Binary cop (CmpU op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10661,16 +10646,14 @@ instruct cmovD_cmpU(fRegD dst, fRegD src, iRegI op1, iRegI op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpL(fRegD dst, fRegD src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovD_cmpL(fRegD dst, fRegD src, iRegL op1, iRegL op2, cmpOp cop) %{ match(Set dst (CMoveD (Binary cop (CmpL op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10680,16 +10663,14 @@ instruct cmovD_cmpL(fRegD dst, fRegD src, iRegL op1, iRegL op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpUL(fRegD dst, fRegD src, iRegL op1, iRegL op2, iRegI tmp1, iRegI tmp2, cmpOpU cop) %{ +instruct cmovD_cmpUL(fRegD dst, fRegD src, iRegL op1, iRegL op2, cmpOpU cop) %{ match(Set dst (CMoveD (Binary cop (CmpUL op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10699,16 +10680,14 @@ instruct cmovD_cmpUL(fRegD dst, fRegD src, iRegL op1, iRegL op2, iRegI tmp1, iRe ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpF(fRegD dst, fRegD src, fRegF op1, fRegF op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovD_cmpF(fRegD dst, fRegD src, fRegF op1, fRegF op2, cmpOp cop) %{ match(Set dst (CMoveD (Binary cop (CmpF op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10718,7 +10697,6 @@ instruct cmovD_cmpF(fRegD dst, fRegD src, fRegF op1, fRegF op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp_fp($cop$$cmpcode, as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), true /* cmp_single */, false /* cmov_single */); %} @@ -10726,9 +10704,8 @@ instruct cmovD_cmpF(fRegD dst, fRegD src, fRegF op1, fRegF op2, iRegI tmp1, iReg ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpD(fRegD dst, fRegD src, fRegD op1, fRegD op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovD_cmpD(fRegD dst, fRegD src, fRegD op1, fRegD op2, cmpOp cop) %{ match(Set dst (CMoveD (Binary cop (CmpD op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10738,7 +10715,6 @@ instruct cmovD_cmpD(fRegD dst, fRegD src, fRegD op1, fRegD op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp_fp($cop$$cmpcode | C2_MacroAssembler::double_branch_mask, as_FloatRegister($op1$$reg), as_FloatRegister($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* cmp_single */, false /* cmov_single */); %} @@ -10746,9 +10722,8 @@ instruct cmovD_cmpD(fRegD dst, fRegD src, fRegD op1, fRegD op2, iRegI tmp1, iReg ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpN(fRegD dst, fRegD src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovD_cmpN(fRegD dst, fRegD src, iRegN op1, iRegN op2, cmpOp cop) %{ match(Set dst (CMoveD (Binary cop (CmpN op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10758,16 +10733,14 @@ instruct cmovD_cmpN(fRegD dst, fRegD src, iRegN op1, iRegN op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); %} ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpP(fRegD dst, fRegD src, iRegN op1, iRegN op2, iRegI tmp1, iRegI tmp2, cmpOp cop) %{ +instruct cmovD_cmpP(fRegD dst, fRegD src, iRegN op1, iRegN op2, cmpOp cop) %{ match(Set dst (CMoveD (Binary cop (CmpP op1 op2)) (Binary dst src))); - effect(TEMP tmp1, TEMP tmp2); ins_cost(ALU_COST + BRANCH_COST); format %{ @@ -10777,7 +10750,6 @@ instruct cmovD_cmpP(fRegD dst, fRegD src, iRegN op1, iRegN op2, iRegI tmp1, iReg ins_encode %{ __ enc_cmove_fp_cmp($cop$$cmpcode | C2_MacroAssembler::unsigned_branch_mask, as_Register($op1$$reg), as_Register($op2$$reg), - as_Register($tmp1$$reg), as_Register($tmp2$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg), false /* is_single */); %} From 9c85366a2e3ffa7e34bdae6b2a111ed329540e91 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 20:06:13 +0000 Subject: [PATCH 19/32] disable vectorization of CMoveFD by removing share code change --- src/hotspot/cpu/aarch64/matcher_aarch64.hpp | 4 ---- src/hotspot/cpu/arm/matcher_arm.hpp | 4 ---- src/hotspot/cpu/ppc/matcher_ppc.hpp | 4 ---- src/hotspot/cpu/riscv/matcher_riscv.hpp | 4 ---- src/hotspot/cpu/s390/matcher_s390.hpp | 4 ---- src/hotspot/cpu/x86/matcher_x86.hpp | 4 ---- src/hotspot/share/opto/superword.cpp | 13 ++----------- src/hotspot/share/opto/vectornode.cpp | 5 ----- src/hotspot/share/opto/vectornode.hpp | 3 --- 9 files changed, 2 insertions(+), 43 deletions(-) diff --git a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp index 49eae1cc438a1..eb3b87d14e40b 100644 --- a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp @@ -205,8 +205,4 @@ return (VM_Version::supports_fphp() && VM_Version::supports_asimdhp()); } - static bool supports_vector_different_use_def_size() { - return false; - } - #endif // CPU_AARCH64_MATCHER_AARCH64_HPP diff --git a/src/hotspot/cpu/arm/matcher_arm.hpp b/src/hotspot/cpu/arm/matcher_arm.hpp index 28e9caf1ab084..66fe8ac330eb5 100644 --- a/src/hotspot/cpu/arm/matcher_arm.hpp +++ b/src/hotspot/cpu/arm/matcher_arm.hpp @@ -193,8 +193,4 @@ return false; } - static bool supports_vector_different_use_def_size() { - return false; - } - #endif // CPU_ARM_MATCHER_ARM_HPP diff --git a/src/hotspot/cpu/ppc/matcher_ppc.hpp b/src/hotspot/cpu/ppc/matcher_ppc.hpp index 987b959aa3b43..aad41fb7b1cf0 100644 --- a/src/hotspot/cpu/ppc/matcher_ppc.hpp +++ b/src/hotspot/cpu/ppc/matcher_ppc.hpp @@ -203,8 +203,4 @@ return false; } - static bool supports_vector_different_use_def_size() { - return false; - } - #endif // CPU_PPC_MATCHER_PPC_HPP diff --git a/src/hotspot/cpu/riscv/matcher_riscv.hpp b/src/hotspot/cpu/riscv/matcher_riscv.hpp index f6b99af45b8bd..1b490a07f92a6 100644 --- a/src/hotspot/cpu/riscv/matcher_riscv.hpp +++ b/src/hotspot/cpu/riscv/matcher_riscv.hpp @@ -199,8 +199,4 @@ return false; } - static bool supports_vector_different_use_def_size() { - return true; - } - #endif // CPU_RISCV_MATCHER_RISCV_HPP diff --git a/src/hotspot/cpu/s390/matcher_s390.hpp b/src/hotspot/cpu/s390/matcher_s390.hpp index 8ab5587aaba20..e4c277c63a8b9 100644 --- a/src/hotspot/cpu/s390/matcher_s390.hpp +++ b/src/hotspot/cpu/s390/matcher_s390.hpp @@ -196,8 +196,4 @@ return false; } - static bool supports_vector_different_use_def_size() { - return false; - } - #endif // CPU_S390_MATCHER_S390_HPP diff --git a/src/hotspot/cpu/x86/matcher_x86.hpp b/src/hotspot/cpu/x86/matcher_x86.hpp index d12cb7cb84276..41486c244b247 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -236,8 +236,4 @@ } } - static bool supports_vector_different_use_def_size() { - return false; - } - #endif // CPU_X86_MATCHER_X86_HPP diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 1c0fd736f0cdd..7a2e6bc7fbd02 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2307,17 +2307,8 @@ bool SuperWord::is_velt_basic_type_compatible_use_def(Node* use, Node* def) cons type2aelembytes(use_bt) == 4; } - // Input size of use equals output size of def - if (type2aelembytes(use_bt) == type2aelembytes(def_bt)) { - return true; - } - - // Allow CMove to have different type for comparision and moving. - if (VectorNode::is_different_use_def_size_supported() && use->is_CMove() && def->is_Bool()) { - return true; - } - - return false; + // Default case: input size of use equals output size of def. + return type2aelembytes(use_bt) == type2aelembytes(def_bt); } // Return nullptr if success, else failure message diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index b6480c3a9652a..35edc793299ac 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -406,10 +406,6 @@ bool VectorNode::is_populate_index_supported(BasicType bt) { return Matcher::match_rule_supported_vector(Op_PopulateIndex, vlen, bt); } -bool VectorNode::is_different_use_def_size_supported() { - return Matcher::supports_vector_different_use_def_size(); -} - bool VectorNode::is_shift_opcode(int opc) { switch (opc) { case Op_LShiftI: @@ -2313,7 +2309,6 @@ static bool is_replicate_uint_constant(const Node* n) { n->in(1)->bottom_type()->isa_long() && n->in(1)->bottom_type()->is_long()->get_con() <= 0xFFFFFFFFL; } - static bool has_vector_elements_fit_uint(Node* n) { auto is_lower_doubleword_mask_pattern = [](const Node* n) { return n->Opcode() == Op_AndV && diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index aba825081474e..427aeff53fcf9 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -110,9 +110,6 @@ class VectorNode : public TypeNode { static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt); static bool is_vector_integral_negate_supported(int opc, uint vlen, BasicType bt, bool use_predicate); static bool is_populate_index_supported(BasicType bt); - // Return true if every bit in this vector is 1, e.g. based on the comparison - // result of 2 floats, set a double result. - static bool is_different_use_def_size_supported(); // Return true if every bit in this vector is 1. static bool is_all_ones_vector(Node* n); // Return true if every bit in this vector is 0. From 29271ddd70b83c7f9df9f43b8391fc5f97bcbf9a Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 20:10:01 +0000 Subject: [PATCH 20/32] typo --- src/hotspot/share/opto/vectornode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 35edc793299ac..6ae8bbe8aa0af 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -2302,13 +2302,13 @@ Node* VectorBlendNode::Identity(PhaseGVN* phase) { } return this; } - static bool is_replicate_uint_constant(const Node* n) { return n->Opcode() == Op_Replicate && n->in(1)->is_Con() && n->in(1)->bottom_type()->isa_long() && n->in(1)->bottom_type()->is_long()->get_con() <= 0xFFFFFFFFL; } + static bool has_vector_elements_fit_uint(Node* n) { auto is_lower_doubleword_mask_pattern = [](const Node* n) { return n->Opcode() == Op_AndV && From 0e9dffd90bfdd301cc0bf689fb5880077ffc0ec8 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 20:33:37 +0000 Subject: [PATCH 21/32] typo --- src/hotspot/cpu/aarch64/matcher_aarch64.hpp | 1 - src/hotspot/cpu/riscv/macroAssembler_riscv.cpp | 1 + src/hotspot/cpu/riscv/riscv.ad | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp index eb3b87d14e40b..0fbc2ef141e8b 100644 --- a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp @@ -204,5 +204,4 @@ static bool is_feat_fp16_supported() { return (VM_Version::supports_fphp() && VM_Version::supports_asimdhp()); } - #endif // CPU_AARCH64_MATCHER_AARCH64_HPP diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index f1566de44d977..f08f15e7531ce 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -1502,6 +1502,7 @@ void MacroAssembler::cmov_cmp_fp_gt(FloatRegister cmp1, FloatRegister cmp2, Regi mv(dst, src); bind(no_set); } + // ----------- cmove float/double, compare float/double ----------- // Move src to dst only if cmp1 == cmp2, diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index 94f9d227a2f3a..e3fbe0fb4d0d5 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -10476,6 +10476,7 @@ instruct cmovL_cmpP(iRegLNoSp dst, iRegL src, iRegP op1, iRegP op2, cmpOpU cop) ins_pipe(pipe_class_compare); %} + // --------- CMoveF --------- instruct cmovF_cmpI(fRegF dst, fRegF src, iRegI op1, iRegI op2, cmpOp cop) %{ From b4763fdbd527e6821ca479abb4063c69f8219418 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 20:34:57 +0000 Subject: [PATCH 22/32] revert unrelated vmaskcmp change --- src/hotspot/cpu/riscv/riscv_v.ad | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hotspot/cpu/riscv/riscv_v.ad b/src/hotspot/cpu/riscv/riscv_v.ad index 196c6d3f4c48e..fe323474d60de 100644 --- a/src/hotspot/cpu/riscv/riscv_v.ad +++ b/src/hotspot/cpu/riscv/riscv_v.ad @@ -230,7 +230,6 @@ instruct vstoremask(vReg dst, vRegMask_V0 v0, immI size) %{ instruct vmaskcmp(vRegMask dst, vReg src1, vReg src2, immI cond) %{ predicate(Matcher::vector_element_basic_type(n) == T_BYTE || - Matcher::vector_element_basic_type(n) == T_CHAR || Matcher::vector_element_basic_type(n) == T_SHORT || Matcher::vector_element_basic_type(n) == T_INT || Matcher::vector_element_basic_type(n) == T_LONG); @@ -248,7 +247,6 @@ instruct vmaskcmp(vRegMask dst, vReg src1, vReg src2, immI cond) %{ instruct vmaskcmp_masked(vRegMask dst, vReg src1, vReg src2, immI cond, vRegMask_V0 v0) %{ predicate(Matcher::vector_element_basic_type(n) == T_BYTE || - Matcher::vector_element_basic_type(n) == T_CHAR || Matcher::vector_element_basic_type(n) == T_SHORT || Matcher::vector_element_basic_type(n) == T_INT || Matcher::vector_element_basic_type(n) == T_LONG); From 642e4a5ef3974fdbe0e3fd0f2f6edc1e0e73dc13 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 20:45:35 +0000 Subject: [PATCH 23/32] revert unrelated test change --- .../c2/irTests/TestVectorConditionalMove.java | 208 +++--------------- 1 file changed, 26 insertions(+), 182 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java index bf08688cf4219..97322c0f5046f 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java @@ -1202,13 +1202,7 @@ private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, flo // I fo D @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1219,13 +1213,7 @@ private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1236,13 +1224,7 @@ private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1253,13 +1235,7 @@ private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1270,13 +1246,7 @@ private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1287,13 +1257,7 @@ private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, d } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1439,13 +1403,7 @@ private static void testCMoveLLEforL(long[] a, long[] b, long[] c, long[] d, lon // L fo F @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1456,13 +1414,7 @@ private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1473,13 +1425,7 @@ private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1490,13 +1436,7 @@ private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1507,13 +1447,7 @@ private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1524,13 +1458,7 @@ private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, f } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1877,13 +1805,7 @@ private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, fl // I fo D @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1894,13 +1816,7 @@ private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1911,13 +1827,7 @@ private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1928,13 +1838,7 @@ private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1945,13 +1849,7 @@ private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1962,13 +1860,7 @@ private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.LOAD_VECTOR_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_int, max_double)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveUILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -2114,13 +2006,7 @@ private static void testCMoveULLEforL(long[] a, long[] b, long[] c, long[] d, lo // L fo F @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2131,13 +2017,7 @@ private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2148,13 +2028,7 @@ private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2165,13 +2039,7 @@ private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2182,13 +2050,7 @@ private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2199,13 +2061,7 @@ private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_long, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2356,13 +2212,7 @@ private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", - IRNode.LOAD_VECTOR_D, ">0", - IRNode.VECTOR_MASK_CMP_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", - IRNode.VECTOR_BLEND_D, ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -2395,13 +2245,7 @@ private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, } @Test - @IR(counts = {IRNode.LOAD_VECTOR_D, ">0", - IRNode.LOAD_VECTOR_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", - IRNode.VECTOR_MASK_CMP_D, ">0", - IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_double, max_float)", ">0", - IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"rvv", "true"}) - @IR(failOn = {IRNode.STORE_VECTOR}, applyIfCPUFeatureOr = {"rvv", "false"}) + @IR(failOn = {IRNode.STORE_VECTOR}) private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; From ec0d8cc4e3b17538715e46426263758f307cc7b7 Mon Sep 17 00:00:00 2001 From: hamlin Date: Thu, 13 Nov 2025 20:56:24 +0000 Subject: [PATCH 24/32] remove unused test code --- .../jtreg/compiler/c2/irTests/TestVectorConditionalMove.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java index 97322c0f5046f..4876048cd2492 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java @@ -2716,12 +2716,10 @@ private void testCMove_runner_two() { } // I for D - boolean passed = true; testCMoveIEQforD(aI, bI, cD, dD, rD, rD); for (int i = 0; i < SIZE; i++) { Asserts.assertEquals(rD[i], cmoveIEQforD(aI[i], bI[i], cD[i], dD[i])); } - Asserts.assertEquals(passed, true); testCMoveINEforD(aI, bI, cD, dD, rD, rD); for (int i = 0; i < SIZE; i++) { From e1e9be1deb3ebd59363832f627278455d430bb94 Mon Sep 17 00:00:00 2001 From: hamlin Date: Fri, 14 Nov 2025 17:57:19 +0000 Subject: [PATCH 25/32] fix cmovF/D_cmpP --- src/hotspot/cpu/riscv/riscv.ad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index e3fbe0fb4d0d5..4872a3fa8aa8a 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -10600,7 +10600,7 @@ instruct cmovF_cmpN(fRegF dst, fRegF src, iRegN op1, iRegN op2, cmpOp cop) %{ ins_pipe(pipe_class_compare); %} -instruct cmovF_cmpP(fRegF dst, fRegF src, iRegN op1, iRegN op2, cmpOp cop) %{ +instruct cmovF_cmpP(fRegF dst, fRegF src, iRegP op1, iRegP op2, cmpOp cop) %{ match(Set dst (CMoveF (Binary cop (CmpP op1 op2)) (Binary dst src))); ins_cost(ALU_COST + BRANCH_COST); @@ -10740,7 +10740,7 @@ instruct cmovD_cmpN(fRegD dst, fRegD src, iRegN op1, iRegN op2, cmpOp cop) %{ ins_pipe(pipe_class_compare); %} -instruct cmovD_cmpP(fRegD dst, fRegD src, iRegN op1, iRegN op2, cmpOp cop) %{ +instruct cmovD_cmpP(fRegD dst, fRegD src, iRegP op1, iRegP op2, cmpOp cop) %{ match(Set dst (CMoveD (Binary cop (CmpP op1 op2)) (Binary dst src))); ins_cost(ALU_COST + BRANCH_COST); From 5c0d645de1b33563ed14b4fc6ac5c606f9fe54a4 Mon Sep 17 00:00:00 2001 From: hamlin Date: Fri, 14 Nov 2025 17:57:58 +0000 Subject: [PATCH 26/32] add CMove+CmpP/N tests --- .../TestScalarConditionalMoveCmpObj.java | 357 ++++++++++++++++++ 1 file changed, 357 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMoveCmpObj.java diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMoveCmpObj.java b/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMoveCmpObj.java new file mode 100644 index 0000000000000..e332ac9e293d4 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMoveCmpObj.java @@ -0,0 +1,357 @@ +/* + * Copyright (c) 2025, Rivos Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.c2.irTests; + +import compiler.lib.ir_framework.*; +import java.util.Random; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; + +/* + * @test + * @summary Test conditional move + compare object. + * @requires vm.simpleArch == "riscv64" + * @library /test/lib / + * @run driver compiler.c2.irTests.TestScalarConditionalMoveCmpObj + */ + +public class TestScalarConditionalMoveCmpObj { + final private static int SIZE = 1024; + private static final Random RANDOM = Utils.getRandomInstance(); + + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders", "-XX:+UseCompressedOops"); + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders", "-XX:-UseCompressedOops"); + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCompactObjectHeaders", "-XX:+UseCompressedOops"); + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCompactObjectHeaders", "-XX:-UseCompressedOops"); + } + + // Object comparison + // O for I + private int cmoveOEQforI(Object a, Object b, int c, int d) { + return (a == b) ? c : d; + } + + private int cmoveONEforI(Object a, Object b, int c, int d) { + return (a != b) ? c : d; + } + + // O for L + private long cmoveOEQforL(Object a, Object b, long c, long d) { + return (a == b) ? c : d; + } + + private long cmoveONEforL(Object a, Object b, long c, long d) { + return (a != b) ? c : d; + } + + // O for F + private float cmoveOEQforF(Object a, Object b, float c, float d) { + return (a == b) ? c : d; + } + + private float cmoveONEforF(Object a, Object b, float c, float d) { + return (a != b) ? c : d; + } + + // O for D + private double cmoveOEQforD(Object a, Object b, double c, double d) { + return (a == b) ? c : d; + } + + private double cmoveONEforD(Object a, Object b, double c, double d) { + return (a != b) ? c : d; + } + + // Tests shows CMoveI is generated, so let @IR verify CMOVE_I. + // + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_P, ">0"}, + applyIf = {"UseCompressedOops", "false"}) + @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_N, ">0"}, + applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveOEQforI(Object[] a, Object[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_P, ">0"}, + applyIf = {"UseCompressedOops", "false"}) + @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_N, ">0"}, + applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveONEforI(Object[] a, Object[] b, int[] c, int[] d, int[] r, int[] r2) { + for (int i = 0; i < a.length; i++) { + int cc = c[i]; + int dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + // So far, CMoveL is not guaranteed to be generated, so @IR not verify CMOVE_L. + // TODO: enable CMOVE_L verification when it's guaranteed to generate CMOVE_L. + // + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_P, ">0"}, + // applyIf = {"UseCompressedOops", "false"}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_N, ">0"}, + // applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveOEQforL(Object[] a, Object[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_P, ">0"}, + // applyIf = {"UseCompressedOops", "false"}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_N, ">0"}, + // applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveONEforL(Object[] a, Object[] b, long[] c, long[] d, long[] r, long[] r2) { + for (int i = 0; i < a.length; i++) { + long cc = c[i]; + long dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_P, ">0"}, + applyIf = {"UseCompressedOops", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_N, ">0"}, + applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveOEQforF(Object[] a, Object[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_P, ">0"}, + applyIf = {"UseCompressedOops", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_N, ">0"}, + applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveONEforF(Object[] a, Object[] b, float[] c, float[] d, float[] r, float[] r2) { + for (int i = 0; i < a.length; i++) { + float cc = c[i]; + float dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_P, ">0"}, + applyIf = {"UseCompressedOops", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_N, ">0"}, + applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveOEQforD(Object[] a, Object[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] == b[i]) ? cc : dd; + } + } + + @Test + @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_P, ">0"}, + applyIf = {"UseCompressedOops", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_N, ">0"}, + applyIf = {"UseCompressedOops", "true"}) + private static void testCMoveONEforD(Object[] a, Object[] b, double[] c, double[] d, double[] r, double[] r2) { + for (int i = 0; i < a.length; i++) { + double cc = c[i]; + double dd = d[i]; + r2[i] = cc + dd; + r[i] = (a[i] != b[i]) ? cc : dd; + } + } + + @Warmup(0) + @Run(test = {// Object + "testCMoveOEQforI", + "testCMoveONEforI", + "testCMoveOEQforL", + "testCMoveONEforL", + "testCMoveOEQforF", + "testCMoveONEforF", + "testCMoveOEQforD", + "testCMoveONEforD", + }) + private void testCMove_runner_two() { + Object[] aO = new Object[SIZE]; + Object[] bO = new Object[SIZE]; + int[] cI = new int[SIZE]; + int[] dI = new int[SIZE]; + int[] rI = new int[SIZE]; + long[] cL = new long[SIZE]; + long[] dL = new long[SIZE]; + long[] rL = new long[SIZE]; + float[] cF = new float[SIZE]; + float[] dF = new float[SIZE]; + float[] rF = new float[SIZE]; + double[] cD = new double[SIZE]; + double[] dD = new double[SIZE]; + double[] rD = new double[SIZE]; + + init(aO); + shuffle(aO, bO); + init(cL); + init(dL); + init(cF); + init(dF); + init(cD); + init(dD); + + testCMoveOEQforI(aO, bO, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveOEQforI(aO[i], bO[i], cI[i], dI[i])); + } + + testCMoveONEforI(aO, bO, cI, dI, rI, rI); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rI[i], cmoveONEforI(aO[i], bO[i], cI[i], dI[i])); + } + + testCMoveOEQforL(aO, bO, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveOEQforL(aO[i], bO[i], cL[i], dL[i])); + } + + testCMoveONEforL(aO, bO, cL, dL, rL, rL); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rL[i], cmoveONEforL(aO[i], bO[i], cL[i], dL[i])); + } + + testCMoveOEQforF(aO, bO, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveOEQforF(aO[i], bO[i], cF[i], dF[i])); + } + + testCMoveONEforF(aO, bO, cF, dF, rF, rF); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rF[i], cmoveONEforF(aO[i], bO[i], cF[i], dF[i])); + } + + testCMoveOEQforD(aO, bO, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveOEQforD(aO[i], bO[i], cD[i], dD[i])); + } + + testCMoveONEforD(aO, bO, cD, dD, rD, rD); + for (int i = 0; i < SIZE; i++) { + Asserts.assertEquals(rD[i], cmoveONEforD(aO[i], bO[i], cD[i], dD[i])); + } + + } + + private static void init(Object[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = new Object(); + } + } + + private static void shuffle(Object[] a, Object[] b) { + for (int i = 0; i < a.length; i++) { + b[i] = a[i]; + } + Random rand = new Random(); + for (int i = 0; i < SIZE; i++) { + if (rand.nextInt(5) == 0) { + Object t = b[i]; + b[i] = b[SIZE-1-i]; + b[SIZE-1-i] = t; + } + } + } + + private static void init(int[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = RANDOM.nextInt(); + } + } + + private static void init(long[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = RANDOM.nextLong(); + } + } + + private static void init(float[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = switch(RANDOM.nextInt() % 20) { + case 0 -> Float.NaN; + case 1 -> 0; + case 2 -> 1; + case 3 -> Float.POSITIVE_INFINITY; + case 4 -> Float.NEGATIVE_INFINITY; + case 5 -> Float.MAX_VALUE; + case 6 -> Float.MIN_VALUE; + case 7, 8, 9 -> RANDOM.nextFloat(); + default -> Float.intBitsToFloat(RANDOM.nextInt()); + }; + } + } + + private static void init(double[] a) { + for (int i = 0; i < SIZE; i++) { + a[i] = switch(RANDOM.nextInt() % 20) { + case 0 -> Double.NaN; + case 1 -> 0; + case 2 -> 1; + case 3 -> Double.POSITIVE_INFINITY; + case 4 -> Double.NEGATIVE_INFINITY; + case 5 -> Double.MAX_VALUE; + case 6 -> Double.MIN_VALUE; + case 7, 8, 9 -> RANDOM.nextDouble(); + default -> Double.longBitsToDouble(RANDOM.nextLong()); + }; + } + } +} From a63fca9840157d0dc8bec4960ed98ea8fffc52a3 Mon Sep 17 00:00:00 2001 From: hamlin Date: Mon, 17 Nov 2025 09:56:02 +0000 Subject: [PATCH 27/32] add CMP_N --- test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java index 5bfc6495db8ae..5b4ecab5a90dc 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java @@ -610,6 +610,11 @@ public class IRNode { beforeMatchingNameRegex(CMP_P, "CmpP"); } + public static final String CMP_N = PREFIX + "CMP_N" + POSTFIX; + static { + beforeMatchingNameRegex(CMP_N, "CmpN"); + } + public static final String CMP_LT_MASK = PREFIX + "CMP_LT_MASK" + POSTFIX; static { beforeMatchingNameRegex(CMP_LT_MASK, "CmpLTMask"); From 76516b112c4db81aa641fc37eaa2fdb388a40fdc Mon Sep 17 00:00:00 2001 From: hamlin Date: Mon, 17 Nov 2025 09:57:46 +0000 Subject: [PATCH 28/32] rename to TestConditionalMove.java --- ...estVectorConditionalMove.java => TestConditionalMove.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename test/hotspot/jtreg/compiler/c2/irTests/{TestVectorConditionalMove.java => TestConditionalMove.java} (99%) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestConditionalMove.java similarity index 99% rename from test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java rename to test/hotspot/jtreg/compiler/c2/irTests/TestConditionalMove.java index 4876048cd2492..fc597ed261c12 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorConditionalMove.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestConditionalMove.java @@ -36,10 +36,10 @@ * @key randomness * @summary Auto-vectorization enhancement to support vector conditional move. * @library /test/lib / - * @run driver compiler.c2.irTests.TestVectorConditionalMove + * @run driver compiler.c2.irTests.TestConditionalMove */ -public class TestVectorConditionalMove { +public class TestConditionalMove { final private static int SIZE = 1024; private static final Random RANDOM = Utils.getRandomInstance(); From c63c296f3beacacdb114aa02a45481a00e07c7fa Mon Sep 17 00:00:00 2001 From: hamlin Date: Mon, 17 Nov 2025 13:27:24 +0000 Subject: [PATCH 29/32] merge scalar and vector tests --- .../c2/irTests/TestConditionalMove.java | 717 ++++++++++++++++-- 1 file changed, 659 insertions(+), 58 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestConditionalMove.java index fc597ed261c12..c531f73b71dbe 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestConditionalMove.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestConditionalMove.java @@ -44,6 +44,7 @@ public class TestConditionalMove { private static final Random RANDOM = Utils.getRandomInstance(); public static void main(String[] args) { + // Vectorizaion: +UseCMoveUnconditionally, +UseVectorCmov // Cross-product: +-AlignVector and +-UseCompactObjectHeaders TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:+UseVectorCmov", "-XX:-UseCompactObjectHeaders", "-XX:-AlignVector"); @@ -53,6 +54,12 @@ public static void main(String[] args) { "-XX:+UseCompactObjectHeaders", "-XX:-AlignVector"); TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:+UseVectorCmov", "-XX:+UseCompactObjectHeaders", "-XX:+AlignVector"); + + // Scalar: +UseCMoveUnconditionally, -UseVectorCmov + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders"); + TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", + "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCompactObjectHeaders"); } // Compare 2 values, and pick one of them @@ -565,6 +572,7 @@ private double cmoveFGTforD(float a, float b, double c, double d) { return (a > b) ? c : d; } + // Double comparison private int cmoveDGTforI(double a, double b, int c, int d) { return (a > b) ? c : d; } @@ -587,7 +595,13 @@ private double cmoveDGTforD(double a, double b, double c, double d) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVFGT(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] > b[i]) ? a[i] : b[i]; @@ -599,7 +613,13 @@ private static void testCMoveVFGT(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] > a[i]) ? a[i] : b[i]; @@ -611,7 +631,13 @@ private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVFLT(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] < b[i]) ? a[i] : b[i]; @@ -623,7 +649,13 @@ private static void testCMoveVFLT(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] < a[i]) ? a[i] : b[i]; @@ -635,7 +667,13 @@ private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVFEQ(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] == b[i]) ? a[i] : b[i]; @@ -647,7 +685,13 @@ private static void testCMoveVFEQ(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVDLE(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] <= b[i]) ? a[i] : b[i]; @@ -659,7 +703,13 @@ private static void testCMoveVDLE(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] <= a[i]) ? a[i] : b[i]; @@ -671,7 +721,13 @@ private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVDGE(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] >= b[i]) ? a[i] : b[i]; @@ -683,7 +739,13 @@ private static void testCMoveVDGE(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (b[i] >= a[i]) ? a[i] : b[i]; @@ -695,7 +757,13 @@ private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveVDNE(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] != b[i]) ? a[i] : b[i]; @@ -708,7 +776,13 @@ private static void testCMoveVDNE(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] > b[i]) ? 0.1f : -0.1f; @@ -720,7 +794,13 @@ private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] >= b[i]) ? 0.1f : -0.1f; @@ -732,7 +812,13 @@ private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] < b[i]) ? 0.1f : -0.1f; @@ -744,7 +830,13 @@ private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] <= b[i]) ? 0.1f : -0.1f; @@ -756,7 +848,13 @@ private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] == b[i]) ? 0.1f : -0.1f; @@ -768,7 +866,13 @@ private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] != b[i]) ? 0.1f : -0.1f; @@ -780,8 +884,19 @@ private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"}, + applyIfAnd = {"UseCompactObjectHeaders", "false", "UseVectorCmov", "true"}, + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + @IR(counts = {IRNode.LOAD_VECTOR_F, ">0", + IRNode.VECTOR_MASK_CMP_F, ">0", + IRNode.VECTOR_BLEND_F, ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfAnd = {"AlignVector", "false", "UseVectorCmov", "true"}, applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; @@ -798,8 +913,19 @@ private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"}, + applyIfAnd = {"UseCompactObjectHeaders", "false", "UseVectorCmov", "true"}, applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + @IR(counts = {IRNode.LOAD_VECTOR_F, ">0", + IRNode.VECTOR_MASK_CMP_F, ">0", + IRNode.VECTOR_BLEND_F, ">0", + IRNode.STORE_VECTOR, ">0"}, + applyIfAnd = {"AlignVector", "false", "UseVectorCmov", "true"}, + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; @@ -816,7 +942,13 @@ private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, "=0", IRNode.VECTOR_BLEND_F, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; @@ -829,7 +961,13 @@ private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_F, "=0", IRNode.VECTOR_BLEND_F, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFXXforFConstH2(float[] a, float[] b, float[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; @@ -842,7 +980,13 @@ private static void testCMoveFXXforFConstH2(float[] a, float[] b, float[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] > b[i]) ? 0.1 : -0.1; @@ -854,7 +998,13 @@ private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] >= b[i]) ? 0.1 : -0.1; @@ -866,7 +1016,13 @@ private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] < b[i]) ? 0.1 : -0.1; @@ -878,7 +1034,13 @@ private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] <= b[i]) ? 0.1 : -0.1; @@ -890,7 +1052,13 @@ private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] == b[i]) ? 0.1 : -0.1; @@ -902,7 +1070,13 @@ private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i++) { c[i] = (a[i] != b[i]) ? 0.1 : -0.1; @@ -914,7 +1088,13 @@ private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) { IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDLTforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; @@ -927,7 +1107,13 @@ private static void testCMoveDLTforDConstH2(double[] a, double[] b, double[] c) IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDLEforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; @@ -940,7 +1126,13 @@ private static void testCMoveDLEforDConstH2(double[] a, double[] b, double[] c) IRNode.VECTOR_MASK_CMP_D, "=0", IRNode.VECTOR_BLEND_D, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDYYforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; @@ -953,7 +1145,13 @@ private static void testCMoveDYYforDConstH2(double[] a, double[] b, double[] c) IRNode.VECTOR_MASK_CMP_D, "=0", IRNode.VECTOR_BLEND_D, "=0", IRNode.STORE_VECTOR, "=0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDXXforDConstH2(double[] a, double[] b, double[] c) { for (int i = 0; i < a.length; i+=2) { c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; @@ -967,11 +1165,15 @@ private static void testCMoveDXXforDConstH2(double[] a, double[] b, double[] c) // do not float down into the branches, I compute a value, and store it to r2 (same as r, except that the // compilation does not know that). // So far, vectorization only works for CMoveF/D, with same data-width comparison (F/I for F, D/L for D). + // TODO: enable CMOVE_I/L verification when it's guaranteed to generate CMOVE_I/L, JDK-8371984. // // Signed comparison: I/L // I fo I @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -983,6 +1185,9 @@ private static void testCMoveIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -994,6 +1199,9 @@ private static void testCMoveINEforI(int[] a, int[] b, int[] c, int[] d, int[] r @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1005,6 +1213,9 @@ private static void testCMoveIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1016,6 +1227,9 @@ private static void testCMoveIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1027,6 +1241,9 @@ private static void testCMoveILTforI(int[] a, int[] b, int[] c, int[] d, int[] r @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1039,6 +1256,9 @@ private static void testCMoveILEforI(int[] a, int[] b, int[] c, int[] d, int[] r // I fo L @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1050,6 +1270,9 @@ private static void testCMoveIEQforL(int[] a, int[] b, long[] c, long[] d, long[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1061,6 +1284,9 @@ private static void testCMoveINEforL(int[] a, int[] b, long[] c, long[] d, long[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1072,6 +1298,9 @@ private static void testCMoveIGTforL(int[] a, int[] b, long[] c, long[] d, long[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1083,6 +1312,9 @@ private static void testCMoveIGEforL(int[] a, int[] b, long[] c, long[] d, long[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1094,6 +1326,9 @@ private static void testCMoveILTforL(int[] a, int[] b, long[] c, long[] d, long[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1110,7 +1345,13 @@ private static void testCMoveILEforL(int[] a, int[] b, long[] c, long[] d, long[ IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1126,7 +1367,13 @@ private static void testCMoveIEQforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1142,7 +1389,13 @@ private static void testCMoveINEforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1158,7 +1411,13 @@ private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1174,7 +1433,13 @@ private static void testCMoveIGEforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1190,7 +1455,13 @@ private static void testCMoveILTforF(int[] a, int[] b, float[] c, float[] d, flo IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1203,6 +1474,9 @@ private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, flo // I fo D @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1214,6 +1488,9 @@ private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, d @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1225,6 +1502,9 @@ private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, d @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1236,6 +1516,9 @@ private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, d @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1247,6 +1530,9 @@ private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, d @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1258,6 +1544,9 @@ private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, d @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1270,6 +1559,9 @@ private static void testCMoveILEforD(int[] a, int[] b, double[] c, double[] d, d // L fo I @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1281,6 +1573,9 @@ private static void testCMoveLEQforI(long[] a, long[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1292,6 +1587,9 @@ private static void testCMoveLNEforI(long[] a, long[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1303,6 +1601,9 @@ private static void testCMoveLGTforI(long[] a, long[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1314,6 +1615,9 @@ private static void testCMoveLGEforI(long[] a, long[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1325,6 +1629,9 @@ private static void testCMoveLLTforI(long[] a, long[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1337,6 +1644,9 @@ private static void testCMoveLLEforI(long[] a, long[] b, int[] c, int[] d, int[] // L fo L @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1348,6 +1658,9 @@ private static void testCMoveLEQforL(long[] a, long[] b, long[] c, long[] d, lon @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1359,6 +1672,9 @@ private static void testCMoveLNEforL(long[] a, long[] b, long[] c, long[] d, lon @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1370,6 +1686,9 @@ private static void testCMoveLGTforL(long[] a, long[] b, long[] c, long[] d, lon @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1381,6 +1700,9 @@ private static void testCMoveLGEforL(long[] a, long[] b, long[] c, long[] d, lon @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1392,6 +1714,9 @@ private static void testCMoveLLTforL(long[] a, long[] b, long[] c, long[] d, lon @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1404,6 +1729,9 @@ private static void testCMoveLLEforL(long[] a, long[] b, long[] c, long[] d, lon // L fo F @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1415,6 +1743,9 @@ private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, f @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1426,6 +1757,9 @@ private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, f @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1437,6 +1771,9 @@ private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, f @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1448,6 +1785,9 @@ private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, f @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1459,6 +1799,9 @@ private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, f @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1475,7 +1818,13 @@ private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, f IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1492,7 +1841,13 @@ private static void testCMoveLEQforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1509,7 +1864,13 @@ private static void testCMoveLNEforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1526,7 +1887,13 @@ private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1543,7 +1910,13 @@ private static void testCMoveLGEforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1560,7 +1933,13 @@ private static void testCMoveLLTforD(long[] a, long[] b, double[] c, double[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveLLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -1575,6 +1954,9 @@ private static void testCMoveLLEforD(long[] a, long[] b, double[] c, double[] d, // I fo I @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1586,6 +1968,9 @@ private static void testCMoveUIEQforI(int[] a, int[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1597,6 +1982,9 @@ private static void testCMoveUINEforI(int[] a, int[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1608,6 +1996,9 @@ private static void testCMoveUIGTforI(int[] a, int[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1619,6 +2010,9 @@ private static void testCMoveUIGEforI(int[] a, int[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1630,6 +2024,9 @@ private static void testCMoveUILTforI(int[] a, int[] b, int[] c, int[] d, int[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1642,6 +2039,9 @@ private static void testCMoveUILEforI(int[] a, int[] b, int[] c, int[] d, int[] // I fo L @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1653,6 +2053,9 @@ private static void testCMoveUIEQforL(int[] a, int[] b, long[] c, long[] d, long @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1664,6 +2067,9 @@ private static void testCMoveUINEforL(int[] a, int[] b, long[] c, long[] d, long @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1675,6 +2081,9 @@ private static void testCMoveUIGTforL(int[] a, int[] b, long[] c, long[] d, long @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1686,6 +2095,9 @@ private static void testCMoveUIGEforL(int[] a, int[] b, long[] c, long[] d, long @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1697,6 +2109,9 @@ private static void testCMoveUILTforL(int[] a, int[] b, long[] c, long[] d, long @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1713,7 +2128,13 @@ private static void testCMoveUILEforL(int[] a, int[] b, long[] c, long[] d, long IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1729,7 +2150,13 @@ private static void testCMoveUIEQforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1745,7 +2172,13 @@ private static void testCMoveUINEforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1761,7 +2194,13 @@ private static void testCMoveUIGTforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1777,7 +2216,13 @@ private static void testCMoveUIGEforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1793,7 +2238,13 @@ private static void testCMoveUILTforF(int[] a, int[] b, float[] c, float[] d, fl IRNode.VECTOR_MASK_CMP_I, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.VECTOR_BLEND_F, IRNode.VECTOR_SIZE + "min(max_int, max_float)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -1806,6 +2257,9 @@ private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, fl // I fo D @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1817,6 +2271,9 @@ private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1828,6 +2285,9 @@ private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1839,6 +2299,9 @@ private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1850,6 +2313,9 @@ private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1861,6 +2327,9 @@ private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveUILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -1873,6 +2342,9 @@ private static void testCMoveUILEforD(int[] a, int[] b, double[] c, double[] d, // L fo I @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1884,6 +2356,9 @@ private static void testCMoveULEQforI(long[] a, long[] b, int[] c, int[] d, int[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1895,6 +2370,9 @@ private static void testCMoveULNEforI(long[] a, long[] b, int[] c, int[] d, int[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1906,6 +2384,9 @@ private static void testCMoveULGTforI(long[] a, long[] b, int[] c, int[] d, int[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1917,6 +2398,9 @@ private static void testCMoveULGEforI(long[] a, long[] b, int[] c, int[] d, int[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1928,6 +2412,9 @@ private static void testCMoveULLTforI(long[] a, long[] b, int[] c, int[] d, int[ @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -1940,6 +2427,9 @@ private static void testCMoveULLEforI(long[] a, long[] b, int[] c, int[] d, int[ // L fo L @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1951,6 +2441,9 @@ private static void testCMoveULEQforL(long[] a, long[] b, long[] c, long[] d, lo @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1962,6 +2455,9 @@ private static void testCMoveULNEforL(long[] a, long[] b, long[] c, long[] d, lo @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1973,6 +2469,9 @@ private static void testCMoveULGTforL(long[] a, long[] b, long[] c, long[] d, lo @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1984,6 +2483,9 @@ private static void testCMoveULGEforL(long[] a, long[] b, long[] c, long[] d, lo @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -1995,6 +2497,9 @@ private static void testCMoveULLTforL(long[] a, long[] b, long[] c, long[] d, lo @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -2007,6 +2512,9 @@ private static void testCMoveULLEforL(long[] a, long[] b, long[] c, long[] d, lo // L fo F @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2018,6 +2526,9 @@ private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2029,6 +2540,9 @@ private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2040,6 +2554,9 @@ private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2051,6 +2568,9 @@ private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2062,6 +2582,9 @@ private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2078,7 +2601,13 @@ private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2095,7 +2624,13 @@ private static void testCMoveULEQforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2112,7 +2647,13 @@ private static void testCMoveULNEforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2129,7 +2670,13 @@ private static void testCMoveULGTforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2146,7 +2693,13 @@ private static void testCMoveULGEforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2163,7 +2716,13 @@ private static void testCMoveULLTforD(long[] a, long[] b, double[] c, double[] d IRNode.VECTOR_MASK_CMP_L, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.VECTOR_BLEND_D, IRNode.VECTOR_SIZE + "min(max_long, max_double)", ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) // Requires avx2, else L is restricted to 16 byte, and D has 32. That leads to a vector elements mismatch of 2 to 4. private static void testCMoveULLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { @@ -2176,6 +2735,9 @@ private static void testCMoveULLEforD(long[] a, long[] b, double[] c, double[] d @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_F, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGTforI(float[] a, float[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -2187,6 +2749,9 @@ private static void testCMoveFGTforI(float[] a, float[] b, int[] c, int[] d, int @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_F, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGTforL(float[] a, float[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -2201,7 +2766,13 @@ private static void testCMoveFGTforL(float[] a, float[] b, long[] c, long[] d, l IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2213,6 +2784,9 @@ private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -2224,6 +2798,9 @@ private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_D, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDGTforI(double[] a, double[] b, int[] c, int[] d, int[] r, int[] r2) { for (int i = 0; i < a.length; i++) { int cc = c[i]; @@ -2235,6 +2812,9 @@ private static void testCMoveDGTforI(double[] a, double[] b, int[] c, int[] d, i @Test @IR(failOn = {IRNode.STORE_VECTOR}) + // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_D, ">0"}, + // applyIf = {"UseVectorCmov", "false"}, + // applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, long[] r, long[] r2) { for (int i = 0; i < a.length; i++) { long cc = c[i]; @@ -2246,6 +2826,9 @@ private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, @Test @IR(failOn = {IRNode.STORE_VECTOR}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; @@ -2260,7 +2843,13 @@ private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] IRNode.VECTOR_MASK_CMP_D, ">0", IRNode.VECTOR_BLEND_D, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[] d, double[] r, double[] r2) { for (int i = 0; i < a.length; i++) { double cc = c[i]; @@ -2276,7 +2865,13 @@ private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[ IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < b.length; i++) { float cc = c[i]; @@ -2291,7 +2886,13 @@ private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float IRNode.VECTOR_MASK_CMP_F, ">0", IRNode.VECTOR_BLEND_F, ">0", IRNode.STORE_VECTOR, ">0"}, - applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}) + applyIfCPUFeatureOr = {"avx", "true", "asimd", "true", "rvv", "true"}, + applyIf = {"UseVectorCmov", "true"}) + @IR(failOn = {IRNode.STORE_VECTOR}, + applyIf = {"UseVectorCmov", "false"}) + @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}, + applyIf = {"UseVectorCmov", "false"}, + applyIfPlatform = {"riscv64", "true"}) private static void testCMoveFGTforFCmpCon2(float[] a, float b, float[] c, float[] d, float[] r, float[] r2) { for (int i = 0; i < a.length; i++) { float cc = c[i]; From 51451ab5dcd729c2683e3ea92cfb321aaedbf523 Mon Sep 17 00:00:00 2001 From: hamlin Date: Mon, 17 Nov 2025 13:29:21 +0000 Subject: [PATCH 30/32] remove TestScalarConditionalMove.java --- .../c2/irTests/TestScalarConditionalMove.java | 3072 ----------------- 1 file changed, 3072 deletions(-) delete mode 100644 test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java b/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java deleted file mode 100644 index c9a5c887dcda2..0000000000000 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestScalarConditionalMove.java +++ /dev/null @@ -1,3072 +0,0 @@ -/* - * Copyright (c) 2022, 2025, Arm Limited. All rights reserved. - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2025, Rivos Inc. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.c2.irTests; - -import compiler.lib.ir_framework.*; -import java.util.Random; -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; - -/* - * @test - * @summary Test conditional move. - * @requires vm.simpleArch == "riscv64" - * @library /test/lib / - * @run driver compiler.c2.irTests.TestScalarConditionalMove - */ - -public class TestScalarConditionalMove { - final private static int SIZE = 1024; - private static final Random RANDOM = Utils.getRandomInstance(); - - public static void main(String[] args) { - TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", - "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders"); - TestFramework.runWithFlags("-XX:+UseCMoveUnconditionally", "-XX:-UseVectorCmov", - "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCompactObjectHeaders"); - } - - // Compare 2 values, and pick one of them - private float cmoveFloatGT(float a, float b) { - return (a > b) ? a : b; - } - - private float cmoveFloatGTSwap(float a, float b) { - return (b > a) ? a : b; - } - - private float cmoveFloatLT(float a, float b) { - return (a < b) ? a : b; - } - - private float cmoveFloatLTSwap(float a, float b) { - return (b < a) ? a : b; - } - - private float cmoveFloatEQ(float a, float b) { - return (a == b) ? a : b; - } - - private double cmoveDoubleLE(double a, double b) { - return (a <= b) ? a : b; - } - - private double cmoveDoubleLESwap(double a, double b) { - return (b <= a) ? a : b; - } - - private double cmoveDoubleGE(double a, double b) { - return (a >= b) ? a : b; - } - - private double cmoveDoubleGESwap(double a, double b) { - return (b >= a) ? a : b; - } - - private double cmoveDoubleNE(double a, double b) { - return (a != b) ? a : b; - } - - // Extensions: compare 2 values, and pick from 2 consts - private float cmoveFGTforFConst(float a, float b) { - return (a > b) ? 0.1f : -0.1f; - } - - private float cmoveFGEforFConst(float a, float b) { - return (a >= b) ? 0.1f : -0.1f; - } - - private float cmoveFLTforFConst(float a, float b) { - return (a < b) ? 0.1f : -0.1f; - } - - private float cmoveFLEforFConst(float a, float b) { - return (a <= b) ? 0.1f : -0.1f; - } - - private float cmoveFEQforFConst(float a, float b) { - return (a == b) ? 0.1f : -0.1f; - } - - private float cmoveFNEQforFConst(float a, float b) { - return (a != b) ? 0.1f : -0.1f; - } - - private double cmoveDGTforDConst(double a, double b) { - return (a > b) ? 0.1 : -0.1; - } - - private double cmoveDGEforDConst(double a, double b) { - return (a >= b) ? 0.1 : -0.1; - } - - private double cmoveDLTforDConst(double a, double b) { - return (a < b) ? 0.1 : -0.1; - } - - private double cmoveDLEforDConst(double a, double b) { - return (a <= b) ? 0.1 : -0.1; - } - - private double cmoveDEQforDConst(double a, double b) { - return (a == b) ? 0.1 : -0.1; - } - - private double cmoveDNEQforDConst(double a, double b) { - return (a != b) ? 0.1 : -0.1; - } - - // Extension: Compare 2 ILFD values, and pick from 2 ILFD values - // Signed comparison: I/L - // I for I - private int cmoveIEQforI(int a, int b, int c, int d) { - return (a == b) ? c : d; - } - - private int cmoveINEforI(int a, int b, int c, int d) { - return (a != b) ? c : d; - } - - private int cmoveIGTforI(int a, int b, int c, int d) { - return (a > b) ? c : d; - } - - private int cmoveIGEforI(int a, int b, int c, int d) { - return (a >= b) ? c : d; - } - - private int cmoveILTforI(int a, int b, int c, int d) { - return (a < b) ? c : d; - } - - private int cmoveILEforI(int a, int b, int c, int d) { - return (a <= b) ? c : d; - } - - // I for L - private long cmoveIEQforL(int a, int b, long c, long d) { - return (a == b) ? c : d; - } - - private long cmoveINEforL(int a, int b, long c, long d) { - return (a != b) ? c : d; - } - - private long cmoveIGTforL(int a, int b, long c, long d) { - return (a > b) ? c : d; - } - - private long cmoveIGEforL(int a, int b, long c, long d) { - return (a >= b) ? c : d; - } - - private long cmoveILTforL(int a, int b, long c, long d) { - return (a < b) ? c : d; - } - - private long cmoveILEforL(int a, int b, long c, long d) { - return (a <= b) ? c : d; - } - - // I for F - private float cmoveIEQforF(int a, int b, float c, float d) { - return (a == b) ? c : d; - } - - private float cmoveINEforF(int a, int b, float c, float d) { - return (a != b) ? c : d; - } - - private float cmoveIGTforF(int a, int b, float c, float d) { - return (a > b) ? c : d; - } - - private float cmoveIGEforF(int a, int b, float c, float d) { - return (a >= b) ? c : d; - } - - private float cmoveILTforF(int a, int b, float c, float d) { - return (a < b) ? c : d; - } - - private float cmoveILEforF(int a, int b, float c, float d) { - return (a <= b) ? c : d; - } - - // I for D - private double cmoveIEQforD(int a, int b, double c, double d) { - return (a == b) ? c : d; - } - - private double cmoveINEforD(int a, int b, double c, double d) { - return (a != b) ? c : d; - } - - private double cmoveIGTforD(int a, int b, double c, double d) { - return (a > b) ? c : d; - } - - private double cmoveIGEforD(int a, int b, double c, double d) { - return (a >= b) ? c : d; - } - - private double cmoveILTforD(int a, int b, double c, double d) { - return (a < b) ? c : d; - } - - private double cmoveILEforD(int a, int b, double c, double d) { - return (a <= b) ? c : d; - } - - // L for I - private int cmoveLEQforI(long a, long b, int c, int d) { - return (a == b) ? c : d; - } - - private int cmoveLNEforI(long a, long b, int c, int d) { - return (a != b) ? c : d; - } - - private int cmoveLGTforI(long a, long b, int c, int d) { - return (a > b) ? c : d; - } - - private int cmoveLGEforI(long a, long b, int c, int d) { - return (a >= b) ? c : d; - } - - private int cmoveLLTforI(long a, long b, int c, int d) { - return (a < b) ? c : d; - } - - private int cmoveLLEforI(long a, long b, int c, int d) { - return (a <= b) ? c : d; - } - - // L for L - private long cmoveLEQforL(long a, long b, long c, long d) { - return (a == b) ? c : d; - } - - private long cmoveLNEforL(long a, long b, long c, long d) { - return (a != b) ? c : d; - } - - private long cmoveLGTforL(long a, long b, long c, long d) { - return (a > b) ? c : d; - } - - private long cmoveLGEforL(long a, long b, long c, long d) { - return (a >= b) ? c : d; - } - - private long cmoveLLTforL(long a, long b, long c, long d) { - return (a < b) ? c : d; - } - - private long cmoveLLEforL(long a, long b, long c, long d) { - return (a <= b) ? c : d; - } - - // L for F - private float cmoveLEQforF(long a, long b, float c, float d) { - return (a == b) ? c : d; - } - - private float cmoveLNEforF(long a, long b, float c, float d) { - return (a != b) ? c : d; - } - - private float cmoveLGTforF(long a, long b, float c, float d) { - return (a > b) ? c : d; - } - - private float cmoveLGEforF(long a, long b, float c, float d) { - return (a >= b) ? c : d; - } - - private float cmoveLLTforF(long a, long b, float c, float d) { - return (a < b) ? c : d; - } - - private float cmoveLLEforF(long a, long b, float c, float d) { - return (a <= b) ? c : d; - } - - // L for D - private double cmoveLEQforD(long a, long b, double c, double d) { - return (a == b) ? c : d; - } - - private double cmoveLNEforD(long a, long b, double c, double d) { - return (a != b) ? c : d; - } - - private double cmoveLGTforD(long a, long b, double c, double d) { - return (a > b) ? c : d; - } - - private double cmoveLGEforD(long a, long b, double c, double d) { - return (a >= b) ? c : d; - } - - private double cmoveLLTforD(long a, long b, double c, double d) { - return (a < b) ? c : d; - } - - private double cmoveLLEforD(long a, long b, double c, double d) { - return (a <= b) ? c : d; - } - - // Unsigned comparison: I/L - // I for I - private int cmoveUIEQforI(int a, int b, int c, int d) { - return Integer.compareUnsigned(a, b) == 0 ? c : d; - } - - private int cmoveUINEforI(int a, int b, int c, int d) { - return Integer.compareUnsigned(a, b) != 0 ? c : d; - } - - private int cmoveUIGTforI(int a, int b, int c, int d) { - return Integer.compareUnsigned(a, b) > 0 ? c : d; - } - - private int cmoveUIGEforI(int a, int b, int c, int d) { - return Integer.compareUnsigned(a, b) >= 0 ? c : d; - } - - private int cmoveUILTforI(int a, int b, int c, int d) { - return Integer.compareUnsigned(a, b) < 0 ? c : d; - } - - private int cmoveUILEforI(int a, int b, int c, int d) { - return Integer.compareUnsigned(a, b) <= 0 ? c : d; - } - - // I for L - private long cmoveUIEQforL(int a, int b, long c, long d) { - return Integer.compareUnsigned(a, b) == 0 ? c : d; - } - - private long cmoveUINEforL(int a, int b, long c, long d) { - return Integer.compareUnsigned(a, b) != 0 ? c : d; - } - - private long cmoveUIGTforL(int a, int b, long c, long d) { - return Integer.compareUnsigned(a, b) > 0 ? c : d; - } - - private long cmoveUIGEforL(int a, int b, long c, long d) { - return Integer.compareUnsigned(a, b) >= 0 ? c : d; - } - - private long cmoveUILTforL(int a, int b, long c, long d) { - return Integer.compareUnsigned(a, b) < 0 ? c : d; - } - - private long cmoveUILEforL(int a, int b, long c, long d) { - return Integer.compareUnsigned(a, b) <= 0 ? c : d; - } - - // I for F - private float cmoveUIEQforF(int a, int b, float c, float d) { - return Integer.compareUnsigned(a, b) == 0 ? c : d; - } - - private float cmoveUINEforF(int a, int b, float c, float d) { - return Integer.compareUnsigned(a, b) != 0 ? c : d; - } - - private float cmoveUIGTforF(int a, int b, float c, float d) { - return Integer.compareUnsigned(a, b) > 0 ? c : d; - } - - private float cmoveUIGEforF(int a, int b, float c, float d) { - return Integer.compareUnsigned(a, b) >= 0 ? c : d; - } - - private float cmoveUILTforF(int a, int b, float c, float d) { - return Integer.compareUnsigned(a, b) < 0 ? c : d; - } - - private float cmoveUILEforF(int a, int b, float c, float d) { - return Integer.compareUnsigned(a, b) <= 0 ? c : d; - } - - // I for D - private double cmoveUIEQforD(int a, int b, double c, double d) { - return Integer.compareUnsigned(a, b) == 0 ? c : d; - } - - private double cmoveUINEforD(int a, int b, double c, double d) { - return Integer.compareUnsigned(a, b) != 0 ? c : d; - } - - private double cmoveUIGTforD(int a, int b, double c, double d) { - return Integer.compareUnsigned(a, b) > 0 ? c : d; - } - - private double cmoveUIGEforD(int a, int b, double c, double d) { - return Integer.compareUnsigned(a, b) >= 0 ? c : d; - } - - private double cmoveUILTforD(int a, int b, double c, double d) { - return Integer.compareUnsigned(a, b) < 0 ? c : d; - } - - private double cmoveUILEforD(int a, int b, double c, double d) { - return Integer.compareUnsigned(a, b) <= 0 ? c : d; - } - - // L for I - private int cmoveULEQforI(long a, long b, int c, int d) { - return Long.compareUnsigned(a, b) == 0 ? c : d; - } - - private int cmoveULNEforI(long a, long b, int c, int d) { - return Long.compareUnsigned(a, b) != 0 ? c : d; - } - - private int cmoveULGTforI(long a, long b, int c, int d) { - return Long.compareUnsigned(a, b) > 0 ? c : d; - } - - private int cmoveULGEforI(long a, long b, int c, int d) { - return Long.compareUnsigned(a, b) >= 0 ? c : d; - } - - private int cmoveULLTforI(long a, long b, int c, int d) { - return Long.compareUnsigned(a, b) < 0 ? c : d; - } - - private int cmoveULLEforI(long a, long b, int c, int d) { - return Long.compareUnsigned(a, b) <= 0 ? c : d; - } - - // L for L - private long cmoveULEQforL(long a, long b, long c, long d) { - return Long.compareUnsigned(a, b) == 0 ? c : d; - } - - private long cmoveULNEforL(long a, long b, long c, long d) { - return Long.compareUnsigned(a, b) != 0 ? c : d; - } - - private long cmoveULGTforL(long a, long b, long c, long d) { - return Long.compareUnsigned(a, b) > 0 ? c : d; - } - - private long cmoveULGEforL(long a, long b, long c, long d) { - return Long.compareUnsigned(a, b) >= 0 ? c : d; - } - - private long cmoveULLTforL(long a, long b, long c, long d) { - return Long.compareUnsigned(a, b) < 0 ? c : d; - } - - private long cmoveULLEforL(long a, long b, long c, long d) { - return Long.compareUnsigned(a, b) <= 0 ? c : d; - } - - // L for F - private float cmoveULEQforF(long a, long b, float c, float d) { - return Long.compareUnsigned(a, b) == 0 ? c : d; - } - - private float cmoveULNEforF(long a, long b, float c, float d) { - return Long.compareUnsigned(a, b) != 0 ? c : d; - } - - private float cmoveULGTforF(long a, long b, float c, float d) { - return Long.compareUnsigned(a, b) > 0 ? c : d; - } - - private float cmoveULGEforF(long a, long b, float c, float d) { - return Long.compareUnsigned(a, b) >= 0 ? c : d; - } - - private float cmoveULLTforF(long a, long b, float c, float d) { - return Long.compareUnsigned(a, b) < 0 ? c : d; - } - - private float cmoveULLEforF(long a, long b, float c, float d) { - return Long.compareUnsigned(a, b) <= 0 ? c : d; - } - - // L for D - private double cmoveULEQforD(long a, long b, double c, double d) { - return Long.compareUnsigned(a, b) == 0 ? c : d; - } - - private double cmoveULNEforD(long a, long b, double c, double d) { - return Long.compareUnsigned(a, b) != 0 ? c : d; - } - - private double cmoveULGTforD(long a, long b, double c, double d) { - return Long.compareUnsigned(a, b) > 0 ? c : d; - } - - private double cmoveULGEforD(long a, long b, double c, double d) { - return Long.compareUnsigned(a, b) >= 0 ? c : d; - } - - private double cmoveULLTforD(long a, long b, double c, double d) { - return Long.compareUnsigned(a, b) < 0 ? c : d; - } - - private double cmoveULLEforD(long a, long b, double c, double d) { - return Long.compareUnsigned(a, b) <= 0 ? c : d; - } - - // Float comparison - private int cmoveFGTforI(float a, float b, int c, int d) { - return (a > b) ? c : d; - } - - private long cmoveFGTforL(float a, float b, long c, long d) { - return (a > b) ? c : d; - } - - private float cmoveFGTforF(float a, float b, float c, float d) { - return (a > b) ? c : d; - } - - private double cmoveFGTforD(float a, float b, double c, double d) { - return (a > b) ? c : d; - } - - private int cmoveDGTforI(double a, double b, int c, int d) { - return (a > b) ? c : d; - } - - private long cmoveDGTforL(double a, double b, long c, long d) { - return (a > b) ? c : d; - } - - private float cmoveDGTforF(double a, double b, float c, float d) { - return (a > b) ? c : d; - } - - private double cmoveDGTforD(double a, double b, double c, double d) { - return (a > b) ? c : d; - } - - // Compare 2 values, and pick one of them - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveVFGT(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] > b[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveVFGTSwap(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (b[i] > a[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveVFLT(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] < b[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveVFLTSwap(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (b[i] < a[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveVFEQ(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] == b[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveVDLE(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] <= b[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveVDLESwap(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (b[i] <= a[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveVDGE(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] >= b[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveVDGESwap(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (b[i] >= a[i]) ? a[i] : b[i]; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveVDNE(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] != b[i]) ? a[i] : b[i]; - } - } - - // Extensions: compare 2 values, and pick from 2 consts - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGTforFConst(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] > b[i]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGEforFConst(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] >= b[i]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFLTforFConst(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] < b[i]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFLEforFConst(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] <= b[i]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFEQforFConst(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] == b[i]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] != b[i]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; - c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; - c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f; - c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFXXforFConstH2(float[] a, float[] b, float[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f; - c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDGTforDConst(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] > b[i]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDGEforDConst(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] >= b[i]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDLTforDConst(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] < b[i]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDLEforDConst(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] <= b[i]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDEQforDConst(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] == b[i]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDNEQforDConst(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i++) { - c[i] = (a[i] != b[i]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDLTforDConstH2(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; - c[i+1] = (a[i+1] < b[i+1]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDLEforDConstH2(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; - c[i+1] = (a[i+1] <= b[i+1]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDYYforDConstH2(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] <= b[i+0]) ? 0.1 : -0.1; - c[i+1] = (a[i+1] < b[i+1]) ? 0.1 : -0.1; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDXXforDConstH2(double[] a, double[] b, double[] c) { - for (int i = 0; i < a.length; i+=2) { - c[i+0] = (a[i+0] < b[i+0]) ? 0.1 : -0.1; - c[i+1] = (a[i+1] <= b[i+1]) ? 0.1 : -0.1; - } - } - - // Extension: Compare 2 ILFD values, and pick from 2 ILFD values - // Note: - // To guarantee that CMove is introduced, I need to perform the loads before the branch. To ensure they - // do not float down into the branches, I compute a value, and store it to r2 (same as r, except that the - // compilation does not know that). - // So far, CMoveI/L is not guaranteed to be generated, so @IR not verify CMOVE_I/L. - // - // Signed comparison: I/L - // I fo I - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // I fo L - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // I fo F - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // I fo D - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // L fo I - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_I, ">0"}) - private static void testCMoveLEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // L fo L - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // L fo F - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // L fo D - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] == b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] != b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] >= b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] < b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_L, ">0"}) - private static void testCMoveLLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] <= b[i]) ? cc : dd; - } - } - - // Unsigned comparison: I/L - // I fo I - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIEQforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUINEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILTforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILEforI(int[] a, int[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - // I fo L - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIEQforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUINEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILTforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILEforL(int[] a, int[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - // I fo F - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIEQforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUINEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILTforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILEforF(int[] a, int[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - // I fo D - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIEQforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUINEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUIGEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILTforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_U, ">0"}) - private static void testCMoveUILEforD(int[] a, int[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Integer.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - // L fo I - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULEQforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULNEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLTforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLEforI(long[] a, long[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - // L fo L - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULEQforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULNEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLTforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLEforL(long[] a, long[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - // L fo F - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULEQforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULNEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLTforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLEforF(long[] a, long[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - // L fo D - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULEQforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) == 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULNEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) != 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) > 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULGEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) >= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLTforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) < 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_UL, ">0"}) - private static void testCMoveULLEforD(long[] a, long[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = Long.compareUnsigned(a[i], b[i]) <= 0 ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGTforI(float[] a, float[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGTforL(float[] a, float[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGTforF(float[] a, float[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGTforD(float[] a, float[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_I, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDGTforI(double[] a, double[] b, int[] c, int[] d, int[] r, int[] r2) { - for (int i = 0; i < a.length; i++) { - int cc = c[i]; - int dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - // @IR(counts = {IRNode.CMOVE_L, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDGTforL(double[] a, double[] b, long[] c, long[] d, long[] r, long[] r2) { - for (int i = 0; i < a.length; i++) { - long cc = c[i]; - long dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDGTforF(double[] a, double[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_D, ">0", IRNode.CMP_D, ">0"}) - private static void testCMoveDGTforD(double[] a, double[] b, double[] c, double[] d, double[] r, double[] r2) { - for (int i = 0; i < a.length; i++) { - double cc = c[i]; - double dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b[i]) ? cc : dd; - } - } - - // Use some constants in the comparison - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGTforFCmpCon1(float a, float[] b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < b.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a > b[i]) ? cc : dd; - } - } - - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - @IR(counts = {IRNode.CMOVE_F, ">0", IRNode.CMP_F, ">0"}) - private static void testCMoveFGTforFCmpCon2(float[] a, float b, float[] c, float[] d, float[] r, float[] r2) { - for (int i = 0; i < a.length; i++) { - float cc = c[i]; - float dd = d[i]; - r2[i] = cc + dd; - r[i] = (a[i] > b) ? cc : dd; - } - } - - // A case that is currently not supported and is not expected to vectorize - @Test - @IR(failOn = {IRNode.STORE_VECTOR}) - private static void testCMoveVDUnsupported() { - double[] doublec = new double[SIZE]; - int seed = 1001; - for (int i = 0; i < doublec.length; i++) { - doublec[i] = (i % 2 == 0) ? seed + i : seed - i; - } - } - - @Warmup(0) - @Run(test = {"testCMoveVFGT", "testCMoveVFLT","testCMoveVDLE", "testCMoveVDGE", "testCMoveVFEQ", "testCMoveVDNE", - "testCMoveVFGTSwap", "testCMoveVFLTSwap","testCMoveVDLESwap", "testCMoveVDGESwap", - "testCMoveFGTforFConst", "testCMoveFGEforFConst", "testCMoveFLTforFConst", - "testCMoveFLEforFConst", "testCMoveFEQforFConst", "testCMoveFNEQforFConst", - "testCMoveDGTforDConst", "testCMoveDGEforDConst", "testCMoveDLTforDConst", - "testCMoveDLEforDConst", "testCMoveDEQforDConst", "testCMoveDNEQforDConst", - "testCMoveFLTforFConstH2", "testCMoveFLEforFConstH2", - "testCMoveFYYforFConstH2", "testCMoveFXXforFConstH2", - "testCMoveDLTforDConstH2", "testCMoveDLEforDConstH2", - "testCMoveDYYforDConstH2", "testCMoveDXXforDConstH2"}) - private void testCMove_runner() { - float[] floata = new float[SIZE]; - float[] floatb = new float[SIZE]; - float[] floatc = new float[SIZE]; - double[] doublea = new double[SIZE]; - double[] doubleb = new double[SIZE]; - double[] doublec = new double[SIZE]; - - init(floata); - init(floatb); - init(doublea); - init(doubleb); - - testCMoveVFGT(floata, floatb, floatc); - testCMoveVDLE(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFloatGT(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDoubleLE(doublea[i], doubleb[i])); - } - - testCMoveVFLT(floata, floatb, floatc); - testCMoveVDGE(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFloatLT(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDoubleGE(doublea[i], doubleb[i])); - } - - // Ensure we frequently have equals - for (int i = 0; i < SIZE; i++) { - if (i % 3 == 0) { - floatb[i] = floata[i]; - doubleb[i] = doublea[i]; - } - } - - testCMoveVFEQ(floata, floatb, floatc); - testCMoveVDNE(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFloatEQ(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDoubleNE(doublea[i], doubleb[i])); - } - - testCMoveVFGTSwap(floata, floatb, floatc); - testCMoveVDLESwap(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFloatGTSwap(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDoubleLESwap(doublea[i], doubleb[i])); - } - - testCMoveVFLTSwap(floata, floatb, floatc); - testCMoveVDGESwap(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFloatLTSwap(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDoubleGESwap(doublea[i], doubleb[i])); - } - - // Extensions: compare 2 values, and pick from 2 consts - testCMoveFGTforFConst(floata, floatb, floatc); - testCMoveDGTforDConst(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFGTforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDGTforDConst(doublea[i], doubleb[i])); - } - - testCMoveFGEforFConst(floata, floatb, floatc); - testCMoveDGEforDConst(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFGEforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDGEforDConst(doublea[i], doubleb[i])); - } - - testCMoveFLTforFConst(floata, floatb, floatc); - testCMoveDLTforDConst(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFLTforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDLTforDConst(doublea[i], doubleb[i])); - } - - testCMoveFLEforFConst(floata, floatb, floatc); - testCMoveDLEforDConst(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFLEforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDLEforDConst(doublea[i], doubleb[i])); - } - - testCMoveFEQforFConst(floata, floatb, floatc); - testCMoveDEQforDConst(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFEQforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDEQforDConst(doublea[i], doubleb[i])); - } - - testCMoveFNEQforFConst(floata, floatb, floatc); - testCMoveDNEQforDConst(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFNEQforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDNEQforDConst(doublea[i], doubleb[i])); - } - - // Hand-unrolled (H2) examples: - testCMoveFLTforFConstH2(floata, floatb, floatc); - testCMoveDLTforDConstH2(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFLTforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDLTforDConst(doublea[i], doubleb[i])); - } - - testCMoveFLEforFConstH2(floata, floatb, floatc); - testCMoveDLEforDConstH2(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(floatc[i], cmoveFLEforFConst(floata[i], floatb[i])); - Asserts.assertEquals(doublec[i], cmoveDLEforDConst(doublea[i], doubleb[i])); - } - - testCMoveFYYforFConstH2(floata, floatb, floatc); - testCMoveDYYforDConstH2(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i+=2) { - Asserts.assertEquals(floatc[i+0], cmoveFLEforFConst(floata[i+0], floatb[i+0])); - Asserts.assertEquals(doublec[i+0], cmoveDLEforDConst(doublea[i+0], doubleb[i+0])); - Asserts.assertEquals(floatc[i+1], cmoveFLTforFConst(floata[i+1], floatb[i+1])); - Asserts.assertEquals(doublec[i+1], cmoveDLTforDConst(doublea[i+1], doubleb[i+1])); - } - - testCMoveFXXforFConstH2(floata, floatb, floatc); - testCMoveDXXforDConstH2(doublea, doubleb, doublec); - for (int i = 0; i < SIZE; i+=2) { - Asserts.assertEquals(floatc[i+0], cmoveFLTforFConst(floata[i+0], floatb[i+0])); - Asserts.assertEquals(doublec[i+0], cmoveDLTforDConst(doublea[i+0], doubleb[i+0])); - Asserts.assertEquals(floatc[i+1], cmoveFLEforFConst(floata[i+1], floatb[i+1])); - Asserts.assertEquals(doublec[i+1], cmoveDLEforDConst(doublea[i+1], doubleb[i+1])); - } - } - - @Warmup(0) - @Run(test = {// Signed - // I for I - "testCMoveIEQforI", - "testCMoveINEforI", - "testCMoveIGTforI", - "testCMoveIGEforI", - "testCMoveILTforI", - "testCMoveILEforI", - // I for L - "testCMoveIEQforL", - "testCMoveINEforL", - "testCMoveIGTforL", - "testCMoveIGEforL", - "testCMoveILTforL", - "testCMoveILEforL", - // I for F - "testCMoveIEQforF", - "testCMoveINEforF", - "testCMoveIGTforF", - "testCMoveIGEforF", - "testCMoveILTforF", - "testCMoveILEforF", - // I for D - "testCMoveIEQforD", - "testCMoveINEforD", - "testCMoveIGTforD", - "testCMoveIGEforD", - "testCMoveILTforD", - "testCMoveILEforD", - // L for I - "testCMoveLEQforI", - "testCMoveLNEforI", - "testCMoveLGTforI", - "testCMoveLGEforI", - "testCMoveLLTforI", - "testCMoveLLEforI", - // L for L - "testCMoveLEQforL", - "testCMoveLNEforL", - "testCMoveLGTforL", - "testCMoveLGEforL", - "testCMoveLLTforL", - "testCMoveLLEforL", - // L for F - "testCMoveLEQforF", - "testCMoveLNEforF", - "testCMoveLGTforF", - "testCMoveLGEforF", - "testCMoveLLTforF", - "testCMoveLLEforF", - // L for D - "testCMoveLEQforD", - "testCMoveLNEforD", - "testCMoveLGTforD", - "testCMoveLGEforD", - "testCMoveLLTforD", - "testCMoveLLEforD", - // Unsigned - // I for I - "testCMoveUIEQforI", - "testCMoveUINEforI", - "testCMoveUIGTforI", - "testCMoveUIGEforI", - "testCMoveUILTforI", - "testCMoveUILEforI", - // I for L - "testCMoveUIEQforL", - "testCMoveUINEforL", - "testCMoveUIGTforL", - "testCMoveUIGEforL", - "testCMoveUILTforL", - "testCMoveUILEforL", - // I for F - "testCMoveUIEQforF", - "testCMoveUINEforF", - "testCMoveUIGTforF", - "testCMoveUIGEforF", - "testCMoveUILTforF", - "testCMoveUILEforF", - // I for D - "testCMoveUIEQforD", - "testCMoveUINEforD", - "testCMoveUIGTforD", - "testCMoveUIGEforD", - "testCMoveUILTforD", - "testCMoveUILEforD", - // L for I - "testCMoveULEQforI", - "testCMoveULNEforI", - "testCMoveULGTforI", - "testCMoveULGEforI", - "testCMoveULLTforI", - "testCMoveULLEforI", - // L for L - "testCMoveULEQforL", - "testCMoveULNEforL", - "testCMoveULGTforL", - "testCMoveULGEforL", - "testCMoveULLTforL", - "testCMoveULLEforL", - // L for F - "testCMoveULEQforF", - "testCMoveULNEforF", - "testCMoveULGTforF", - "testCMoveULGEforF", - "testCMoveULLTforF", - "testCMoveULLEforF", - // L for D - "testCMoveULEQforD", - "testCMoveULNEforD", - "testCMoveULGTforD", - "testCMoveULGEforD", - "testCMoveULLTforD", - "testCMoveULLEforD", - // Float - "testCMoveFGTforI", - "testCMoveFGTforL", - "testCMoveFGTforF", - "testCMoveFGTforD", - "testCMoveDGTforI", - "testCMoveDGTforL", - "testCMoveDGTforF", - "testCMoveDGTforD", - "testCMoveFGTforFCmpCon1", - "testCMoveFGTforFCmpCon2"}) - private void testCMove_runner_two() { - int[] aI = new int[SIZE]; - int[] bI = new int[SIZE]; - int[] cI = new int[SIZE]; - int[] dI = new int[SIZE]; - int[] rI = new int[SIZE]; - long[] aL = new long[SIZE]; - long[] bL = new long[SIZE]; - long[] cL = new long[SIZE]; - long[] dL = new long[SIZE]; - long[] rL = new long[SIZE]; - float[] aF = new float[SIZE]; - float[] bF = new float[SIZE]; - float[] cF = new float[SIZE]; - float[] dF = new float[SIZE]; - float[] rF = new float[SIZE]; - double[] aD = new double[SIZE]; - double[] bD = new double[SIZE]; - double[] cD = new double[SIZE]; - double[] dD = new double[SIZE]; - double[] rD = new double[SIZE]; - - init(aI); - init(bI); - init(cI); - init(dI); - init(aL); - init(bL); - init(cL); - init(dL); - init(aF); - init(bF); - init(cF); - init(dF); - init(aD); - init(bD); - init(cD); - init(dD); - - // Signed - // I for I - testCMoveIEQforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveIEQforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveINEforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveINEforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveIGTforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveIGTforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveIGEforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveIGEforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveILTforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveILTforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveILEforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveILEforI(aI[i], bI[i], cI[i], dI[i])); - } - - // I for L - testCMoveIEQforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveIEQforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveINEforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveINEforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveIGTforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveIGTforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveIGEforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveIGEforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveILTforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveILTforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveILEforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveILEforL(aI[i], bI[i], cL[i], dL[i])); - } - - // I for F - testCMoveIEQforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveIEQforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveINEforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveINEforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveIGTforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveIGTforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveIGEforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveIGEforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveILTforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveILTforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveILEforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveILEforF(aI[i], bI[i], cF[i], dF[i])); - } - - // I for D - boolean passed = true; - testCMoveIEQforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveIEQforD(aI[i], bI[i], cD[i], dD[i])); - } - Asserts.assertEquals(passed, true); - - testCMoveINEforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveINEforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveIGTforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveIGTforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveIGEforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveIGEforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveILTforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveILTforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveILEforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveILEforD(aI[i], bI[i], cD[i], dD[i])); - } - - // L for I - testCMoveLEQforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveLEQforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveLNEforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveLNEforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveLGTforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveLGTforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveLGEforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveLGEforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveLLTforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveLLTforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveLLEforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveLLEforI(aL[i], bL[i], cI[i], dI[i])); - } - - // L for L - testCMoveLEQforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveLEQforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveLNEforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveLNEforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveLGTforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveLGTforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveLGEforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveLGEforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveLLTforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveLLTforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveLLEforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveLLEforL(aL[i], bL[i], cL[i], dL[i])); - } - - // L for F - testCMoveLEQforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveLEQforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveLNEforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveLNEforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveLGTforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveLGTforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveLGEforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveLGEforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveLLTforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveLLTforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveLLEforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveLLEforF(aL[i], bL[i], cF[i], dF[i])); - } - - // L for D - testCMoveLEQforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveLEQforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveLNEforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveLNEforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveLGTforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveLGTforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveLGEforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveLGEforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveLLTforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveLLTforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveLLEforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveLLEforD(aL[i], bL[i], cD[i], dD[i])); - } - - // Unsigned - // I for I - testCMoveUIEQforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveUIEQforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveUINEforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveUINEforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveUIGTforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveUIGTforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveUIGEforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveUIGEforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveUILTforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveUILTforI(aI[i], bI[i], cI[i], dI[i])); - } - - testCMoveUILEforI(aI, bI, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveUILEforI(aI[i], bI[i], cI[i], dI[i])); - } - - // I for L - testCMoveUIEQforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveUIEQforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveUINEforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveUINEforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveUIGTforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveUIGTforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveUIGEforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveUIGEforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveUILTforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveUILTforL(aI[i], bI[i], cL[i], dL[i])); - } - - testCMoveUILEforL(aI, bI, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveUILEforL(aI[i], bI[i], cL[i], dL[i])); - } - - // I for F - testCMoveUIEQforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveUIEQforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveUINEforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveUINEforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveUIGTforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveUIGTforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveUIGEforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveUIGEforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveUILTforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveUILTforF(aI[i], bI[i], cF[i], dF[i])); - } - - testCMoveUILEforF(aI, bI, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveUILEforF(aI[i], bI[i], cF[i], dF[i])); - } - - // I for D - testCMoveUIEQforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveUIEQforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveUINEforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveUINEforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveUIGTforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveUIGTforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveUIGEforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveUIGEforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveUILTforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveUILTforD(aI[i], bI[i], cD[i], dD[i])); - } - - testCMoveUILEforD(aI, bI, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveUILEforD(aI[i], bI[i], cD[i], dD[i])); - } - - // L for I - testCMoveULEQforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveULEQforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveULNEforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveULNEforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveULGTforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveULGTforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveULGEforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveULGEforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveULLTforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveULLTforI(aL[i], bL[i], cI[i], dI[i])); - } - - testCMoveULLEforI(aL, bL, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveULLEforI(aL[i], bL[i], cI[i], dI[i])); - } - - // L for L - testCMoveULEQforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveULEQforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveULNEforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveULNEforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveULGTforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveULGTforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveULGEforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveULGEforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveULLTforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveULLTforL(aL[i], bL[i], cL[i], dL[i])); - } - - testCMoveULLEforL(aL, bL, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveULLEforL(aL[i], bL[i], cL[i], dL[i])); - } - - // L for F - testCMoveULEQforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveULEQforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveULNEforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveULNEforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveULGTforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveULGTforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveULGEforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveULGEforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveULLTforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveULLTforF(aL[i], bL[i], cF[i], dF[i])); - } - - testCMoveULLEforF(aL, bL, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveULLEforF(aL[i], bL[i], cF[i], dF[i])); - } - - // L for D - testCMoveULEQforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveULEQforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveULNEforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveULNEforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveULGTforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveULGTforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveULGEforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveULGEforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveULLTforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveULLTforD(aL[i], bL[i], cD[i], dD[i])); - } - - testCMoveULLEforD(aL, bL, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveULLEforD(aL[i], bL[i], cD[i], dD[i])); - } - - // Float - testCMoveFGTforI(aF, bF, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveFGTforI(aF[i], bF[i], cI[i], dI[i])); - } - - testCMoveFGTforL(aF, bF, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveFGTforL(aF[i], bF[i], cL[i], dL[i])); - } - - testCMoveFGTforF(aF, bF, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveFGTforF(aF[i], bF[i], cF[i], dF[i])); - } - - testCMoveFGTforD(aF, bF, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveFGTforD(aF[i], bF[i], cD[i], dD[i])); - } - - testCMoveDGTforI(aD, bD, cI, dI, rI, rI); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rI[i], cmoveDGTforI(aD[i], bD[i], cI[i], dI[i])); - } - - testCMoveDGTforL(aD, bD, cL, dL, rL, rL); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rL[i], cmoveDGTforL(aD[i], bD[i], cL[i], dL[i])); - } - - testCMoveDGTforF(aD, bD, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveDGTforF(aD[i], bD[i], cF[i], dF[i])); - } - - testCMoveDGTforD(aD, bD, cD, dD, rD, rD); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rD[i], cmoveDGTforD(aD[i], bD[i], cD[i], dD[i])); - } - - // Use some constants/invariants in the comparison - testCMoveFGTforFCmpCon1(aF[0], bF, cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveFGTforF(aF[0], bF[i], cF[i], dF[i])); - } - - testCMoveFGTforFCmpCon2(aF, bF[0], cF, dF, rF, rF); - for (int i = 0; i < SIZE; i++) { - Asserts.assertEquals(rF[i], cmoveFGTforF(aF[i], bF[0], cF[i], dF[i])); - } - } - - private static void init(int[] a) { - for (int i = 0; i < SIZE; i++) { - a[i] = RANDOM.nextInt(); - } - } - - private static void init(long[] a) { - for (int i = 0; i < SIZE; i++) { - a[i] = RANDOM.nextLong(); - } - } - - private static void init(float[] a) { - for (int i = 0; i < SIZE; i++) { - a[i] = switch(RANDOM.nextInt() % 20) { - case 0 -> Float.NaN; - case 1 -> 0; - case 2 -> 1; - case 3 -> Float.POSITIVE_INFINITY; - case 4 -> Float.NEGATIVE_INFINITY; - case 5 -> Float.MAX_VALUE; - case 6 -> Float.MIN_VALUE; - case 7, 8, 9 -> RANDOM.nextFloat(); - default -> Float.intBitsToFloat(RANDOM.nextInt()); - }; - } - } - - private static void init(double[] a) { - for (int i = 0; i < SIZE; i++) { - a[i] = switch(RANDOM.nextInt() % 20) { - case 0 -> Double.NaN; - case 1 -> 0; - case 2 -> 1; - case 3 -> Double.POSITIVE_INFINITY; - case 4 -> Double.NEGATIVE_INFINITY; - case 5 -> Double.MAX_VALUE; - case 6 -> Double.MIN_VALUE; - case 7, 8, 9 -> RANDOM.nextDouble(); - default -> Double.longBitsToDouble(RANDOM.nextLong()); - }; - } - } -} From cf9168a24882655f1d6594ba181ccf2f21c5c1e4 Mon Sep 17 00:00:00 2001 From: hamlin Date: Mon, 17 Nov 2025 16:35:19 +0000 Subject: [PATCH 31/32] add BoolTest::ge/gt code and tests --- .../cpu/riscv/c2_MacroAssembler_riscv.cpp | 2 + .../cpu/riscv/macroAssembler_riscv.cpp | 38 + .../cpu/riscv/macroAssembler_riscv.hpp | 2 + .../c2/irTests/TestFPComparison2.java | 1304 ++++++++++++++--- 4 files changed, 1155 insertions(+), 191 deletions(-) diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp index 74e6760a98108..1cbcedeffeb79 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp @@ -2130,6 +2130,7 @@ void C2_MacroAssembler::enc_cmove_fp_cmp_fp(int cmpFlag, cmov_fp_cmp_fp_le(op1, op2, dst, src, cmp_single, cmov_single); break; case BoolTest::ge: + cmov_fp_cmp_fp_ge(op1, op2, dst, src, cmp_single, cmov_single); assert(false, "Should go to BoolTest::le case"); ShouldNotReachHere(); break; @@ -2137,6 +2138,7 @@ void C2_MacroAssembler::enc_cmove_fp_cmp_fp(int cmpFlag, cmov_fp_cmp_fp_lt(op1, op2, dst, src, cmp_single, cmov_single); break; case BoolTest::gt: + cmov_fp_cmp_fp_gt(op1, op2, dst, src, cmp_single, cmov_single); assert(false, "Should go to BoolTest::lt case"); ShouldNotReachHere(); break; diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index f08f15e7531ce..64afe4042712d 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -1580,6 +1580,25 @@ void MacroAssembler::cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, bind(no_set); } +void MacroAssembler::cmov_fp_cmp_fp_ge(FloatRegister cmp1, FloatRegister cmp2, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single) { + Label no_set; + if (cmp_single) { + // jump if cmp1 < cmp2 or either is NaN + // not jump (i.e. move src to dst) if cmp1 >= cmp2 + float_blt(cmp1, cmp2, no_set); + } else { + double_blt(cmp1, cmp2, no_set); + } + if (cmov_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + // When cmp1 < cmp2 or any of them is NaN then dst = src, otherwise, dst = dst // Clarification // scenario 1: @@ -1607,6 +1626,25 @@ void MacroAssembler::cmov_fp_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, bind(no_set); } +void MacroAssembler::cmov_fp_cmp_fp_gt(FloatRegister cmp1, FloatRegister cmp2, + FloatRegister dst, FloatRegister src, + bool cmp_single, bool cmov_single) { + Label no_set; + if (cmp_single) { + // jump if cmp1 <= cmp2 or either is NaN + // not jump (i.e. move src to dst) if cmp1 > cmp2 + float_ble(cmp1, cmp2, no_set); + } else { + double_ble(cmp1, cmp2, no_set); + } + if (cmov_single) { + fmv_s(dst, src); + } else { + fmv_d(dst, src); + } + bind(no_set); +} + // Float compare branch instructions #define INSN(NAME, FLOATCMP, BRANCH) \ diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index ab72a54bf15c7..3b021388fa55a 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -679,7 +679,9 @@ class MacroAssembler: public Assembler { void cmov_fp_cmp_fp_eq(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); void cmov_fp_cmp_fp_ne(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); void cmov_fp_cmp_fp_le(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_ge(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); void cmov_fp_cmp_fp_lt(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); + void cmov_fp_cmp_fp_gt(FloatRegister cmp1, FloatRegister cmp2, FloatRegister dst, FloatRegister src, bool cmp_single, bool cmov_single); public: // We try to follow risc-v asm menomics. diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestFPComparison2.java b/test/hotspot/jtreg/compiler/c2/irTests/TestFPComparison2.java index 59c70b6873fb4..43e34bff93f3b 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestFPComparison2.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestFPComparison2.java @@ -77,18 +77,27 @@ public class TestFPComparison2 { public static void main(String[] args) { List options = List.of("-XX:-TieredCompilation", "-Xlog:jit+compilation=trace"); // Booltest::ge - TestFramework framework = new TestFramework(Test_ge_1.class); + TestFramework + framework = new TestFramework(Test_ge_1.class); + framework.addFlags(options.toArray(new String[0])).start(); + framework = new TestFramework(Test_ge_cmove_fp_1.class); framework.addFlags(options.toArray(new String[0])).start(); framework = new TestFramework(Test_ge_2.class); framework.addFlags(options.toArray(new String[0])).start(); + framework = new TestFramework(Test_ge_cmove_fp_2.class); + framework.addFlags(options.toArray(new String[0])).start(); // Booltest::gt framework = new TestFramework(Test_gt_1.class); framework.addFlags(options.toArray(new String[0])).start(); + framework = new TestFramework(Test_gt_cmove_fp_1.class); + framework.addFlags(options.toArray(new String[0])).start(); framework = new TestFramework(Test_gt_2.class); framework.addFlags(options.toArray(new String[0])).start(); + framework = new TestFramework(Test_gt_cmove_fp_2.class); + framework.addFlags(options.toArray(new String[0])).start(); } } @@ -197,7 +206,920 @@ public void runTests() { int actual = test_float_BoolTest_ge_fixed_1_0(x, y); int expected = golden_float_BoolTest_ge_fixed_1_0(x, y); if (actual != expected) { - System.out.println("Float failed (ge, 1, 0), x: " + x + ", y: " + y + + System.out.println("Float failed (ge, 1, 0), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_1_0(x, y); + int expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 1, 0), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_float_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_double_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} + + +class Test_ge_cmove_fp_1 { + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x > y + // return 0 + // when neither is NaN, and x <= y + return !(x <= y) ? 1.0f : 0.0f; + } + @DontCompile + public static float golden_float_BoolTest_ge_fixed_1_0(float x, float y) { + return !(x <= y) ? 1.0f : 0.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x > y + // return 0 + // when neither is NaN, and x <= y + return !(x <= y) ? 1.0f : 0.0f; + } + @DontCompile + public static float golden_double_BoolTest_ge_fixed_1_0(double x, double y) { + return !(x <= y) ? 1.0f : 0.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x <= y) ? 0.0f : 1.0f; + } + @DontCompile + public static float golden_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x <= y) ? 0.0f : 1.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x <= y) ? 0.0f : 1.0f; + } + @DontCompile + public static float golden_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x <= y) ? 0.0f : 1.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x <= y) ? 10.0f : 20.0f; + } + @DontCompile + public static float golden_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x <= y) ? 10.0f : 20.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x <= y) ? 10.0f : 20.0f; + } + @DontCompile + public static float golden_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x <= y) ? 10.0f : 20.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_variable_results(float x, float y, float a, float b) { + return !(x <= y) ? a : b; + } + @DontCompile + public static float golden_float_BoolTest_ge_variable_results(float x, float y, float a, float b) { + return !(x <= y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_variable_results(double x, double y, float a, float b) { + return !(x <= y) ? a : b; + } + @DontCompile + public static float golden_double_BoolTest_ge_variable_results(double x, double y, float a, float b) { + return !(x <= y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_ge_fixed_1_0", "test_double_BoolTest_ge_fixed_1_0", + "test_float_BoolTest_ge_fixed_0_1", "test_double_BoolTest_ge_fixed_0_1", + "test_float_BoolTest_ge_fixed_10_20", "test_double_BoolTest_ge_fixed_10_20", + "test_float_BoolTest_ge_variable_results", "test_double_BoolTest_ge_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + float actual = test_float_BoolTest_ge_fixed_1_0(x, y); + float expected = golden_float_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 1, 0), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + float actual = test_double_BoolTest_ge_fixed_1_0(x, y); + float expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 1, 0), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + float actual = test_float_BoolTest_ge_fixed_0_1(x, y); + float expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + float actual = test_double_BoolTest_ge_fixed_0_1(x, y); + float expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + float actual = test_float_BoolTest_ge_fixed_10_20(x, y); + float expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + float actual = test_double_BoolTest_ge_fixed_10_20(x, y); + float expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_float_BoolTest_ge_variable_results(x, y, a, b); + float expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_double_BoolTest_ge_variable_results(x, y, a, b); + float expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} + +class Test_ge_2 { + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x < y + // return 0 + // when neither is NaN, and x >= y + return !(x >= y) ? 1 : 0; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_1_0(float x, float y) { + return !(x >= y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x < y + // return 0 + // when neither is NaN, and x >= y + return !(x >= y) ? 1 : 0; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_1_0(double x, double y) { + return !(x >= y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x >= y) ? 0 : 1; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x >= y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x >= y) ? 0 : 1; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x >= y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x >= y) ? 10 : 20; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x >= y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x >= y) ? 10 : 20; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x >= y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { + return !(x >= y) ? a : b; + } + @DontCompile + public static int golden_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { + return !(x >= y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { + return !(x >= y) ? a : b; + } + @DontCompile + public static int golden_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { + return !(x >= y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_ge_fixed_1_0", "test_double_BoolTest_ge_fixed_1_0", + "test_float_BoolTest_ge_fixed_0_1", "test_double_BoolTest_ge_fixed_0_1", + "test_float_BoolTest_ge_fixed_10_20", "test_double_BoolTest_ge_fixed_10_20", + "test_float_BoolTest_ge_variable_results", "test_double_BoolTest_ge_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_1_0(x, y); + int expected = golden_float_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_1_0(x, y); + int expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_float_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_double_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} + +class Test_ge_cmove_fp_2 { + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x < y + // return 0 + // when neither is NaN, and x >= y + return !(x >= y) ? 1.0f : 0.0f; + } + @DontCompile + public static float golden_float_BoolTest_ge_fixed_1_0(float x, float y) { + return !(x >= y) ? 1.0f : 0.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x < y + // return 0 + // when neither is NaN, and x >= y + return !(x >= y) ? 1.0f : 0.0f; + } + @DontCompile + public static float golden_double_BoolTest_ge_fixed_1_0(double x, double y) { + return !(x >= y) ? 1.0f : 0.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x >= y) ? 0.0f : 1.0f; + } + @DontCompile + public static float golden_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x >= y) ? 0.0f : 1.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x >= y) ? 0.0f : 1.0f; + } + @DontCompile + public static float golden_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x >= y) ? 0.0f : 1.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x >= y) ? 10.0f : 20.0f; + } + @DontCompile + public static float golden_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x >= y) ? 10.0f : 20.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x >= y) ? 10.0f : 20.0f; + } + @DontCompile + public static float golden_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x >= y) ? 10.0f : 20.0f; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_ge_variable_results(float x, float y, float a, float b) { + return !(x >= y) ? a : b; + } + @DontCompile + public static float golden_float_BoolTest_ge_variable_results(float x, float y, float a, float b) { + return !(x >= y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_ge_variable_results(double x, double y, float a, float b) { + return !(x >= y) ? a : b; + } + @DontCompile + public static float golden_double_BoolTest_ge_variable_results(double x, double y, float a, float b) { + return !(x >= y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_ge_fixed_1_0", "test_double_BoolTest_ge_fixed_1_0", + "test_float_BoolTest_ge_fixed_0_1", "test_double_BoolTest_ge_fixed_0_1", + "test_float_BoolTest_ge_fixed_10_20", "test_double_BoolTest_ge_fixed_10_20", + "test_float_BoolTest_ge_variable_results", "test_double_BoolTest_ge_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + float actual = test_float_BoolTest_ge_fixed_1_0(x, y); + float expected = golden_float_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + float actual = test_double_BoolTest_ge_fixed_1_0(x, y); + float expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + float actual = test_float_BoolTest_ge_fixed_0_1(x, y); + float expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + float actual = test_double_BoolTest_ge_fixed_0_1(x, y); + float expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + float actual = test_float_BoolTest_ge_fixed_10_20(x, y); + float expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + float actual = test_double_BoolTest_ge_fixed_10_20(x, y); + float expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_float_BoolTest_ge_variable_results(x, y, a, b); + float expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_double_BoolTest_ge_variable_results(x, y, a, b); + float expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} + +class Test_gt_1 { + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x >= y + // return 0 + // when neither is NaN, and x < y + return !(x < y) ? 1 : 0; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_1_0(float x, float y) { + return !(x < y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x >= y + // return 0 + // when neither is NaN, and x < y + return !(x < y) ? 1 : 0; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_1_0(double x, double y) { + return !(x < y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x < y) ? 0 : 1; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x < y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x < y) ? 0 : 1; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x < y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x < y) ? 10 : 20; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x < y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x < y) ? 10 : 20; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x < y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + return !(x < y) ? a : b; + } + @DontCompile + public static int golden_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + return !(x < y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + return !(x < y) ? a : b; + } + @DontCompile + public static int golden_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + return !(x < y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_gt_fixed_1_0", "test_double_BoolTest_gt_fixed_1_0", + "test_float_BoolTest_gt_fixed_0_1", "test_double_BoolTest_gt_fixed_0_1", + "test_float_BoolTest_gt_fixed_10_20", "test_double_BoolTest_gt_fixed_10_20", + "test_float_BoolTest_gt_variable_results", "test_double_BoolTest_gt_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_gt_fixed_1_0(x, y); + int expected = golden_float_BoolTest_gt_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -208,10 +1130,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_ge_fixed_1_0(x, y); - int expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + int actual = test_double_BoolTest_gt_fixed_1_0(x, y); + int expected = golden_double_BoolTest_gt_fixed_1_0(x, y); if (actual != expected) { - System.out.println("Double failed (ge, 1, 0), x: " + x + ", y: " + y + + System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -222,10 +1144,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_ge_fixed_0_1(x, y); - int expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + int actual = test_float_BoolTest_gt_fixed_0_1(x, y); + int expected = golden_float_BoolTest_gt_fixed_0_1(x, y); if (actual != expected) { - System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + System.out.println("Float failed (gt, 0, 1), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -236,10 +1158,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_ge_fixed_0_1(x, y); - int expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + int actual = test_double_BoolTest_gt_fixed_0_1(x, y); + int expected = golden_double_BoolTest_gt_fixed_0_1(x, y); if (actual != expected) { - System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + System.out.println("Double failed (gt, 0, 1), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -250,10 +1172,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_ge_fixed_10_20(x, y); - int expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + int actual = test_float_BoolTest_gt_fixed_10_20(x, y); + int expected = golden_float_BoolTest_gt_fixed_10_20(x, y); if (actual != expected) { - System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + System.out.println("Float failed (gt, 10, 20), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -264,10 +1186,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_ge_fixed_10_20(x, y); - int expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + int actual = test_double_BoolTest_gt_fixed_10_20(x, y); + int expected = golden_double_BoolTest_gt_fixed_10_20(x, y); if (actual != expected) { - System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + System.out.println("Double failed (gt, 10, 20), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -282,10 +1204,10 @@ public void runTests() { for (int n = 0; n < TestFPComparison2.INTS.length; n++) { int a = TestFPComparison2.INTS[m]; int b = TestFPComparison2.INTS[n]; - int actual = test_float_BoolTest_ge_variable_results(x, y, a, b); - int expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); + int actual = test_float_BoolTest_gt_variable_results(x, y, a, b); + int expected = golden_float_BoolTest_gt_variable_results(x, y, a, b); if (actual != expected) { - System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + ", actual: " + actual + ", expected: " + expected); err++; } @@ -302,10 +1224,10 @@ public void runTests() { for (int n = 0; n < TestFPComparison2.INTS.length; n++) { int a = TestFPComparison2.INTS[m]; int b = TestFPComparison2.INTS[n]; - int actual = test_double_BoolTest_ge_variable_results(x, y, a, b); - int expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); + int actual = test_double_BoolTest_gt_variable_results(x, y, a, b); + int expected = golden_double_BoolTest_gt_variable_results(x, y, a, b); if (actual != expected) { - System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + ", actual: " + actual + ", expected: " + expected); err++; } @@ -320,101 +1242,101 @@ public void runTests() { } } -class Test_ge_2 { +class Test_gt_cmove_fp_1 { @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_ge_fixed_1_0(float x, float y) { + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_fixed_1_0(float x, float y) { // return 1 // when either x or y is NaN - // when neither is NaN, and x < y - // return 0 // when neither is NaN, and x >= y - return !(x >= y) ? 1 : 0; + // return 0 + // when neither is NaN, and x < y + return !(x < y) ? 1.0f : 0.0f; } @DontCompile - public static int golden_float_BoolTest_ge_fixed_1_0(float x, float y) { - return !(x >= y) ? 1 : 0; + public static float golden_float_BoolTest_gt_fixed_1_0(float x, float y) { + return !(x < y) ? 1.0f : 0.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_ge_fixed_1_0(double x, double y) { + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_fixed_1_0(double x, double y) { // return 1 // when either x or y is NaN - // when neither is NaN, and x < y - // return 0 // when neither is NaN, and x >= y - return !(x >= y) ? 1 : 0; + // return 0 + // when neither is NaN, and x < y + return !(x < y) ? 1.0f : 0.0f; } @DontCompile - public static int golden_double_BoolTest_ge_fixed_1_0(double x, double y) { - return !(x >= y) ? 1 : 0; + public static float golden_double_BoolTest_gt_fixed_1_0(double x, double y) { + return !(x < y) ? 1.0f : 0.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_ge_fixed_0_1(float x, float y) { - return !(x >= y) ? 0 : 1; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x < y) ? 0.0f : 1.0f; } @DontCompile - public static int golden_float_BoolTest_ge_fixed_0_1(float x, float y) { - return !(x >= y) ? 0 : 1; + public static float golden_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x < y) ? 0.0f : 1.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_ge_fixed_0_1(double x, double y) { - return !(x >= y) ? 0 : 1; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x < y) ? 0.0f : 1.0f; } @DontCompile - public static int golden_double_BoolTest_ge_fixed_0_1(double x, double y) { - return !(x >= y) ? 0 : 1; + public static float golden_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x < y) ? 0.0f : 1.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_ge_fixed_10_20(float x, float y) { - return !(x >= y) ? 10 : 20; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x < y) ? 10.0f : 20.0f; } @DontCompile - public static int golden_float_BoolTest_ge_fixed_10_20(float x, float y) { - return !(x >= y) ? 10 : 20; + public static float golden_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x < y) ? 10.0f : 20.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_ge_fixed_10_20(double x, double y) { - return !(x >= y) ? 10 : 20; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x < y) ? 10.0f : 20.0f; } @DontCompile - public static int golden_double_BoolTest_ge_fixed_10_20(double x, double y) { - return !(x >= y) ? 10 : 20; + public static float golden_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x < y) ? 10.0f : 20.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { - return !(x >= y) ? a : b; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_variable_results(float x, float y, float a, float b) { + return !(x < y) ? a : b; } @DontCompile - public static int golden_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { - return !(x >= y) ? a : b; + public static float golden_float_BoolTest_gt_variable_results(float x, float y, float a, float b) { + return !(x < y) ? a : b; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { - return !(x >= y) ? a : b; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_variable_results(double x, double y, float a, float b) { + return !(x < y) ? a : b; } @DontCompile - public static int golden_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { - return !(x >= y) ? a : b; + public static float golden_double_BoolTest_gt_variable_results(double x, double y, float a, float b) { + return !(x < y) ? a : b; } - @Run(test = {"test_float_BoolTest_ge_fixed_1_0", "test_double_BoolTest_ge_fixed_1_0", - "test_float_BoolTest_ge_fixed_0_1", "test_double_BoolTest_ge_fixed_0_1", - "test_float_BoolTest_ge_fixed_10_20", "test_double_BoolTest_ge_fixed_10_20", - "test_float_BoolTest_ge_variable_results", "test_double_BoolTest_ge_variable_results"}) + @Run(test = {"test_float_BoolTest_gt_fixed_1_0", "test_double_BoolTest_gt_fixed_1_0", + "test_float_BoolTest_gt_fixed_0_1", "test_double_BoolTest_gt_fixed_0_1", + "test_float_BoolTest_gt_fixed_10_20", "test_double_BoolTest_gt_fixed_10_20", + "test_float_BoolTest_gt_variable_results", "test_double_BoolTest_gt_variable_results"}) public void runTests() { int err = 0; @@ -422,10 +1344,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_ge_fixed_1_0(x, y); - int expected = golden_float_BoolTest_ge_fixed_1_0(x, y); + float actual = test_float_BoolTest_gt_fixed_1_0(x, y); + float expected = golden_float_BoolTest_gt_fixed_1_0(x, y); if (actual != expected) { - System.out.println("Float failed (ge), x: " + x + ", y: " + y + + System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -436,10 +1358,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_ge_fixed_1_0(x, y); - int expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + float actual = test_double_BoolTest_gt_fixed_1_0(x, y); + float expected = golden_double_BoolTest_gt_fixed_1_0(x, y); if (actual != expected) { - System.out.println("Double failed (ge), x: " + x + ", y: " + y + + System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -450,10 +1372,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_ge_fixed_0_1(x, y); - int expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + float actual = test_float_BoolTest_gt_fixed_0_1(x, y); + float expected = golden_float_BoolTest_gt_fixed_0_1(x, y); if (actual != expected) { - System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + System.out.println("Float failed (gt, 0, 1), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -464,10 +1386,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_ge_fixed_0_1(x, y); - int expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + float actual = test_double_BoolTest_gt_fixed_0_1(x, y); + float expected = golden_double_BoolTest_gt_fixed_0_1(x, y); if (actual != expected) { - System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + System.out.println("Double failed (gt, 0, 1), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -478,10 +1400,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_ge_fixed_10_20(x, y); - int expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + float actual = test_float_BoolTest_gt_fixed_10_20(x, y); + float expected = golden_float_BoolTest_gt_fixed_10_20(x, y); if (actual != expected) { - System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + System.out.println("Float failed (gt, 10, 20), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -492,10 +1414,10 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_ge_fixed_10_20(x, y); - int expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + float actual = test_double_BoolTest_gt_fixed_10_20(x, y); + float expected = golden_double_BoolTest_gt_fixed_10_20(x, y); if (actual != expected) { - System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + System.out.println("Double failed (gt, 10, 20), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); err++; } @@ -506,14 +1428,14 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - for (int m = 0; m < TestFPComparison2.INTS.length; m++) { - for (int n = 0; n < TestFPComparison2.INTS.length; n++) { - int a = TestFPComparison2.INTS[m]; - int b = TestFPComparison2.INTS[n]; - int actual = test_float_BoolTest_ge_variable_results(x, y, a, b); - int expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); - if (actual != expected) { - System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_float_BoolTest_gt_variable_results(x, y, a, b); + float expected = golden_float_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { + System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + ", actual: " + actual + ", expected: " + expected); err++; } @@ -526,14 +1448,14 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - for (int m = 0; m < TestFPComparison2.INTS.length; m++) { - for (int n = 0; n < TestFPComparison2.INTS.length; n++) { - int a = TestFPComparison2.INTS[m]; - int b = TestFPComparison2.INTS[n]; - int actual = test_double_BoolTest_ge_variable_results(x, y, a, b); - int expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); - if (actual != expected) { - System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_double_BoolTest_gt_variable_results(x, y, a, b); + float expected = golden_double_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { + System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + ", actual: " + actual + ", expected: " + expected); err++; } @@ -548,20 +1470,20 @@ public void runTests() { } } -class Test_gt_1 { +class Test_gt_2 { @Test @IR(counts = {IRNode.CMOVE_I, "1"}) public static int test_float_BoolTest_gt_fixed_1_0(float x, float y) { // return 1 // when either x or y is NaN - // when neither is NaN, and x >= y + // when neither is NaN, and x <= y // return 0 - // when neither is NaN, and x < y - return !(x < y) ? 1 : 0; + // when neither is NaN, and x > y + return !(x > y) ? 1 : 0; } @DontCompile public static int golden_float_BoolTest_gt_fixed_1_0(float x, float y) { - return !(x < y) ? 1 : 0; + return !(x > y) ? 1 : 0; } @Test @@ -569,74 +1491,74 @@ public static int golden_float_BoolTest_gt_fixed_1_0(float x, float y) { public static int test_double_BoolTest_gt_fixed_1_0(double x, double y) { // return 1 // when either x or y is NaN - // when neither is NaN, and x >= y + // when neither is NaN, and x <= y // return 0 - // when neither is NaN, and x < y - return !(x < y) ? 1 : 0; + // when neither is NaN, and x > y + return !(x > y) ? 1 : 0; } @DontCompile public static int golden_double_BoolTest_gt_fixed_1_0(double x, double y) { - return !(x < y) ? 1 : 0; + return !(x > y) ? 1 : 0; } @Test @IR(counts = {IRNode.CMOVE_I, "1"}) public static int test_float_BoolTest_gt_fixed_0_1(float x, float y) { - return !(x < y) ? 0 : 1; + return !(x > y) ? 0 : 1; } @DontCompile public static int golden_float_BoolTest_gt_fixed_0_1(float x, float y) { - return !(x < y) ? 0 : 1; + return !(x > y) ? 0 : 1; } @Test @IR(counts = {IRNode.CMOVE_I, "1"}) public static int test_double_BoolTest_gt_fixed_0_1(double x, double y) { - return !(x < y) ? 0 : 1; + return !(x > y) ? 0 : 1; } @DontCompile public static int golden_double_BoolTest_gt_fixed_0_1(double x, double y) { - return !(x < y) ? 0 : 1; + return !(x > y) ? 0 : 1; } @Test @IR(counts = {IRNode.CMOVE_I, "1"}) public static int test_float_BoolTest_gt_fixed_10_20(float x, float y) { - return !(x < y) ? 10 : 20; + return !(x > y) ? 10 : 20; } @DontCompile public static int golden_float_BoolTest_gt_fixed_10_20(float x, float y) { - return !(x < y) ? 10 : 20; + return !(x > y) ? 10 : 20; } @Test @IR(counts = {IRNode.CMOVE_I, "1"}) public static int test_double_BoolTest_gt_fixed_10_20(double x, double y) { - return !(x < y) ? 10 : 20; + return !(x > y) ? 10 : 20; } @DontCompile public static int golden_double_BoolTest_gt_fixed_10_20(double x, double y) { - return !(x < y) ? 10 : 20; + return !(x > y) ? 10 : 20; } @Test @IR(counts = {IRNode.CMOVE_I, "1"}) public static int test_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { - return !(x < y) ? a : b; + return !(x > y) ? a : b; } @DontCompile public static int golden_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { - return !(x < y) ? a : b; + return !(x > y) ? a : b; } @Test @IR(counts = {IRNode.CMOVE_I, "1"}) public static int test_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { - return !(x < y) ? a : b; + return !(x > y) ? a : b; } @DontCompile public static int golden_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { - return !(x < y) ? a : b; + return !(x > y) ? a : b; } @Run(test = {"test_float_BoolTest_gt_fixed_1_0", "test_double_BoolTest_gt_fixed_1_0", @@ -776,94 +1698,94 @@ public void runTests() { } } -class Test_gt_2 { +class Test_gt_cmove_fp_2 { @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_gt_fixed_1_0(float x, float y) { + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_fixed_1_0(float x, float y) { // return 1 // when either x or y is NaN // when neither is NaN, and x <= y // return 0 // when neither is NaN, and x > y - return !(x > y) ? 1 : 0; + return !(x > y) ? 1.0f : 0.0f; } @DontCompile - public static int golden_float_BoolTest_gt_fixed_1_0(float x, float y) { - return !(x > y) ? 1 : 0; + public static float golden_float_BoolTest_gt_fixed_1_0(float x, float y) { + return !(x > y) ? 1.0f : 0.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_gt_fixed_1_0(double x, double y) { + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_fixed_1_0(double x, double y) { // return 1 // when either x or y is NaN // when neither is NaN, and x <= y // return 0 // when neither is NaN, and x > y - return !(x > y) ? 1 : 0; + return !(x > y) ? 1.0f : 0.0f; } @DontCompile - public static int golden_double_BoolTest_gt_fixed_1_0(double x, double y) { - return !(x > y) ? 1 : 0; + public static float golden_double_BoolTest_gt_fixed_1_0(double x, double y) { + return !(x > y) ? 1.0f : 0.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_gt_fixed_0_1(float x, float y) { - return !(x > y) ? 0 : 1; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x > y) ? 0.0f : 1.0f; } @DontCompile - public static int golden_float_BoolTest_gt_fixed_0_1(float x, float y) { - return !(x > y) ? 0 : 1; + public static float golden_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x > y) ? 0.0f : 1.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_gt_fixed_0_1(double x, double y) { - return !(x > y) ? 0 : 1; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x > y) ? 0.0f : 1.0f; } @DontCompile - public static int golden_double_BoolTest_gt_fixed_0_1(double x, double y) { - return !(x > y) ? 0 : 1; + public static float golden_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x > y) ? 0.0f : 1.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_gt_fixed_10_20(float x, float y) { - return !(x > y) ? 10 : 20; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x > y) ? 10.0f : 20.0f; } @DontCompile - public static int golden_float_BoolTest_gt_fixed_10_20(float x, float y) { - return !(x > y) ? 10 : 20; + public static float golden_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x > y) ? 10.0f : 20.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_gt_fixed_10_20(double x, double y) { - return !(x > y) ? 10 : 20; + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x > y) ? 10.0f : 20.0f; } @DontCompile - public static int golden_double_BoolTest_gt_fixed_10_20(double x, double y) { - return !(x > y) ? 10 : 20; + public static float golden_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x > y) ? 10.0f : 20.0f; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_float_BoolTest_gt_variable_results(float x, float y, float a, float b) { return !(x > y) ? a : b; } @DontCompile - public static int golden_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + public static float golden_float_BoolTest_gt_variable_results(float x, float y, float a, float b) { return !(x > y) ? a : b; } @Test - @IR(counts = {IRNode.CMOVE_I, "1"}) - public static int test_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + @IR(counts = {IRNode.CMOVE_F, "1"}) + public static float test_double_BoolTest_gt_variable_results(double x, double y, float a, float b) { return !(x > y) ? a : b; } @DontCompile - public static int golden_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + public static float golden_double_BoolTest_gt_variable_results(double x, double y, float a, float b) { return !(x > y) ? a : b; } @@ -878,8 +1800,8 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_gt_fixed_1_0(x, y); - int expected = golden_float_BoolTest_gt_fixed_1_0(x, y); + float actual = test_float_BoolTest_gt_fixed_1_0(x, y); + float expected = golden_float_BoolTest_gt_fixed_1_0(x, y); if (actual != expected) { System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); @@ -892,8 +1814,8 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_gt_fixed_1_0(x, y); - int expected = golden_double_BoolTest_gt_fixed_1_0(x, y); + float actual = test_double_BoolTest_gt_fixed_1_0(x, y); + float expected = golden_double_BoolTest_gt_fixed_1_0(x, y); if (actual != expected) { System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); @@ -906,8 +1828,8 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_gt_fixed_0_1(x, y); - int expected = golden_float_BoolTest_gt_fixed_0_1(x, y); + float actual = test_float_BoolTest_gt_fixed_0_1(x, y); + float expected = golden_float_BoolTest_gt_fixed_0_1(x, y); if (actual != expected) { System.out.println("Float failed (gt, 0, 1), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); @@ -920,8 +1842,8 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_gt_fixed_0_1(x, y); - int expected = golden_double_BoolTest_gt_fixed_0_1(x, y); + float actual = test_double_BoolTest_gt_fixed_0_1(x, y); + float expected = golden_double_BoolTest_gt_fixed_0_1(x, y); if (actual != expected) { System.out.println("Double failed (gt, 0, 1), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); @@ -934,8 +1856,8 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - int actual = test_float_BoolTest_gt_fixed_10_20(x, y); - int expected = golden_float_BoolTest_gt_fixed_10_20(x, y); + float actual = test_float_BoolTest_gt_fixed_10_20(x, y); + float expected = golden_float_BoolTest_gt_fixed_10_20(x, y); if (actual != expected) { System.out.println("Float failed (gt, 10, 20), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); @@ -948,8 +1870,8 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - int actual = test_double_BoolTest_gt_fixed_10_20(x, y); - int expected = golden_double_BoolTest_gt_fixed_10_20(x, y); + float actual = test_double_BoolTest_gt_fixed_10_20(x, y); + float expected = golden_double_BoolTest_gt_fixed_10_20(x, y); if (actual != expected) { System.out.println("Double failed (gt, 10, 20), x: " + x + ", y: " + y + ", actual: " + actual + ", expected: " + expected); @@ -962,13 +1884,13 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { float x = TestFPComparison2.FLOATS[i]; float y = TestFPComparison2.FLOATS[j]; - for (int m = 0; m < TestFPComparison2.INTS.length; m++) { - for (int n = 0; n < TestFPComparison2.INTS.length; n++) { - int a = TestFPComparison2.INTS[m]; - int b = TestFPComparison2.INTS[n]; - int actual = test_float_BoolTest_gt_variable_results(x, y, a, b); - int expected = golden_float_BoolTest_gt_variable_results(x, y, a, b); - if (actual != expected) { + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_float_BoolTest_gt_variable_results(x, y, a, b); + float expected = golden_float_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + ", actual: " + actual + ", expected: " + expected); err++; @@ -982,13 +1904,13 @@ public void runTests() { for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { double x = TestFPComparison2.DOUBLES[i]; double y = TestFPComparison2.DOUBLES[j]; - for (int m = 0; m < TestFPComparison2.INTS.length; m++) { - for (int n = 0; n < TestFPComparison2.INTS.length; n++) { - int a = TestFPComparison2.INTS[m]; - int b = TestFPComparison2.INTS[n]; - int actual = test_double_BoolTest_gt_variable_results(x, y, a, b); - int expected = golden_double_BoolTest_gt_variable_results(x, y, a, b); - if (actual != expected) { + for (int m = 0; m < TestFPComparison2.FLOATS.length; m++) { + for (int n = 0; n < TestFPComparison2.FLOATS.length; n++) { + float a = TestFPComparison2.FLOATS[m]; + float b = TestFPComparison2.FLOATS[n]; + float actual = test_double_BoolTest_gt_variable_results(x, y, a, b); + float expected = golden_double_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected && !Float.isNaN(actual) && !Float.isNaN(expected)) { System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + ", actual: " + actual + ", expected: " + expected); err++; @@ -1002,4 +1924,4 @@ public void runTests() { throw new RuntimeException("Some tests failed"); } } -} +} \ No newline at end of file From 572a7b745fbff6410b1f8244df2b4d8512ece36b Mon Sep 17 00:00:00 2001 From: hamlin Date: Tue, 18 Nov 2025 09:18:42 +0000 Subject: [PATCH 32/32] replace assert with log_warning --- src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp index 1cbcedeffeb79..abcf0db2585ec 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp @@ -2131,16 +2131,14 @@ void C2_MacroAssembler::enc_cmove_fp_cmp_fp(int cmpFlag, break; case BoolTest::ge: cmov_fp_cmp_fp_ge(op1, op2, dst, src, cmp_single, cmov_single); - assert(false, "Should go to BoolTest::le case"); - ShouldNotReachHere(); + log_warning(jit)("Float/Double BoolTest::ge path is not tested well, please report the test case!"); break; case BoolTest::lt: cmov_fp_cmp_fp_lt(op1, op2, dst, src, cmp_single, cmov_single); break; case BoolTest::gt: cmov_fp_cmp_fp_gt(op1, op2, dst, src, cmp_single, cmov_single); - assert(false, "Should go to BoolTest::lt case"); - ShouldNotReachHere(); + log_warning(jit)("Float/Double BoolTest::gt path is not tested well, please report the test case!"); break; default: assert(false, "unsupported compare condition");