Hello.

The previous patch depend on long double size change. Sending it as well.

Radek
---
>From b3295b9e3837da0afc882930dee2dd217ac85daf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Barto=C5=88?= <[email protected]>
Date: Tue, 28 Jan 2025 21:46:39 +0100
Subject: [PATCH 1/3] Change long double to 64bit (#3)

---
 gcc/config/aarch64/aarch64-coff.h |  4 ++++
 gcc/config/aarch64/aarch64.cc     | 10 ++++++++++
 libgfortran/configure             | 10 ++++++----
 libgfortran/configure.ac          |  7 ++++++-
 4 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-coff.h 
b/gcc/config/aarch64/aarch64-coff.h
index 72607262e1b..6ab9d6ed07f 100644
--- a/gcc/config/aarch64/aarch64-coff.h
+++ b/gcc/config/aarch64/aarch64-coff.h
@@ -31,9 +31,13 @@
 #undef PTRDIFF_TYPE
 #define PTRDIFF_TYPE   "long long int"
 
+#define TARGET_LONG_DOUBLE_64 1
+
 #undef LONG_TYPE_SIZE
 #define LONG_TYPE_SIZE 32
 
+#define __NO_BINARY80__
+
 #ifndef ASM_GENERATE_INTERNAL_LABEL
 # define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM)  \
   sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 61f583392aa..113cf9c48a9 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -28855,6 +28855,14 @@ aarch64_scalar_mode_supported_p (scalar_mode mode)
   if (DECIMAL_FLOAT_MODE_P (mode))
     return default_decimal_float_supported_p ();
 
+/* If long double is 64bit, we need to explicitly specify that aarch64
+   port is prepared to handle TFmode instructions. If long double is
+   128bit, this is handled by default_scalar_mode_supported_p.  */
+#ifdef TARGET_LONG_DOUBLE_64
+  if (mode == TFmode)
+    return true;
+#endif
+
   return ((mode == HFmode || mode == BFmode)
          ? true
          : default_scalar_mode_supported_p (mode));
@@ -28945,8 +28953,10 @@ aarch64_bitint_type_info (int n, struct bitint_info 
*info)
 static machine_mode
 aarch64_c_mode_for_floating_type (enum tree_index ti)
 {
+#ifndef TARGET_LONG_DOUBLE_64
   if (ti == TI_LONG_DOUBLE_TYPE)
     return TFmode;
+#endif
   return default_mode_for_floating_type (ti);
 }
 
diff --git a/libgfortran/configure b/libgfortran/configure
index 11a1bc5f070..cd92ed7db8c 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -6225,10 +6225,12 @@ fi
 # or floating point numbers – or may want to reduce the libgfortran size
 # although they do have the support.
 LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16"
-LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16"
-
-
-
+case $host in
+  aarch64-*-mingw* | aarch64-*-cygwin*)
+    LIBGOMP_CHECKED_REAL_KINDS="4 8" ;;
+  *)
+    LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16" ;;
+esac
 
 # Figure out whether the compiler supports "-ffunction-sections 
-fdata-sections",
 # similarly to how libstdc++ does it
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index cca1ea0ea97..c01d5024833 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -220,7 +220,12 @@ AM_CONDITIONAL(LIBGFOR_MINIMAL, false)
 # or floating point numbers – or may want to reduce the libgfortran size
 # although they do have the support.
 LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16"
-LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16"
+case "${host}" in
+  aarch64-*-mingw* | aarch64-*-cygwin*)
+    LIBGOMP_CHECKED_REAL_KINDS="4 8" ;;
+  *)
+    LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16" ;;
+esac
 
 AC_SUBST(LIBGOMP_CHECKED_INT_KINDS)
 AC_SUBST(LIBGOMP_CHECKED_REAL_KINDS)
-- 
2.50.1.vfs.0.2

Attachment: 0001-Change-long-double-to-64bit-3.patch
Description: 0001-Change-long-double-to-64bit-3.patch

Reply via email to