[SystemZ] Prefer LHI;ST... over LAY;MV...
[oota-llvm.git] / lib / Target / Mips / Mips16HardFloat.cpp
index 7e456aa6d1ee0bf665664ebb2637a546240bdeae..46b04c3312d233fe917cd106e3d7e5f9b96dd1dd 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
 #include <string>
 
 static void inlineAsmOut
@@ -320,6 +321,17 @@ static void assureFPCallStub(Function &F, Module *M,
   new UnreachableInst(Context, BB);
 }
 
+//
+// Functions that are inline intrinsics don't need helpers.
+//
+static const char *IntrinsicInline[] =
+  {"fabs"};
+
+static bool isIntrinsicInline(Function *F) {
+  return std::binary_search(
+    IntrinsicInline, array_endof(IntrinsicInline),
+    F->getName());
+}
 //
 // Returns of float, double and complex need to be handled with a helper
 // function.
@@ -372,7 +384,7 @@ static bool fixupFPReturnAndCall
           // helper functions
           if (Subtarget.getRelocationModel() != Reloc::PIC_ ) {
             Function *F_ =  CI->getCalledFunction();
-            if (F_ && needsFPHelperFromSig(*F_)) {
+            if (F_ && !isIntrinsicInline(F_) && needsFPHelperFromSig(*F_)) {
               assureFPCallStub(*F_, M, Subtarget);
               Modified=true;
             }