8319781: RISC-V: Refactor UseRVV related checks

Reviewed-by: rehn, fyang
This commit is contained in:
Hamlin Li 2023-11-15 09:51:14 +00:00
parent bad6999634
commit fac6b51699
2 changed files with 24 additions and 32 deletions

View File

@ -1888,17 +1888,13 @@ bool Matcher::match_rule_supported(int opcode) {
}
break;
case Op_CompressBits: // fall through
guarantee(UseRVV == (MaxVectorSize >= 16), "UseRVV and MaxVectorSize not matched");
case Op_StrCompressedCopy: // fall through
case Op_StrInflatedCopy: // fall through
case Op_CountPositives:
return UseRVV;
case Op_CompressBits:
guarantee(UseRVV == (MaxVectorSize >= 16), "UseRVV and MaxVectorSize not matched");
return UseRVV;
case Op_CountPositives: // fall through
case Op_EncodeISOArray:
return UseRVV && SpecialEncodeISOArray;
return UseRVV;
case Op_PopCountI:
case Op_PopCountL:

View File

@ -199,16 +199,6 @@ void VM_Version::initialize() {
FLAG_SET_DEFAULT(UseSignumIntrinsic, true);
}
if (UseRVV) {
if (!ext_V.enabled()) {
warning("RVV is not supported on this CPU");
FLAG_SET_DEFAULT(UseRVV, false);
} else {
// read vector length from vector CSR vlenb
_initial_vector_length = cpu_vector_length();
}
}
if (UseRVC && !ext_C.enabled()) {
warning("RVC is not supported on this CPU");
FLAG_SET_DEFAULT(UseRVC, false);
@ -261,6 +251,25 @@ void VM_Version::initialize() {
warning("Block zeroing is not available");
FLAG_SET_DEFAULT(UseBlockZeroing, false);
}
if (UseRVV) {
if (!ext_V.enabled()) {
warning("RVV is not supported on this CPU");
FLAG_SET_DEFAULT(UseRVV, false);
} else {
// read vector length from vector CSR vlenb
_initial_vector_length = cpu_vector_length();
}
}
#ifdef COMPILER2
c2_initialize();
#endif // COMPILER2
// NOTE: Make sure codes dependent on UseRVV are put after c2_initialize(),
// as there are extra checks inside it which could disable UseRVV
// in some situations.
if (UseRVV) {
if (FLAG_IS_DEFAULT(UseChaCha20Intrinsics)) {
FLAG_SET_DEFAULT(UseChaCha20Intrinsics, true);
@ -271,10 +280,6 @@ void VM_Version::initialize() {
}
FLAG_SET_DEFAULT(UseChaCha20Intrinsics, false);
}
#ifdef COMPILER2
c2_initialize();
#endif // COMPILER2
}
#ifdef COMPILER2
@ -288,18 +293,9 @@ void VM_Version::c2_initialize() {
}
if (!UseRVV) {
FLAG_SET_DEFAULT(SpecialEncodeISOArray, false);
}
if (!UseRVV && MaxVectorSize) {
FLAG_SET_DEFAULT(MaxVectorSize, 0);
}
if (!UseRVV) {
FLAG_SET_DEFAULT(UseRVVForBigIntegerShiftIntrinsics, false);
}
if (UseRVV) {
} else {
if (FLAG_IS_DEFAULT(MaxVectorSize)) {
MaxVectorSize = _initial_vector_length;
} else if (!is_power_of_2(MaxVectorSize)) {