diff --git a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp index 0fbc2ef141e8b..49eae1cc438a1 100644 --- a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp @@ -204,4 +204,9 @@ static bool is_feat_fp16_supported() { 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 66fe8ac330eb5..28e9caf1ab084 100644 --- a/src/hotspot/cpu/arm/matcher_arm.hpp +++ b/src/hotspot/cpu/arm/matcher_arm.hpp @@ -193,4 +193,8 @@ 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 aad41fb7b1cf0..987b959aa3b43 100644 --- a/src/hotspot/cpu/ppc/matcher_ppc.hpp +++ b/src/hotspot/cpu/ppc/matcher_ppc.hpp @@ -203,4 +203,8 @@ 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 1b490a07f92a6..f3084758b28e8 100644 --- a/src/hotspot/cpu/riscv/matcher_riscv.hpp +++ b/src/hotspot/cpu/riscv/matcher_riscv.hpp @@ -199,4 +199,8 @@ return false; } + static bool supports_vector_different_use_def_size() { + 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..8ab5587aaba20 100644 --- a/src/hotspot/cpu/s390/matcher_s390.hpp +++ b/src/hotspot/cpu/s390/matcher_s390.hpp @@ -196,4 +196,8 @@ 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 41486c244b247..d12cb7cb84276 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -236,4 +236,8 @@ } } + 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 7a2e6bc7fbd02..1c0fd736f0cdd 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2307,8 +2307,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); + // 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; } // Return nullptr if success, else failure message diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 6ae8bbe8aa0af..b6480c3a9652a 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -406,6 +406,10 @@ 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: @@ -2302,6 +2306,7 @@ 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() && diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index 427aeff53fcf9..aba825081474e 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); + // 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.