JDK-8170430 : x86 pow() stub from Intel libm is inconsistent with pow() from fdlib
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86
  • Submitted: 2016-11-29
  • Updated: 2016-12-22
  • Resolved: 2016-11-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b150Fixed
Related Reports
Relates :  
Relates :  
Description
There is way to prevent Interpreter to use math intrinsics: -XX:-InlineIntrinsics
In such case it will call C code through JNI. But JIT compilers will still use pow() stub from libm.
As result produced result java/lang/Math/PowTests.java may fail.

java -Xcomp -XX:-TieredCompilation -XX:-InlineIntrinsics PowTests1
a: 0.3678794411714423 b: 0.36787944117144233
failed

Attached PowTests1.java test is shortened PowTests.java test prepared by Oleg Pliss.

One way to fix it (to get consistent results) is to not use libm stubs when InlineIntrinsics switched off:

-    if (VM_Version::supports_sse2() && UseLibmIntrinsic) {
+    if (VM_Version::supports_sse2() && UseLibmIntrinsic && InlineIntrinsics) {
       if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dsin) ||

But it would be better if code in macroAssembler_x86_pow.cpp could be fixed.

It would be also nice to verify other libm stubs with -XX:-InlineIntrinsics

Comments
Webrev for the fix: http://cr.openjdk.java.net/~vdeshpande/8170430/webrev.00/
30-11-2016