[LLVMbugs] [Bug 24314] New: fmax/fmin calls are not optimized

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 30 08:22:18 PDT 2015


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

            Bug ID: 24314
           Summary: fmax/fmin calls are not optimized
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I don't know if this is a front-end bug, a middle-end bug, an x86 back-end bug,
or not a bug:

$ cat fmax.c
#include <math.h>
double max1(double x, double y) {
  return fmax(x, y);
}

$ ./clang -v
clang version 3.8.0 (trunk 243489)
Target: x86_64-apple-darwin14.4.0
Thread model: posix

$ ./clang -O2 -fomit-frame-pointer -fno-math-errno fmax.c -S -o -
...
_max1:                                  ## @max1
    jmp    _fmax                   ## TAILCALL


I thought that 'maxsd' would be used here given we're ignoring errno (which I
think is default for OSX, so I don't even need to explicitly use that flag).

Certainly with -ffast-math, we should be able to do this optimization? 

GCC does:
$ gcc -O2 -fomit-frame-pointer -ffast-math fmax.c -S -o -
...
    maxsd    %xmm1, %xmm0
    ret

-- 
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/20150730/f1a8af1d/attachment.html>


More information about the llvm-bugs mailing list