Skip to content

Commit

Permalink
8294033: x86_64: libm stubs are missing
Browse files Browse the repository at this point in the history
Reviewed-by: jvernee, kvn
  • Loading branch information
Vladimir Ivanov committed Nov 11, 2022
1 parent f0b648b commit 34a499d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
12 changes: 7 additions & 5 deletions src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3335,19 +3335,19 @@ void StubGenerator::generate_libm_stubs() {
StubRoutines::_dcos = generate_libmCos(); // from stubGenerator_x86_64_cos.cpp
}
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dtan)) {
StubRoutines::_dtan = generate_libmTan();
StubRoutines::_dtan = generate_libmTan(); // from stubGenerator_x86_64_tan.cpp
}
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dexp)) {
StubRoutines::_dexp = generate_libmExp();
StubRoutines::_dexp = generate_libmExp(); // from stubGenerator_x86_64_exp.cpp
}
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dpow)) {
StubRoutines::_dpow = generate_libmPow();
StubRoutines::_dpow = generate_libmPow(); // from stubGenerator_x86_64_pow.cpp
}
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dlog)) {
StubRoutines::_dlog = generate_libmLog();
StubRoutines::_dlog = generate_libmLog(); // from stubGenerator_x86_64_log.cpp
}
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dlog10)) {
StubRoutines::_dlog10 = generate_libmLog10();
StubRoutines::_dlog10 = generate_libmLog10(); // from stubGenerator_x86_64_log.cpp
}
}
}
Expand Down Expand Up @@ -3719,6 +3719,8 @@ void StubGenerator::generate_initial() {
if (UseAdler32Intrinsics) {
StubRoutines::_updateBytesAdler32 = generate_updateBytesAdler32();
}

generate_libm_stubs();
}

void StubGenerator::generate_phase1() {
Expand Down
23 changes: 9 additions & 14 deletions src/hotspot/share/opto/library_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,31 +1788,32 @@ bool LibraryCallKit::inline_math_pow() {

//------------------------------inline_math_native-----------------------------
bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) {
#define FN_PTR(f) CAST_FROM_FN_PTR(address, f)
switch (id) {
// These intrinsics are not properly supported on all hardware
case vmIntrinsics::_dsin:
return StubRoutines::dsin() != NULL ?
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dsin(), "dsin") :
runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dsin), "SIN");
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dsin), "SIN");
case vmIntrinsics::_dcos:
return StubRoutines::dcos() != NULL ?
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dcos(), "dcos") :
runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dcos), "COS");
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dcos), "COS");
case vmIntrinsics::_dtan:
return StubRoutines::dtan() != NULL ?
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dtan(), "dtan") :
runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dtan), "TAN");
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dtan), "TAN");
case vmIntrinsics::_dexp:
return StubRoutines::dexp() != NULL ?
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dexp(), "dexp") :
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
case vmIntrinsics::_dlog:
return StubRoutines::dlog() != NULL ?
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dlog(), "dlog") :
runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dlog), "LOG");
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dlog), "LOG");
case vmIntrinsics::_dlog10:
return StubRoutines::dlog10() != NULL ?
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dlog10(), "dlog10") :
runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dlog10), "LOG10");
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dlog10), "LOG10");

// These intrinsics are supported on all hardware
case vmIntrinsics::_roundD: return Matcher::match_rule_supported(Op_RoundD) ? inline_double_math(id) : false;
case vmIntrinsics::_ceil:
case vmIntrinsics::_floor:
Expand All @@ -1826,12 +1827,6 @@ bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) {
case vmIntrinsics::_iabs: return Matcher::match_rule_supported(Op_AbsI) ? inline_math(id) : false;
case vmIntrinsics::_labs: return Matcher::match_rule_supported(Op_AbsL) ? inline_math(id) : false;

case vmIntrinsics::_dexp:
return StubRoutines::dexp() != NULL ?
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dexp(), "dexp") :
runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dexp), "EXP");
#undef FN_PTR

case vmIntrinsics::_dpow: return inline_math_pow();
case vmIntrinsics::_dcopySign: return inline_double_math(id);
case vmIntrinsics::_fcopySign: return inline_math(id);
Expand Down

1 comment on commit 34a499d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.