[flang-commits] [flang] [flang] Warn when F128 is unsupported (PR #102147)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Thu Aug 29 17:09:16 PDT 2024


================
@@ -21,9 +22,25 @@ namespace Fortran::tools {
 
   const llvm::Triple &targetTriple{targetMachine.getTargetTriple()};
   // FIXME: Handle real(3) ?
-  if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64)
+  if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64) {
     targetCharacteristics.DisableType(
         Fortran::common::TypeCategory::Real, /*kind=*/10);
+  }
+
+  // Figure out if we can support F128: see
+  // flang/runtime/Float128Math/math-entries.h
+#ifdef FLANG_RUNTIME_F128_MATH_LIB
+  // we can use libquadmath wrappers
+  constexpr bool f128Support = true;
+#elif LDBL_MANT_DIG == 113
+  // we can use libm wrappers
+  constexpr bool f128Support = true;
+#else
+  constexpr bool f128Support = false;
+#endif
+
+  if constexpr (!f128Support)
+    targetCharacteristics.DisableType(Fortran::common::TypeCategory::Real, 16);
----------------
vzakhari wrote:

Same comment as below. Some basic real*16 operations may still work, but math may not.  I think it may be too much to disable it all.

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


More information about the flang-commits mailing list