8317763: Follow-up to AVX512 intrinsics for Arrays.sort() PR

Reviewed-by: jbhateja, kvn, ihse, sviswanathan
This commit is contained in:
vamsi-parasa 2023-10-12 04:45:19 +00:00 committed by Vladimir Kozlov
parent 839cb19ec2
commit 2edf9c3f1e
4 changed files with 19 additions and 10 deletions

View File

@ -4173,7 +4173,7 @@ void StubGenerator::generate_compiler_stubs() {
} }
// Load x86_64_sort library on supported hardware to enable avx512 sort and partition intrinsics // Load x86_64_sort library on supported hardware to enable avx512 sort and partition intrinsics
if (UseAVX > 2 && VM_Version::supports_avx512dq()) { if (VM_Version::is_intel() && VM_Version::supports_avx512dq()) {
void *libsimdsort = nullptr; void *libsimdsort = nullptr;
char ebuf_[1024]; char ebuf_[1024];
char dll_name_simd_sort[JVM_MAXPATHLEN]; char dll_name_simd_sort[JVM_MAXPATHLEN];

View File

@ -57,9 +57,18 @@
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <immintrin.h>
#include <limits> #include <limits>
/*
Workaround for the bug in GCC12 (that was fixed in GCC 12.3.1).
More details are available at: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wuninitialized"
#include <immintrin.h>
#pragma GCC diagnostic pop
#define X86_SIMD_SORT_INFINITY std::numeric_limits<double>::infinity() #define X86_SIMD_SORT_INFINITY std::numeric_limits<double>::infinity()
#define X86_SIMD_SORT_INFINITYF std::numeric_limits<float>::infinity() #define X86_SIMD_SORT_INFINITYF std::numeric_limits<float>::infinity()
#define X86_SIMD_SORT_INFINITYH 0x7c00 #define X86_SIMD_SORT_INFINITYH 0x7c00

View File

@ -166,9 +166,9 @@ final class DualPivotQuicksort {
/** /**
* Partitions the specified range of the array using the given pivots. * Partitions the specified range of the array using the given pivots.
* *
* @param a the array to be sorted * @param a the array to be partitioned
* @param low the index of the first element, inclusive, to be sorted * @param low the index of the first element, inclusive, to be partitioned
* @param high the index of the last element, exclusive, to be sorted * @param high the index of the last element, exclusive, to be partitioned
* @param pivotIndex1 the index of pivot1, the first pivot * @param pivotIndex1 the index of pivot1, the first pivot
* @param pivotIndex2 the index of pivot2, the second pivot * @param pivotIndex2 the index of pivot2, the second pivot
*/ */
@ -178,13 +178,13 @@ final class DualPivotQuicksort {
/** /**
* Partitions the specified range of the array using the two pivots provided. * Partitions the specified range of the array using the two pivots provided.
* *
* @param elemType the class of the array to be sorted * @param elemType the class of the array to be partitioned
* @param array the array to be sorted * @param array the array to be partitioned
* @param offset the relative offset, in bytes, from the base address of * @param offset the relative offset, in bytes, from the base address of
* the array to partition, otherwise if the array is {@code null},an absolute * the array to partition, otherwise if the array is {@code null},an absolute
* address pointing to the first element to partition from. * address pointing to the first element to partition from.
* @param low the index of the first element, inclusive, to be sorted * @param low the index of the first element, inclusive, to be partitioned
* @param high the index of the last element, exclusive, to be sorted * @param high the index of the last element, exclusive, to be partitioned
* @param pivotIndex1 the index of pivot1, the first pivot * @param pivotIndex1 the index of pivot1, the first pivot
* @param pivotIndex2 the index of pivot2, the second pivot * @param pivotIndex2 the index of pivot2, the second pivot
* @param po the method reference for the fallback implementation * @param po the method reference for the fallback implementation