[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:01:49 PDT 2026


================
@@ -36,3 +36,42 @@ may provide `REAL(16)` math support without a `libquadmath`
 dependency, using standard `libc` APIs for the `long double`
 data type. It is not recommended to use the above CMake option
 for building Flang compilers for such targets.
+
+In addition to the runtime library support described above, Flang may
+also consider `REAL(16)` available when the LLVM backend supports the
+target's 128-bit floating-point type. This check is independent of the
+availability of libraries implementing `REAL(16)` math intrinsics.
+
+As a result, `REAL(16)` variables and arithmetic operations may be accepted
+even when no library support for `REAL(16)` math intrinsics is available.
+In such cases, references to math intrinsic functions can result in linker
+errors rather than frontend diagnostics. For example:
+
+```
+FIRModule:(.text+0x97): undefined reference to `_FortranASinF128'
+```
+
+In such configurations, basic arithmetic operations such as addition,
+subtraction, multiplication, and division may still work if they are
+supported by the LLVM backend, while math intrinsics such as SIN, COS, EXP,
+and LOG require additional runtime library support.
----------------
s-watanabe314 wrote:

Thank you for the review. I've updated the documentation.

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


More information about the flang-commits mailing list