Skip to content

Commit 212e329

Browse files
committed
8338694: x86_64 intrinsic for tanh using libm
Reviewed-by: kvn, jbhateja, sgibbons, sviswanathan
1 parent 2669e22 commit 212e329

26 files changed

+980
-10
lines changed

src/hotspot/cpu/x86/assembler_x86.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8048,6 +8048,14 @@ void Assembler::andpd(XMMRegister dst, XMMRegister src) {
80488048
emit_int16(0x54, (0xC0 | encode));
80498049
}
80508050

8051+
void Assembler::andnpd(XMMRegister dst, XMMRegister src) {
8052+
NOT_LP64(assert(VM_Version::supports_sse2(), ""));
8053+
InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);
8054+
attributes.set_rex_vex_w_reverted();
8055+
int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
8056+
emit_int16(0x55, (0xC0 | encode));
8057+
}
8058+
80518059
void Assembler::andps(XMMRegister dst, XMMRegister src) {
80528060
NOT_LP64(assert(VM_Version::supports_sse(), ""));
80538061
InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true);

src/hotspot/cpu/x86/assembler_x86.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,6 +2631,7 @@ class Assembler : public AbstractAssembler {
26312631

26322632
// Bitwise Logical AND of Packed Floating-Point Values
26332633
void andpd(XMMRegister dst, XMMRegister src);
2634+
void andnpd(XMMRegister dst, XMMRegister src);
26342635
void andps(XMMRegister dst, XMMRegister src);
26352636
void vandpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
26362637
void vandps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);

src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,11 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
807807
if (x->id() == vmIntrinsics::_dexp || x->id() == vmIntrinsics::_dlog ||
808808
x->id() == vmIntrinsics::_dpow || x->id() == vmIntrinsics::_dcos ||
809809
x->id() == vmIntrinsics::_dsin || x->id() == vmIntrinsics::_dtan ||
810-
x->id() == vmIntrinsics::_dlog10) {
810+
x->id() == vmIntrinsics::_dlog10
811+
#ifdef _LP64
812+
|| x->id() == vmIntrinsics::_dtanh
813+
#endif
814+
) {
811815
do_LibmIntrinsic(x);
812816
return;
813817
}
@@ -989,11 +993,17 @@ void LIRGenerator::do_LibmIntrinsic(Intrinsic* x) {
989993
break;
990994
case vmIntrinsics::_dtan:
991995
if (StubRoutines::dtan() != nullptr) {
992-
__ call_runtime_leaf(StubRoutines::dtan(), getThreadTemp(), result_reg, cc->args());
996+
__ call_runtime_leaf(StubRoutines::dtan(), getThreadTemp(), result_reg, cc->args());
993997
} else {
994998
__ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtan), getThreadTemp(), result_reg, cc->args());
995999
}
9961000
break;
1001+
case vmIntrinsics::_dtanh:
1002+
assert(StubRoutines::dtanh() != nullptr, "tanh intrinsic not found");
1003+
if (StubRoutines::dtanh() != nullptr) {
1004+
__ call_runtime_leaf(StubRoutines::dtanh(), getThreadTemp(), result_reg, cc->args());
1005+
}
1006+
break;
9971007
default: ShouldNotReachHere();
9981008
}
9991009
#endif // _LP64

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,6 +3573,9 @@ void StubGenerator::generate_libm_stubs() {
35733573
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dtan)) {
35743574
StubRoutines::_dtan = generate_libmTan(); // from stubGenerator_x86_64_tan.cpp
35753575
}
3576+
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dtanh)) {
3577+
StubRoutines::_dtanh = generate_libmTanh(); // from stubGenerator_x86_64_tanh.cpp
3578+
}
35763579
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dexp)) {
35773580
StubRoutines::_dexp = generate_libmExp(); // from stubGenerator_x86_64_exp.cpp
35783581
}

src/hotspot/cpu/x86/stubGenerator_x86_64.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ class StubGenerator: public StubCodeGenerator {
546546
address generate_libmSin();
547547
address generate_libmCos();
548548
address generate_libmTan();
549+
address generate_libmTanh();
549550
address generate_libmExp();
550551
address generate_libmPow();
551552
address generate_libmLog();

src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp

Lines changed: 502 additions & 0 deletions
Large diffs are not rendered by default.

src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -373,6 +373,10 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
373373
// [ lo(arg) ]
374374
// [ hi(arg) ]
375375
//
376+
if (kind == Interpreter::java_lang_math_tanh) {
377+
return nullptr;
378+
}
379+
376380
if (kind == Interpreter::java_lang_math_fmaD) {
377381
if (!UseFMA) {
378382
return nullptr; // Generate a vanilla entry

src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -465,6 +465,10 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
465465
} else {
466466
__ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dtan));
467467
}
468+
} else if (kind == Interpreter::java_lang_math_tanh) {
469+
assert(StubRoutines::dtanh() != nullptr, "not initialized");
470+
__ movdbl(xmm0, Address(rsp, wordSize));
471+
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtanh())));
468472
} else if (kind == Interpreter::java_lang_math_abs) {
469473
assert(StubRoutines::x86::double_sign_mask() != nullptr, "not initialized");
470474
__ movdbl(xmm0, Address(rsp, wordSize));

src/hotspot/share/c1/c1_Compiler.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -167,6 +167,9 @@ bool Compiler::is_intrinsic_supported(vmIntrinsics::ID id) {
167167
case vmIntrinsics::_dsin:
168168
case vmIntrinsics::_dcos:
169169
case vmIntrinsics::_dtan:
170+
#if defined(AMD64)
171+
case vmIntrinsics::_dtanh:
172+
#endif
170173
case vmIntrinsics::_dlog:
171174
case vmIntrinsics::_dlog10:
172175
case vmIntrinsics::_dexp:

src/hotspot/share/c1/c1_GraphBuilder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,6 +3339,7 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope)
33393339
case vmIntrinsics::_dsin : // fall through
33403340
case vmIntrinsics::_dcos : // fall through
33413341
case vmIntrinsics::_dtan : // fall through
3342+
case vmIntrinsics::_dtanh : // fall through
33423343
case vmIntrinsics::_dlog : // fall through
33433344
case vmIntrinsics::_dlog10 : // fall through
33443345
case vmIntrinsics::_dexp : // fall through

src/hotspot/share/c1/c1_LIRGenerator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,6 +2971,7 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
29712971
case vmIntrinsics::_dsqrt: // fall through
29722972
case vmIntrinsics::_dsqrt_strict: // fall through
29732973
case vmIntrinsics::_dtan: // fall through
2974+
case vmIntrinsics::_dtanh: // fall through
29742975
case vmIntrinsics::_dsin : // fall through
29752976
case vmIntrinsics::_dcos : // fall through
29762977
case vmIntrinsics::_dexp : // fall through

src/hotspot/share/c1/c1_Runtime1.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ const char* Runtime1::name_for_address(address entry) {
347347
FUNCTION_CASE(entry, StubRoutines::dsin());
348348
FUNCTION_CASE(entry, StubRoutines::dcos());
349349
FUNCTION_CASE(entry, StubRoutines::dtan());
350+
FUNCTION_CASE(entry, StubRoutines::dtanh());
350351

351352
#undef FUNCTION_CASE
352353

src/hotspot/share/classfile/vmIntrinsics.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ bool vmIntrinsics::preserves_state(vmIntrinsics::ID id) {
9090
case vmIntrinsics::_dsin:
9191
case vmIntrinsics::_dcos:
9292
case vmIntrinsics::_dtan:
93+
case vmIntrinsics::_dtanh:
9394
case vmIntrinsics::_dlog:
9495
case vmIntrinsics::_dlog10:
9596
case vmIntrinsics::_dexp:
@@ -141,6 +142,7 @@ bool vmIntrinsics::can_trap(vmIntrinsics::ID id) {
141142
case vmIntrinsics::_dsin:
142143
case vmIntrinsics::_dcos:
143144
case vmIntrinsics::_dtan:
145+
case vmIntrinsics::_dtanh:
144146
case vmIntrinsics::_dlog:
145147
case vmIntrinsics::_dlog10:
146148
case vmIntrinsics::_dexp:
@@ -288,6 +290,7 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) {
288290
case vmIntrinsics::_dsin:
289291
case vmIntrinsics::_dcos:
290292
case vmIntrinsics::_dtan:
293+
case vmIntrinsics::_dtanh:
291294
case vmIntrinsics::_dlog:
292295
case vmIntrinsics::_dexp:
293296
case vmIntrinsics::_dpow:

src/hotspot/share/classfile/vmIntrinsics.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class methodHandle;
135135
do_name(log_name,"log") do_name(log10_name,"log10") do_name(pow_name,"pow") \
136136
do_name(exp_name,"exp") do_name(min_name,"min") do_name(max_name,"max") \
137137
do_name(floor_name, "floor") do_name(ceil_name, "ceil") do_name(rint_name, "rint") \
138-
do_name(round_name, "round") \
138+
do_name(round_name, "round") do_name(tanh_name,"tanh") \
139139
\
140140
do_name(addExact_name,"addExact") \
141141
do_name(decrementExact_name,"decrementExact") \
@@ -161,6 +161,7 @@ class methodHandle;
161161
do_intrinsic(_dcos, java_lang_Math, cos_name, double_double_signature, F_S) \
162162
do_intrinsic(_dtan, java_lang_Math, tan_name, double_double_signature, F_S) \
163163
do_intrinsic(_datan2, java_lang_Math, atan2_name, double2_double_signature, F_S) \
164+
do_intrinsic(_dtanh, java_lang_Math, tanh_name, double_double_signature, F_S) \
164165
do_intrinsic(_dsqrt, java_lang_Math, sqrt_name, double_double_signature, F_S) \
165166
do_intrinsic(_dlog, java_lang_Math, log_name, double_double_signature, F_S) \
166167
do_intrinsic(_dlog10, java_lang_Math, log10_name, double_double_signature, F_S) \

src/hotspot/share/interpreter/abstractInterpreter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan
138138
case vmIntrinsics::_dsin: return java_lang_math_sin;
139139
case vmIntrinsics::_dcos: return java_lang_math_cos;
140140
case vmIntrinsics::_dtan: return java_lang_math_tan;
141+
case vmIntrinsics::_dtanh: return java_lang_math_tanh;
141142
case vmIntrinsics::_dabs: return java_lang_math_abs;
142143
case vmIntrinsics::_dlog: return java_lang_math_log;
143144
case vmIntrinsics::_dlog10: return java_lang_math_log10;
@@ -198,6 +199,7 @@ vmIntrinsics::ID AbstractInterpreter::method_intrinsic(MethodKind kind) {
198199
case java_lang_math_sin : return vmIntrinsics::_dsin;
199200
case java_lang_math_cos : return vmIntrinsics::_dcos;
200201
case java_lang_math_tan : return vmIntrinsics::_dtan;
202+
case java_lang_math_tanh : return vmIntrinsics::_dtanh;
201203
case java_lang_math_abs : return vmIntrinsics::_dabs;
202204
case java_lang_math_log : return vmIntrinsics::_dlog;
203205
case java_lang_math_log10 : return vmIntrinsics::_dlog10;
@@ -309,6 +311,7 @@ void AbstractInterpreter::print_method_kind(MethodKind kind) {
309311
case java_lang_math_sin : tty->print("java_lang_math_sin" ); break;
310312
case java_lang_math_cos : tty->print("java_lang_math_cos" ); break;
311313
case java_lang_math_tan : tty->print("java_lang_math_tan" ); break;
314+
case java_lang_math_tanh : tty->print("java_lang_math_tanh" ); break;
312315
case java_lang_math_abs : tty->print("java_lang_math_abs" ); break;
313316
case java_lang_math_log : tty->print("java_lang_math_log" ); break;
314317
case java_lang_math_log10 : tty->print("java_lang_math_log10" ); break;

src/hotspot/share/interpreter/abstractInterpreter.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -72,6 +72,7 @@ class AbstractInterpreter: AllStatic {
7272
java_lang_math_sin, // implementation of java.lang.Math.sin (x)
7373
java_lang_math_cos, // implementation of java.lang.Math.cos (x)
7474
java_lang_math_tan, // implementation of java.lang.Math.tan (x)
75+
java_lang_math_tanh, // implementation of java.lang.Math.tanh (x)
7576
java_lang_math_abs, // implementation of java.lang.Math.abs (x)
7677
java_lang_math_sqrt, // implementation of java.lang.Math.sqrt (x)
7778
java_lang_math_sqrt_strict, // implementation of java.lang.StrictMath.sqrt(x)
@@ -151,6 +152,7 @@ class AbstractInterpreter: AllStatic {
151152
case vmIntrinsics::_dsin : // fall thru
152153
case vmIntrinsics::_dcos : // fall thru
153154
case vmIntrinsics::_dtan : // fall thru
155+
case vmIntrinsics::_dtanh : // fall thru
154156
case vmIntrinsics::_dabs : // fall thru
155157
case vmIntrinsics::_dsqrt : // fall thru
156158
case vmIntrinsics::_dsqrt_strict : // fall thru

src/hotspot/share/interpreter/templateInterpreterGenerator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -192,6 +192,7 @@ void TemplateInterpreterGenerator::generate_all() {
192192
method_entry(java_lang_math_sin )
193193
method_entry(java_lang_math_cos )
194194
method_entry(java_lang_math_tan )
195+
method_entry(java_lang_math_tanh )
195196
method_entry(java_lang_math_abs )
196197
method_entry(java_lang_math_sqrt )
197198
method_entry(java_lang_math_sqrt_strict)
@@ -457,6 +458,7 @@ address TemplateInterpreterGenerator::generate_intrinsic_entry(AbstractInterpret
457458
case Interpreter::java_lang_math_sin : // fall thru
458459
case Interpreter::java_lang_math_cos : // fall thru
459460
case Interpreter::java_lang_math_tan : // fall thru
461+
case Interpreter::java_lang_math_tanh : // fall thru
460462
case Interpreter::java_lang_math_abs : // fall thru
461463
case Interpreter::java_lang_math_log : // fall thru
462464
case Interpreter::java_lang_math_log10 : // fall thru

src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -54,6 +54,7 @@ void ZeroInterpreterGenerator::generate_all() {
5454
method_entry(java_lang_math_sin );
5555
method_entry(java_lang_math_cos );
5656
method_entry(java_lang_math_tan );
57+
method_entry(java_lang_math_tanh );
5758
method_entry(java_lang_math_abs );
5859
method_entry(java_lang_math_sqrt );
5960
method_entry(java_lang_math_sqrt_strict);
@@ -95,6 +96,7 @@ address ZeroInterpreterGenerator::generate_method_entry(
9596
case Interpreter::java_lang_math_sin : // fall thru
9697
case Interpreter::java_lang_math_cos : // fall thru
9798
case Interpreter::java_lang_math_tan : // fall thru
99+
case Interpreter::java_lang_math_tanh : // fall thru
98100
case Interpreter::java_lang_math_abs : // fall thru
99101
case Interpreter::java_lang_math_log : // fall thru
100102
case Interpreter::java_lang_math_log10 : // fall thru

src/hotspot/share/jvmci/jvmciCompilerToVM.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class CompilerToVM {
116116
static address dsin;
117117
static address dcos;
118118
static address dtan;
119+
static address dtanh;
119120
static address dexp;
120121
static address dlog;
121122
static address dlog10;

src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ int CompilerToVM::Data::sizeof_ZStoreBarrierEntry = sizeof(ZStoreBarrierEntry);
135135
address CompilerToVM::Data::dsin;
136136
address CompilerToVM::Data::dcos;
137137
address CompilerToVM::Data::dtan;
138+
address CompilerToVM::Data::dtanh;
138139
address CompilerToVM::Data::dexp;
139140
address CompilerToVM::Data::dlog;
140141
address CompilerToVM::Data::dlog10;
@@ -268,6 +269,19 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
268269
SET_TRIGFUNC(dpow);
269270

270271
#undef SET_TRIGFUNC
272+
273+
#define SET_TRIGFUNC_OR_NULL(name) \
274+
if (StubRoutines::name() != nullptr) { \
275+
name = StubRoutines::name(); \
276+
} else { \
277+
name = nullptr; \
278+
}
279+
280+
SET_TRIGFUNC_OR_NULL(dtanh);
281+
282+
#undef SET_TRIGFUNC_OR_NULL
283+
284+
271285
}
272286

273287
static jboolean is_c1_supported(vmIntrinsics::ID id){

src/hotspot/share/opto/c2compiler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ bool C2Compiler::is_intrinsic_supported(vmIntrinsics::ID id) {
610610
case vmIntrinsics::_dsin:
611611
case vmIntrinsics::_dcos:
612612
case vmIntrinsics::_dtan:
613+
case vmIntrinsics::_dtanh:
613614
case vmIntrinsics::_dabs:
614615
case vmIntrinsics::_fabs:
615616
case vmIntrinsics::_iabs:

src/hotspot/share/opto/library_call.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
254254
case vmIntrinsics::_dsin:
255255
case vmIntrinsics::_dcos:
256256
case vmIntrinsics::_dtan:
257+
case vmIntrinsics::_dtanh:
257258
case vmIntrinsics::_dabs:
258259
case vmIntrinsics::_fabs:
259260
case vmIntrinsics::_iabs:
@@ -1879,6 +1880,9 @@ bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) {
18791880
return StubRoutines::dtan() != nullptr ?
18801881
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dtan(), "dtan") :
18811882
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dtan), "TAN");
1883+
case vmIntrinsics::_dtanh:
1884+
return StubRoutines::dtanh() != nullptr ?
1885+
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dtanh(), "dtanh") : false;
18821886
case vmIntrinsics::_dexp:
18831887
return StubRoutines::dexp() != nullptr ?
18841888
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dexp(), "dexp") :

src/hotspot/share/runtime/stubRoutines.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ address StubRoutines::_dlibm_sin_cos_huge = nullptr;
171171
address StubRoutines::_dlibm_reduce_pi04l = nullptr;
172172
address StubRoutines::_dlibm_tan_cot_huge = nullptr;
173173
address StubRoutines::_dtan = nullptr;
174+
address StubRoutines::_dtanh = nullptr;
174175

175176
address StubRoutines::_f2hf = nullptr;
176177
address StubRoutines::_hf2f = nullptr;

src/hotspot/share/runtime/stubRoutines.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ class StubRoutines: AllStatic {
281281
static address _dlibm_reduce_pi04l;
282282
static address _dlibm_tan_cot_huge;
283283
static address _dtan;
284+
static address _dtanh;
284285
static address _fmod;
285286

286287
static address _f2hf;
@@ -472,6 +473,7 @@ class StubRoutines: AllStatic {
472473
static address dlibm_sin_cos_huge() { return _dlibm_sin_cos_huge; }
473474
static address dlibm_tan_cot_huge() { return _dlibm_tan_cot_huge; }
474475
static address dtan() { return _dtan; }
476+
static address dtanh() { return _dtanh; }
475477

476478
// These are versions of the java.lang.Float::floatToFloat16() and float16ToFloat()
477479
// methods which perform the same operations as the intrinsic version.

src/java.base/share/classes/java/lang/Math.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,6 +2737,7 @@ public static double cosh(double x) {
27372737
* @return The hyperbolic tangent of {@code x}.
27382738
* @since 1.5
27392739
*/
2740+
@IntrinsicCandidate
27402741
public static double tanh(double x) {
27412742
return StrictMath.tanh(x);
27422743
}

0 commit comments

Comments
 (0)