[flang] [clang] [flang] add fveclib flag (PR #71734)

Kiran Chandramohan via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 9 03:39:22 PST 2023


================
@@ -843,6 +843,44 @@ getOutputStream(CompilerInstance &ci, llvm::StringRef inFile,
   llvm_unreachable("Invalid action!");
 }
 
+static std::unique_ptr<llvm::TargetLibraryInfoImpl>
+createTLII(llvm::Triple &targetTriple, const CodeGenOptions &codeGenOpts) {
+  auto tlii = std::make_unique<llvm::TargetLibraryInfoImpl>(targetTriple);
+  assert(tlii && "Failed to create TargetLibraryInfo");
+
+  using VecLib = llvm::TargetLibraryInfoImpl::VectorLibrary;
+  VecLib vecLib = VecLib::NoLibrary;
+  switch (codeGenOpts.getVecLib()) {
+  case CodeGenOptions::VectorLibrary::Accelerate:
+    vecLib = VecLib::Accelerate;
+    break;
+  case CodeGenOptions::VectorLibrary::LIBMVEC:
+    vecLib = VecLib::LIBMVEC_X86;
+    break;
+  case CodeGenOptions::VectorLibrary::MASSV:
+    vecLib = VecLib::MASSV;
+    break;
+  case CodeGenOptions::VectorLibrary::SVML:
+    vecLib = VecLib::SVML;
+    break;
+  case CodeGenOptions::VectorLibrary::SLEEF:
+    vecLib = VecLib::SLEEFGNUABI;
+    break;
+  case CodeGenOptions::VectorLibrary::Darwin_libsystem_m:
+    vecLib = VecLib::DarwinLibSystemM;
+    break;
+  case CodeGenOptions::VectorLibrary::ArmPL:
+    vecLib = VecLib::ArmPL;
+    break;
+  case CodeGenOptions::VectorLibrary::NoLibrary:
+    vecLib = VecLib::NoLibrary;
+    break;
+  }
+
+  tlii->addVectorizableFunctionsFromVecLib(vecLib, targetTriple);
+  return tlii;
+}
----------------
kiranchandramohan wrote:

Can this code be moved to `llvm/lib/Frontend/Driver` and shared with Clang?

https://github.com/llvm/llvm-project/pull/71734


More information about the cfe-commits mailing list