[LLVMbugs] [Bug 9035] New: x86 backend double load/store generating bad code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 24 03:31:36 PST 2011


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

           Summary: x86 backend double load/store generating bad code
           Product: new-bugs
           Version: 2.8
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: garrofi at hotmail.com
                CC: llvmbugs at cs.uiuc.edu


This code is based on lua TValues. It generates bad code
typedef union
    {
        int p;
        double aux;
    } Value;

Value* chanka2(Value* aux, Value* aux2)
{
    *aux = *aux2;

    return aux;    

}

IR code with -O2

define %union.Value* @chanka2(%union.Value* %aux, %union.Value* nocapture
%aux2) nounwind {
entry:
  %aux2.0 = getelementptr inbounds %union.Value* %aux2, i32 0, i32 0
  %tmp2 = load double* %aux2.0, align 8
  %aux.0 = getelementptr inbounds %union.Value* %aux, i32 0, i32 0
  store double %tmp2, double* %aux.0, align 8
  ret %union.Value* %aux
}


with SSE disable llc.exe -O2 -march=x86 -filetype=asm chanka.o
-mattr=-sse,-sse2 -o chanka.s

movl    8(%esp), %eax
    fldl    (%eax)
    movl    4(%esp), %eax
    fstpl    (%eax)
    ret

I get this code, and this code doesn't work if the input number is a NaN

visual studio or gcc compiler when it's a simple load/store with no math
involved genererates movs instead
x87 fpu modifies the value when the input number is a nan

is there a way to fix that? how can I modify the backend for that case? when
it's just a load/store I would like to use a different path

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