[clang] [flang] [llvm] [flang] Use backend fp128 support to determine REAL(16) availability (PR #221907)
Shunsuke Watanabe via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 01:16:25 PST 2026
================
@@ -266,20 +266,30 @@ def get_resource_module_intrinsic_dir(modfile):
config.substitutions.append(("%openmp_flags", "-fopenmp"))
-# Add features and substitutions to test F128 math support.
-# %f128-lib substitution may be used to generate check prefixes
-# for LIT tests checking for F128 library support.
-if config.flang_runtime_f128_math_lib or config.have_ldbl_mant_dig_113:
- config.available_features.add("flang-supports-f128-math")
-if config.flang_runtime_f128_math_lib:
- config.available_features.add(
- "flang-f128-math-lib-" + config.flang_runtime_f128_math_lib
- )
- config.substitutions.append(
- ("%f128-lib", config.flang_runtime_f128_math_lib.upper())
- )
-else:
- config.substitutions.append(("%f128-lib", "NONE"))
+
+def flang_frontend_supports_f128():
+ try:
+ testcode = b"real(16) :: x\nend"
+ flang_cmd = subprocess.run(
+ [
+ config.flang_exe,
+ "--target=" + config.target_triple,
+ "-fsyntax-only",
+ "-",
+ ],
+ input=testcode,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ )
+ except OSError:
+ return False
+
+ return flang_cmd.returncode == 0
+
+
+# Add a feature for tests that require frontend F128 support.
+if flang_frontend_supports_f128():
+ config.available_features.add("flang-frontend-supports-f128")
----------------
s-watanabe314 wrote:
I changed the feature name back to `flang-supports-f128-math`. I also added a `lit_config.note` to indicate whether F128 support is enabled. For example:
`llvm-lit: llvm-project/flang/test/lit.cfg.py:292: note: frontend F128 support for x86_64-unknown-linux-gnu: True`
https://github.com/llvm/llvm-project/pull/221907
More information about the cfe-commits
mailing list