[llvm-bugs] [Bug 32386] New: [InsnCombine] (fptrunc (floor x)) -> (floor (fptrunc x))

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 23 00:15:53 PDT 2017


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

            Bug ID: 32386
           Summary: [InsnCombine] (fptrunc (floor x)) -> (floor (fptrunc
                    x))
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: shiva0217 at gmail.com
                CC: llvm-bugs at lists.llvm.org

The test case fail due to instruction combine cast from floor to floorf
which make precision lost and get wrong floor value.

double d = 1024.0 - 1.0 / 32768.0;
extern double floor(double);
extern float floorf(float);
extern void abort();

int main() {

    float f1 = (float)floor(d);

    if ((int)f1 != 1023)
      abort ();

    return 0;
}

-- 
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/20170323/9d15bf6c/attachment.html>


More information about the llvm-bugs mailing list