X86: Emit _fltused instead of __fltused on Windows x64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117205 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index f7cb9e7..5cb73be 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -583,7 +583,8 @@
if (Subtarget->isTargetWindows()
&& !Subtarget->isTargetCygMing()
&& MMI->callsExternalVAFunctionWithFloatingPointArguments()) {
- MCSymbol *S = MMI->getContext().GetOrCreateSymbol(StringRef("__fltused"));
+ StringRef SymbolName = Subtarget->is64Bit() ? "_fltused" : "__fltused";
+ MCSymbol *S = MMI->getContext().GetOrCreateSymbol(SymbolName);
OutStreamer.EmitSymbolAttribute(S, MCSA_Global);
}
diff --git a/test/CodeGen/X86/fltused.ll b/test/CodeGen/X86/fltused.ll
index a896021..2ffcb96 100644
--- a/test/CodeGen/X86/fltused.ll
+++ b/test/CodeGen/X86/fltused.ll
@@ -2,7 +2,8 @@
; any function is called with floating point arguments on Windows. And that it
; is not emitted otherwise.
-; RUN: llc < %s -mtriple i686-pc-win32 | FileCheck %s
+; RUN: llc < %s -mtriple i686-pc-win32 | FileCheck %s --check-prefix WIN32
+; RUN: llc < %s -mtriple x86_64-pc-win32 | FileCheck %s --check-prefix WIN64
@.str = private constant [4 x i8] c"%f\0A\00"
@@ -14,4 +15,5 @@
declare i32 @printf(i8* nocapture, ...) nounwind
-; CHECK: .globl __fltused
+; WIN32: .globl __fltused
+; WIN64: .globl _fltused