[flang-commits] [flang] [llvm] [flang] Use backend fp128 support to determine REAL(16) availability (PR #221907)
Shunsuke Watanabe via flang-commits
flang-commits at lists.llvm.org
Wed Sep 9 01:19:08 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}")
----------------
s-watanabe314 wrote:
`LLVM_RUNTIME_TARGETS` is a semicolon-separated list containing "default" and/or explicit target triples. I tested the following configuration on an x86_64 host:
`-DLLVM_RUNTIME_TARGETS="default;aarch64-unknown-linux-gnu"`
`default_fortran_cmake_args` is set only for the special "default" entry, using `LLVM_TARGET_TRIPLE`. Each explicit target sets a separate `<target>_fortran_cmake_args` variable, so `default_fortran_cmake_args` does not depend on the last entry processed.
With the configuration above, `-DFORTRAN_SUPPORTS_REAL16=` is propagated independently to both the "default" runtime target and the `aarch64-unknown-linux-gnu` runtime target through their respective `*_fortran_cmake_args` variables. The configuration and build completed successfully with the list above.
https://github.com/llvm/llvm-project/pull/221907
More information about the flang-commits
mailing list