[llvm-bugs] [Bug 46172] New: mathlib call to fma is not inlined with -ffast-math

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 2 05:37:05 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46172

            Bug ID: 46172
           Summary: mathlib call to fma is not inlined with -ffast-math
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org

I'm not sure if this is an IR or codegen bug:

#include <math.h>
double fastfma(double x, double y, double z) {
  return fma(x, y, z);
}

---------------------------------------------------------------------------

$ clang -O2 stdfma.c -S -o - -ffast-math -emit-llvm


define double @fastfma(double %x, double %y, double %z) {
  %r = tail call fast double @llvm.fma.f64(double %x, double %y, double %z)
  ret double %r
}

declare double @llvm.fma.f64(double, double, double) #1

---------------------------------------------------------------------------

$ ./llc -o - stdfma.ll

_fastfma:
        jmp     _fma            

---------------------------------------------------------------------------

I was expecting to avoid the libm call with (some subset of) -ffast-math.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200602/383001fd/attachment.html>


More information about the llvm-bugs mailing list