RFR: 8309130: x86_64 AVX512 intrinsics for Arrays.sort methods (int, long, float and double arrays) [v4]
Srinivas Vamsi Parasa
duke at openjdk.org
Thu Jun 1 17:58:07 UTC 2023
On Thu, 1 Jun 2023 02:46:20 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
> I notice that
>
> ```
> zmm_t ymm_vector<float>::max(zmm_t x, zmm_t y) {
> return _mm256_max_ps(x, y);
> }
> ```
>
> This is not quite right, `Arrays.sort` uses the total order imposed by `Double.compare` to sort the array, while `_mm256_max_ps(x, y)` does `x > y ? x : y` which is different.
Hi @merykitty
The algorithm is working for double as expected (i.e. implementing the total order). For example, for the input below:
` double[] arrayUnsorted = {-0.0, Double.NaN, 15.75, Double.POSITIVE_INFINITY, -234.4869, Double.NEGATIVE_INFINITY, +0.0, 100.045};
`
It's showing the correct output after sorting as expected:
`[-Infinity, -234.4869, -0.0, 0.0, 15.75, 100.045, Infinity, NaN]`
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14227#issuecomment-1572531920
More information about the hotspot-compiler-dev
mailing list