RFR: 8338694: x86_64 intrinsic for tanh using libm

Jatin Bhateja jbhateja at openjdk.org
Tue Aug 27 05:29:04 UTC 2024


On Wed, 21 Aug 2024 00:25:03 GMT, Srinivas Vamsi Parasa <duke at openjdk.org> wrote:

> The goal of this PR is to implement an x86_64 intrinsic for java.lang.Math.tanh() using libm
> 
> Benchmark (ops/ms) | Stock JDK | Tanh intrinsic | Speedup
> -- | -- | -- | --
> MathBench.tanhDouble | 70900 | 95618 | 1.35x

src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp line 305:

> 303: #define __ _masm->
> 304: 
> 305: address StubGenerator::generate_libmTanh() {

Please add the link to original source references from where algorithm is ported / disassembled.

src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp line 437:

> 435:   __ mulpd(xmm1, xmm1);
> 436:   __ movdqu(xmm4, ExternalAddress(pv + 32), r11 /*rscratch*/);
> 437:   __ mulpd(xmm2, xmm1);

I would encourage either you add detailed comments or give meaningful names to the registers to ease the review process.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20657#discussion_r1732140581
PR Review Comment: https://git.openjdk.org/jdk/pull/20657#discussion_r1732144262


More information about the core-libs-dev mailing list