RFR: 8338694: x86_64 intrinsic for tanh using libm
    Srinivas Vamsi Parasa 
    duke at openjdk.org
       
    Tue Aug 27 22:26:21 UTC 2024
    
    
  
On Tue, 27 Aug 2024 10:54:11 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> 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.
>
> I agree, this is all rather obscure. Ideally the same names that are used in wherever this comes from.
> 
> Where does the algorithm come from? What are its accuracy guarantees?
> 
> In addition, given the rarity of hyperbolic tangents in Java applications, do we need this?
@theRealAph, this implementation is based on Intel libm math library and meets the accuracy requirements. The algorithm is provided in the comments.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20657#discussion_r1733589125
    
    
More information about the hotspot-dev
mailing list