RFR: 8265917: Different values computed by C2 and interpreter/C1 for Math.pow(x, 2.0) on x86_32
Jie Fu
jiefu at openjdk.java.net
Mon Apr 26 06:20:33 UTC 2021
On Sun, 25 Apr 2021 18:09:01 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> I think you should fix 32-bit version of `dpow` stub because 64-bit stub has this optimization:
> https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp#L828
>
> Also add `pow(x, 0.5)` as well.
>
> C `dpow` code in VM has this optimization which works in 32- and in 64-bit when stub is not used (for example, on other platforms):
> https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/sharedRuntimeTrans.cpp#L496
>
> Java lib code also has this optimization:
> https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/FdLibm.java#L362
>
> Only 32-bit x86 stub is missing it:
> https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp#L2544
>
> The stub is generated only on x86:
>
> ```
> $ grep -r StubRoutines::_dpow src/hotspot/cpu/
> src/hotspot/cpu//x86/stubGenerator_x86_64.cpp: StubRoutines::_dpow = generate_libmPow();
> src/hotspot/cpu//x86/stubGenerator_x86_32.cpp: StubRoutines::_dpow = generate_libmPow();
> ```
>
> I suggest to fix it to be consistent with the rest of VM and Java lib code.
Hi @vnkozlov ,
Math.pow(x, 2.0) has been optimized for x86_32.
As for the Math.pow(x, 0.5), it will be handled in JDK-8265940 after this issue.
Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3677
More information about the hotspot-compiler-dev
mailing list