Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8170430

x86 pow() stub from Intel libm is inconsistent with pow() from fdlib

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • hotspot
    • None
    • b150
    • x86
    • generic

      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

            vdeshpande Vivek Deshpande (Inactive)
            kvn Vladimir Kozlov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: