]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Add LoongArch architecture detection to __float128 support in libgfortran...
authorLulu Cheng <chenglulu@loongson.cn>
Mon, 7 Apr 2025 02:00:27 +0000 (10:00 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Tue, 8 Apr 2025 01:19:14 +0000 (09:19 +0800)
In GCC14, LoongArch added __float128 as an alias for _Float128.
In commit r15-8962, support for q/Q suffixes for 128-bit floating point
numbers.  This will cause the compiler to automatically link libquadmath
when compiling Fortran programs.  But on LoongArch `long double` is
IEEE quad, so there is no need to implement libquadmath.
This causes link failure.

PR target/119408

libgfortran/ChangeLog:

* acinclude.m4: When checking for __float128 support, determine
whether the current architecture is LoongArch.  If so, return false.
* configure: Regenerate.

libquadmath/ChangeLog:

* configure.ac: When checking for __float128 support, determine
whether the current architecture is LoongArch.  If so, return false.
* configure: Regenerate.

Sigend-off-by: Xi Ruoyao <xry111@xry111.site>
Sigend-off-by: Jakub Jelinek <jakub@redhat.com>
(cherry picked from commit 1534f0099c98ea14c08a401302b05edf2231f411)

libgfortran/acinclude.m4
libgfortran/configure
libquadmath/configure
libquadmath/configure.ac

index a73207e54656fdd412eba99551cd77ac37e402de..23fd621e5188faaf40c5c42dc927670ae98da174 100644 (file)
@@ -274,6 +274,10 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
   AC_CACHE_CHECK([whether we have a usable _Float128 type],
                  libgfor_cv_have_float128, [
    GCC_TRY_COMPILE_OR_LINK([
+    #ifdef __loongarch__
+    #error On LoongArch we should use long double instead; __float128 is only for porting existing code easier.
+    #endif
+
     _Float128 foo (_Float128 x)
     {
      _Complex _Float128 z1, z2;
index 774dd52fc95dec5c0e5eade832abc62a685df596..16bad2924749eeb449cc47562f1dfa3c85a39053 100755 (executable)
@@ -30288,6 +30288,10 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+    #ifdef __loongarch__
+    #error On LoongArch we should use long double instead; __float128 is only for porting existing code easier.
+    #endif
+
     _Float128 foo (_Float128 x)
     {
      _Complex _Float128 z1, z2;
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+    #ifdef __loongarch__
+    #error On LoongArch we should use long double instead; __float128 is only for porting existing code easier.
+    #endif
+
     _Float128 foo (_Float128 x)
     {
      _Complex _Float128 z1, z2;
index 49d70809218c2a3146b28ebfd5f418336f3b25d6..f82dd3d0d6d42e7a7011e764fe9ed12817a81d0c 100755 (executable)
@@ -12843,6 +12843,10 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+    #ifdef __loongarch__
+    #error  On LoongArch we should use long double instead; __float128 is only for porting existing code easier.
+    #endif
+
     #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
     typedef _Complex float __attribute__((mode(TC))) __complex128;
     #else
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+    #ifdef __loongarch__
+    #error  On LoongArch we should use long double instead; __float128 is only for porting existing code easier.
+    #endif
+
     #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
     typedef _Complex float __attribute__((mode(TC))) __complex128;
     #else
index 349be2607c64eaef033bf1ccb89cb5fc6f343d53..c64a84892191c812beeff8c4299456e7ca038e84 100644 (file)
@@ -233,6 +233,10 @@ AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [test "x$quadmath_use_symver" = xsun])
 
 AC_CACHE_CHECK([whether __float128 is supported], [libquad_cv_have_float128],
   [GCC_TRY_COMPILE_OR_LINK([
+    #ifdef __loongarch__
+    #error  On LoongArch we should use long double instead; __float128 is only for porting existing code easier.
+    #endif
+
     #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
     typedef _Complex float __attribute__((mode(TC))) __complex128;
     #else