Skip to content

fma calls the system libm, not Julia's openlibm #9890

@eschnett

Description

@eschnett

I am tracking down a test failure where fma returns a wrong result. This is a 64-bit Intel Linux system with glibc 2.12 installed.

code_native tells me that fma expands to a libcall on this system (as should be), and also tells me the address of this fma function, but without giving it a name. /proc/*/maps tells me that this address is part of a range where /lib64/libm-2.12.so is mapped. That is, Julia's fma call goes to the system libm, not to Julia's openlibm.

The reason is that we expand Julia's fma to an LLVM intrinsic, and the libcall is then generated by LLVM since there is no fma machine instruction available. LLVM chooses to call libm.

I suggest to check whether the system has an fma instruction when expanding Julia's fma function, and if not, expanding it to a call to openlibm instead of an LLVM intrinsic. This requires #9855 to be available.

This issue may be related to #9847.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions