[LLVMbugs] [Bug 13490] New: Change in register allocation changes result of floating point compare

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 31 08:38:37 PDT 2012


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

             Bug #: 13490
           Summary: Change in register allocation changes result of
                    floating point compare
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8969
  --> http://llvm.org/bugs/attachment.cgi?id=8969
testcase

The attached testcase prints "equal" with -O0 and "different" with -O0 
-optimize-regalloc (or higher optimization levels).

I could not find anything on the ABI about how float return values should be
handled. Should the callee round them? Should the caller round them? Should
this only be done with -ffloat-store?

The testcase uses two assembly functions, but original is c++, using assembly
just makes it a lot easier to see what is going on:

* The function test1 returns a computed value directly
* The function test2 uses a fstps/flds pair to round it
* When compiling main with -O0 the value goes to memory, so the comparison is
equal.
* When compiling main with -O0 -optimize-regalloc the value stays in the fp
stack and the comparison is false.

-- 
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