[flang-commits] [flang] [llvm] [flang] Use backend fp128 support to determine REAL(16) availability (PR #221907)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Tue Sep 8 09:49:35 PDT 2026


================
@@ -265,11 +265,35 @@ def get_resource_module_intrinsic_dir(modfile):
 
 config.substitutions.append(("%openmp_flags", "-fopenmp"))
 
+
+def flang_supports_f128():
+    flang_exe = lit.util.which("flang", config.clang_tools_dir)
+
+    if not flang_exe:
+        return False
+
+    try:
+        testcode = b"real(16) :: x\nend"
+        flang_cmd = subprocess.run(
+            [flang_exe, "--target=" + config.target_triple, "-fsyntax-only", "-"],
+            input=testcode,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+        )
+    except OSError:
+        return False
+
+    if flang_cmd.returncode == 0:
+        return True
----------------
tarunprabhu wrote:

It looks like this function could return `None` if `flang_cmd.returncode != 0`. Although `None` is "false-y", it might be better to be consistent and always return a bool.

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


More information about the flang-commits mailing list