-
Enhancement
-
Resolution: Unresolved
-
P4
-
26
-
x86_64
-
generic
Currently, floating point to integral conversion requires special handling to support NaN and +/- Infinity.
* If src is NaN, the result is 0.
* If the src is negative infinity or any value less than or equal to the value of Integer.MIN_VALUE,
* The result is equal to the value of Integer.MIN_VALUE.
* If the src is positive infinity or any value greater than or equal to the value of Integer.MAX_VALUE,
* The result is equal to the value of Integer.MAX_VALUE.
AVX10.2 adds new staturing conversion instructions "vcvttss2sis", "vcvttsd2sis", "vcvttps2dqs", "vcvttpd2qqs" which directly comply with Java and IEEE 754 semantics.
#include <stdio.h>
#include <math.h>
// compile command : clang -mavx10.2-256 -DAVX10 saturating-f2i.
// emulation command line : sde -dmr -itrace-execute-emulate -icount -ptr_raise -- ./a.out
// tags : arm parity, optimization over legacy CVTTSS2SI + SPECIAL-HANDLING.
void micro_f2i_sat_new(float src) {
int dst = 0;
asm volatile (
"vcvttss2sis %1, %0 \n\t"
: "=r"(dst)
: "x"(src)
:
);
printf("src = %f , dst = %d\n", src, dst);
}
int main() {
printf("F2I SATURATING NEW\n");
micro_f2i_sat_new(10.2f);
micro_f2i_sat_new(INFINITY);
micro_f2i_sat_new(-INFINITY);
micro_f2i_sat_new(0x1.fffp+35f);
micro_f2i_sat_new(0.0f);
micro_f2i_sat_new(-0.0f);
micro_f2i_sat_new(NAN);
return 0;
}
* If src is NaN, the result is 0.
* If the src is negative infinity or any value less than or equal to the value of Integer.MIN_VALUE,
* The result is equal to the value of Integer.MIN_VALUE.
* If the src is positive infinity or any value greater than or equal to the value of Integer.MAX_VALUE,
* The result is equal to the value of Integer.MAX_VALUE.
AVX10.2 adds new staturing conversion instructions "vcvttss2sis", "vcvttsd2sis", "vcvttps2dqs", "vcvttpd2qqs" which directly comply with Java and IEEE 754 semantics.
#include <stdio.h>
#include <math.h>
// compile command : clang -mavx10.2-256 -DAVX10 saturating-f2i.
// emulation command line : sde -dmr -itrace-execute-emulate -icount -ptr_raise -- ./a.out
// tags : arm parity, optimization over legacy CVTTSS2SI + SPECIAL-HANDLING.
void micro_f2i_sat_new(float src) {
int dst = 0;
asm volatile (
"vcvttss2sis %1, %0 \n\t"
: "=r"(dst)
: "x"(src)
:
);
printf("src = %f , dst = %d\n", src, dst);
}
int main() {
printf("F2I SATURATING NEW\n");
micro_f2i_sat_new(10.2f);
micro_f2i_sat_new(INFINITY);
micro_f2i_sat_new(-INFINITY);
micro_f2i_sat_new(0x1.fffp+35f);
micro_f2i_sat_new(0.0f);
micro_f2i_sat_new(-0.0f);
micro_f2i_sat_new(NAN);
return 0;
}
- relates to
-
JDK-8352675 Support Intel AVX10 converged vector ISA feature detection
-
- Resolved
-
- links to
-
Review(master) openjdk/jdk/26919