[LLVMbugs] [Bug 5990] New: [x86, x86-64] MMX vectors trample on FP stack, breaking 80-bit floats

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jan 10 16:03:13 PST 2010


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

           Summary: [x86, x86-64] MMX vectors trample on FP stack, breaking
                    80-bit floats
           Product: new-bugs
           Version: 2.6
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: ABI, miscompilation
          Severity: major
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matti.niemenmaa+llvmbugs at iki.fi
                CC: llvmbugs at cs.uiuc.edu


The following code should print "1.000000", but prints "-nan" on both x86 (with
MMX) and x86-64. Removing the (dead) store to the vector fixes it again.

My guess is that LLVM doesn't realize that the MMX operation it emits sets the
upper 16 bits of the FPU stack registers to 1, thus NaN-ifying anything that
was there.


@s = internal constant [5 x i8] c"%Lf\0A\00"

define i32 @main(i32, i8**) {
entry:
  %x = alloca <2 x i32>, align 8
  store <2 x i32> zeroinitializer, <2 x i32>* %x, align 8
  call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([5 x i8]* @s, i64 0,
i64 0), x86_fp80 0xK3FFF8000000000000000)
  ret i32 0
}

declare i32 @printf(i8* nocapture, ...) nounwind


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