X86: correct library call setup for Windows itanium
authorSaleem Abdulrasool <compnerd@compnerd.org>
Thu, 24 Jul 2014 17:46:36 +0000 (17:46 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Thu, 24 Jul 2014 17:46:36 +0000 (17:46 +0000)
This target is identical to the Windows MSVC (and follows Microsoft ABI for C).
Correct the library call setup for this target.  The same set of library calls
are missing on this environment.

llvm-svn: 213883

llvm/lib/Target/TargetLibraryInfo.cpp
llvm/test/MC/X86/x86-windows-itanium-libcalls.ll [new file with mode: 0644]

index 6ec0b1f..6ff7441 100644 (file)
@@ -426,7 +426,7 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T,
     TLI.setUnavailable(LibFunc::fiprintf);
   }
 
-  if (T.isKnownWindowsMSVCEnvironment()) {
+  if (T.isKnownWindowsMSVCEnvironment() || T.isWindowsItaniumEnvironment()) {
     // Win32 does not support long double
     TLI.setUnavailable(LibFunc::acosl);
     TLI.setUnavailable(LibFunc::asinl);
diff --git a/llvm/test/MC/X86/x86-windows-itanium-libcalls.ll b/llvm/test/MC/X86/x86-windows-itanium-libcalls.ll
new file mode 100644 (file)
index 0000000..773d03b
--- /dev/null
@@ -0,0 +1,16 @@
+; RUN: opt -mtriple i686-windows-itanium -O2 -o - %s | llvm-dis | FileCheck %s
+
+target triple = "i686-windows-itanium"
+
+declare dllimport double @floor(double)
+
+define dllexport float @test(float %f) {
+  %conv = fpext float %f to double
+  %call = tail call double @floor(double %conv)
+  %cast = fptrunc double %call to float
+  ret float %cast
+}
+
+; CHECK-NOT: floorf
+; CHECK: floor
+