[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


================
@@ -671,26 +682,37 @@ if(build_runtimes)
     if ("openmp" IN_LIST LLVM_ENABLE_RUNTIMES OR "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
       list(APPEND extra_args ENABLE_FORTRAN)
     endif()
-    # Ensure REAL(16) support in runtimes to be consistent with compiler
-    if(FLANG_RUNTIME_F128_MATH_LIB OR HAVE_LDBL_MANT_DIG_113)
-      list(APPEND extra_cmake_args "-DFORTRAN_SUPPORTS_REAL16=1")
+    # Ensure REAL(16) support in runtimes to be consistent with compiler.
+    # Keep intrinsic module generation consistent with targets for which
+    # the Flang frontend currently enables REAL(16) through backend support.
+    if(LLVM_RUNTIME_TARGETS)
+      foreach(name ${LLVM_RUNTIME_TARGETS})
+        if(name STREQUAL "default")
+          check_real16_support("${LLVM_TARGET_TRIPLE}" supports_real16)
+          set(default_fortran_cmake_args "-DFORTRAN_SUPPORTS_REAL16=${supports_real16}")
+        else()
+          check_real16_support("${name}" supports_real16)
+          set(${name}_fortran_cmake_args "-DFORTRAN_SUPPORTS_REAL16=${supports_real16}")
----------------
tarunprabhu wrote:

What are the values that `LLVM_RUNTIME_TARGETS` can take? Because this looks like the value of `default_fortran_cmake_args` will depend on whichever value is seen last. Is this the desired behavior?

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


More information about the flang-commits mailing list