[LLVMbugs] [Bug 13574] New: Lack of math lib call conversion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 10 12:09:26 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13574

             Bug #: 13574
           Summary: Lack of math lib call conversion
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: weimingz at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


GCC can convert the double version of some math function to float version if
both the argument and return value are float type.

For example:

float test(float x)
{
  float a,b,c,d,ret;
  a = sin(x);
  b = cos(x);
  c = tan(x);
  d = log2(x);
  ret = a+c-b-d;
  return ret;

Using GCC -O1, it will emit calls to tanf, log2f, sinf and cosf (the last two
are further folded into sincosf).
But LLVM lacks such optimization. I can see there is significant performance
difference on ARM: , "float sinf(float)" is 1.87 times faster than "double
sin(double)".  

I have a patch on Transforms/Scalar/SimplifyLibCalls.cpp to perform such
conversion, but I'm not sure if the community will have concerns about
precision lose.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list