Skip to content

Commit 2c1e4c3

Browse files
author
Hamlin Li
committed
8343600: RISC-V: enable CRC32 intrinsic when either Zba or RVV are supported
Reviewed-by: fyang
1 parent 3727f40 commit 2c1e4c3

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/hotspot/cpu/riscv/vm_version_riscv.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,6 @@ void VM_Version::common_initialize() {
122122
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 0);
123123
}
124124

125-
if (UseZba) {
126-
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
127-
FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
128-
}
129-
} else {
130-
if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
131-
warning("CRC32 intrinsic requires Zba instructions (not available on this CPU)");
132-
}
133-
FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
134-
}
135-
136-
if (UseCRC32CIntrinsics) {
137-
warning("CRC32C intrinsics are not available on this CPU.");
138-
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
139-
}
140-
141125
if (UseVectorizedMismatchIntrinsic) {
142126
warning("VectorizedMismatch intrinsic is not available on this CPU.");
143127
FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
@@ -217,6 +201,24 @@ void VM_Version::common_initialize() {
217201
_initial_vector_length = cpu_vector_length();
218202
}
219203
}
204+
205+
// Misc Intrinsics could depend on RVV
206+
207+
if (UseZba || UseRVV) {
208+
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
209+
FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
210+
}
211+
} else {
212+
if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
213+
warning("CRC32 intrinsic requires Zba or RVV instructions (not available on this CPU)");
214+
}
215+
FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
216+
}
217+
218+
if (UseCRC32CIntrinsics) {
219+
warning("CRC32C intrinsics are not available on this CPU.");
220+
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
221+
}
220222
}
221223

222224
#ifdef COMPILER2

0 commit comments

Comments
 (0)