On Mon, 27 Feb 2023 18:26:51 GMT, Joe Darcy <[email protected]> wrote:
>> The wheel of FDLIBM porting turns a notch and sqrt comes into play.
>>
>> While the sqrt operation usually has a hardware implementation that is
>> intrinsified, for completeness a software implementation should be available
>> as well.
>
> Joe Darcy has updated the pull request with a new target base due to a merge
> or a rebase. The incremental webrev excludes the unrelated changes brought in
> by the merge/rebase. The pull request contains six additional commits since
> the last revision:
>
> - Enable intrinsic for StrictMath.sqrt; thanks to Tobias Hartmann for
> assistance with the HotSpot updates.
> - Merge branch 'master' into JDK-8302040
> - Implement review feedback.
> - Add one one unsigned shift comment.
> - Respond to review feedback.
> - JDK-8302040: Port fdlibm sqrt to Java
Adding hotspot-compiler to get get explicit review of small changes to enable
intrinsics support for StrictMath.sqrt after it was changed from a native
method to a Java one. Specific VM changes:
diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp
b/src/hotspot/share/classfile/vmIntrinsics.hpp
index 02be97362c7dc..6d1ad75ae688c 100644
--- a/src/hotspot/share/classfile/vmIntrinsics.hpp
+++ b/src/hotspot/share/classfile/vmIntrinsics.hpp
@@ -202,8 +202,8 @@ class methodHandle;
do_intrinsic(_maxF_strict, java_lang_StrictMath, max_name,
float2_float_signature, F_S) \
do_intrinsic(_minD_strict, java_lang_StrictMath, min_name,
double2_double_signature, F_S) \
do_intrinsic(_maxD_strict, java_lang_StrictMath, max_name,
double2_double_signature, F_S) \
- /* Special flavor of dsqrt intrinsic to handle the "native" method in
StrictMath. Otherwise the same as in Math. */ \
- do_intrinsic(_dsqrt_strict, java_lang_StrictMath, sqrt_name,
double_double_signature, F_SN) \
+ /* Additional dsqrt intrinsic to directly handle the sqrt method in
StrictMath. Otherwise the same as in Math. */ \
+ do_intrinsic(_dsqrt_strict, java_lang_StrictMath, sqrt_name,
double_double_signature, F_S) \
\
do_intrinsic(_floatIsInfinite, java_lang_Float,
isInfinite_name, float_bool_signature, F_S) \
do_name( isInfinite_name,
"isInfinite") \
diff --git a/src/hotspot/share/interpreter/abstractInterpreter.cpp
b/src/hotspot/share/interpreter/abstractInterpreter.cpp
index 875211d6d0527..8d6ef06754cfe 100644
--- a/src/hotspot/share/interpreter/abstractInterpreter.cpp
+++ b/src/hotspot/share/interpreter/abstractInterpreter.cpp
@@ -148,7 +148,7 @@ AbstractInterpreter::MethodKind
AbstractInterpreter::method_kind(const methodHan
case vmIntrinsics::_fmaD: return java_lang_math_fmaD;
case vmIntrinsics::_fmaF: return java_lang_math_fmaF;
case vmIntrinsics::_dsqrt: return java_lang_math_sqrt;
- case vmIntrinsics::_dsqrt_strict: return native;
+ case vmIntrinsics::_dsqrt_strict: return java_lang_math_sqrt;
case vmIntrinsics::_Reference_get: return
java_lang_ref_reference_get;
case vmIntrinsics::_Object_init:
if (RegisterFinalizersAtInit && m->code_size() == 1) {
-------------
PR: https://git.openjdk.org/jdk/pull/12736