[llvm-commits] [llvm] r74446 - in /llvm/trunk: lib/Target/X86/X86FloatingPoint.cpp test/CodeGen/X86/inline-asm-fpstack3.ll

Rafael Espindola rafael.espindola at gmail.com
Mon Jun 29 13:30:11 PDT 2009


Author: rafael
Date: Mon Jun 29 15:29:59 2009
New Revision: 74446

URL: http://llvm.org/viewvc/llvm-project?rev=74446&view=rev
Log:
FIX PR 4459.

Not sure I understand how the temp register gets used,
but this fixes a bug and introduces no regressions.


Added:
    llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll
Modified:
    llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp

Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=74446&r1=74445&r2=74446&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Mon Jun 29 15:29:59 2009
@@ -996,7 +996,7 @@
     // it is possible for FP0 to be alive after this instruction.
     if (!MI->killsRegister(X86::FP0)) {
       // Duplicate ST0
-      duplicateToTop(0, 0, I);
+      duplicateToTop(0, 7 /*temp register*/, I);
     }
     --StackTop;   // "Forget" we have something on the top of stack!
     break;

Added: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll?rev=74446&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll (added)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll Mon Jun 29 15:29:59 2009
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | llc -march=x86 > %t
+; RUN: grep {fld	%%st(0)} %t
+; PR4459
+
+declare x86_fp80 @ceil(x86_fp80)
+
+declare void @test(x86_fp80)
+
+define void @test2(x86_fp80 %a) {
+entry:
+	%0 = call x86_fp80 @ceil(x86_fp80 %a)
+	call void asm sideeffect "fistpl $0", "{st}"( x86_fp80 %0)
+	call void @test(x86_fp80 %0 )
+        ret void
+}





More information about the llvm-commits mailing list