RFR: 8285868: x86_64 intrinsics for floating point methods isNaN, isFinite and isInfinite [v8]

Jatin Bhateja jbhateja at openjdk.java.net
Fri May 20 08:49:53 UTC 2022


On Thu, 19 May 2022 07:09:33 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Srinivas Vamsi Parasa has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:
>> 
>>  - add comment for vfpclasss/d for isFinite()
>>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into float
>>  - zero out the upper bits not written by setb
>>  - use 0x1 to be simpler
>>  - remove the redundant temp register
>>  - Split the macros using predicate
>>  - update jmh tests
>>  - Merge branch 'master' into float
>>  - 8285868: x86_64 intrinsics for floating point methods isNaN, isFinite and isInfinite
>
> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4750:
> 
>> 4748:   movdl(temp, src);
>> 4749:   andl(temp, KILL_SIGN_MASK);
>> 4750:   cmpl(temp, POS_INF);
> 
> For IsNaN following sequence will offer better latency
>      "vucomiss src_xmm, src_xmm"
>      "setp r8"

Hi @vamsi-parasa ,

I can see almost 30% improvement in you JMH micro for IsNaN through above suggested change.
Original score over AVX2 machine:

Benchmark                       Mode  Cnt  Score   Error  Units
FloatClassCheck.testIsNaN       avgt    2  0.854          ns/op
FloatClassCheck.testIsNaN:·asm  avgt         NaN            ---

With new sequence: 
Benchmark                       Mode  Cnt  Score   Error  Units
FloatClassCheck.testIsNaN       avgt    2  0.570          ns/op
FloatClassCheck.testIsNaN:·asm  avgt         NaN            ---

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

PR: https://git.openjdk.java.net/jdk/pull/8459


More information about the hotspot-compiler-dev mailing list