diff --git a/src/hotspot/cpu/x86/matcher_x86.hpp b/src/hotspot/cpu/x86/matcher_x86.hpp index b311f4144b2bf..ab5c72e8f7b39 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -263,7 +263,7 @@ // Is SIMD sort supported for this CPU? static bool supports_simd_sort(BasicType bt) { - if (VM_Version::supports_avx512dq()) { + if (VM_Version::supports_avx512_simd_sort()) { return true; } else if (VM_Version::supports_avx2() && !is_double_word_type(bt)) { diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index d2a0c81b2c98a..2cf0bd71993a4 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -4315,7 +4315,7 @@ void StubGenerator::generate_compiler_stubs() { // Load x86_64_sort library on supported hardware to enable SIMD sort and partition intrinsics - if (VM_Version::is_intel() && (VM_Version::supports_avx512dq() || VM_Version::supports_avx2())) { + if (VM_Version::supports_avx512dq() || VM_Version::supports_avx2()) { void *libsimdsort = nullptr; char ebuf_[1024]; char dll_name_simd_sort[JVM_MAXPATHLEN]; @@ -4326,10 +4326,10 @@ void StubGenerator::generate_compiler_stubs() { if (libsimdsort != nullptr) { log_info(library)("Loaded library %s, handle " INTPTR_FORMAT, JNI_LIB_PREFIX "simdsort" JNI_LIB_SUFFIX, p2i(libsimdsort)); - snprintf(ebuf_, sizeof(ebuf_), VM_Version::supports_avx512dq() ? "avx512_sort" : "avx2_sort"); + snprintf(ebuf_, sizeof(ebuf_), VM_Version::supports_avx512_simd_sort() ? "avx512_sort" : "avx2_sort"); StubRoutines::_array_sort = (address)os::dll_lookup(libsimdsort, ebuf_); - snprintf(ebuf_, sizeof(ebuf_), VM_Version::supports_avx512dq() ? "avx512_partition" : "avx2_partition"); + snprintf(ebuf_, sizeof(ebuf_), VM_Version::supports_avx512_simd_sort() ? "avx512_partition" : "avx2_partition"); StubRoutines::_array_partition = (address)os::dll_lookup(libsimdsort, ebuf_); } } diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index 9bd3116cf84de..cc5c6c1c63992 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp @@ -432,6 +432,8 @@ class VM_Version : public Abstract_VM_Version { enum Extended_Family { // AMD CPU_FAMILY_AMD_11H = 0x11, + CPU_FAMILY_AMD_17H = 0x17, /* Zen1 & Zen2 */ + CPU_FAMILY_AMD_19H = 0x19, /* Zen3 & Zen4 */ // ZX CPU_FAMILY_ZX_CORE_F6 = 6, CPU_FAMILY_ZX_CORE_F7 = 7, @@ -771,6 +773,17 @@ class VM_Version : public Abstract_VM_Version { // static bool cpu_supports_evex() { return (_cpu_features & CPU_AVX512F) != 0; } + static bool supports_avx512_simd_sort() { + if (supports_avx512dq()) { + // Disable AVX512 version of SIMD Sort on AMD Zen4 Processors. + if (is_amd() && cpu_family() == CPU_FAMILY_AMD_19H) { + return false; + } + return true; + } + return false; + } + // Intel features static bool is_intel_family_core() { return is_intel() && extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }