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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to