RFR: 8285868: x86 intrinsics for floating point method isInfinite [v9]
Srinivas Vamsi Parasa
duke at openjdk.java.net
Wed Jun 1 20:22:35 UTC 2022
On Wed, 1 Jun 2022 16:14:37 GMT, Srinivas Vamsi Parasa <duke at openjdk.java.net> wrote:
> @vamsi-parasa can you show difference in generated code for `DoubleClassCheck.testIsFiniteCMov ` for example? Or may be for all of them (for DoubleClassCheck). I am fine with intrinsifying only `isInfinite()` but would like to see code for the record.
Hi Vladimir (@vnkozlov), please see the generated code below.
`isInfinite()` intrinsic is faster because the baseline produces` 2 vucomisd` instructions to compare with positive and negative infinity whereas the intrinsic generates only one `vfpclasssd` instruction as seen below:
**DoubleClassCheck.testIsInfiniteBranch (baseline)**
vucomisd -0xad(%rip),%xmm0
jp 0x00007fe1aced1f31
je 0x00007fe1aced1f3d
vucomisd -0xb1(%rip),%xmm0
jp 0x00007fe1aced1ee0
jne 0x00007fe1aced1ee0
**DoubleClassCheck.testIsInfiniteBranch (intrinsic/vfpclasssd)**
vfpclasssd $0x18,%xmm0,%k7
kmovb %k7,%edi
test %edi,%edi
je 0x00007f1270c167e0
-------------------------
However, in the case of` isFinite() `and `isNan()`, only `1 vucomisd` is generated and is faster for `Cmov` and` branch/call` tests as seen below
**DoubleClassCheck.testIsFiniteCmov (baseline)**
```
vucomisd %xmm0,%xmm1
mov $0x9,%ecx
cmovb %r8d,%ecx
**DoubleClassCheck.testIsFiniteCmov (intrinsci/vfpclasssd)**
vfpclasssd $0x99,%xmm2,%k7
kmovb %k7,%r11d
xor $0x1,%r11d
test %r11d,%r11d
mov $0x7,%r11d
cmovne %r8d,%r11d
-------------------------------------------------------------------------
**DoubleClassCheck.testIsNaNCmov(baseline)**
vucomisd %xmm0,%xmm0
jp 0x00007f0a4d1425fb
movl $0x7,0x10(%rcx,%rax,4)
**DoubleClassCheck.testIsNaNCmov (intrinsic/vfpclasssd)**
vfpclasssd $0x81,%xmm0,%k7
kmovb %k7,%r8d
test %r8d,%r8d
jne 0x00007f7fa0c50f43
movl $0x7,0x10(%r10,%rdx,4)
```
Please let me know if further data is needed.
Thanks,
Vamsi
-------------
PR: https://git.openjdk.java.net/jdk/pull/8459
More information about the hotspot-compiler-dev
mailing list