#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
fprintf (FILE, "\t" ASM_COMMENT_START " seh_endproc\n")
+/* Long double is 64 bit for Coff targets.
+ Reference:
+ https://learn.microsoft.com/en-us/cpp/c-language/type-long-double. */
+#undef TARGET_LONG_DOUBLE_128
+#define TARGET_LONG_DOUBLE_128 0
+
#endif /* GCC_AARCH64_ABI_MS_H. */
if (DECIMAL_FLOAT_MODE_P (mode))
return default_decimal_float_supported_p ();
+ if (mode == TFmode)
+ return true;
+
return ((mode == HFmode || mode == BFmode)
? true
: default_scalar_mode_supported_p (mode));
static machine_mode
aarch64_c_mode_for_floating_type (enum tree_index ti)
{
- if (ti == TI_LONG_DOUBLE_TYPE)
+ if (TARGET_LONG_DOUBLE_128 && ti == TI_LONG_DOUBLE_TYPE)
return TFmode;
return default_mode_for_floating_type (ti);
}
/* CPU/ARCH option handling. */
#include "config/aarch64/aarch64-opts.h"
+/* Long double is stored in 128 bits by default. */
+#ifndef TARGET_LONG_DOUBLE_128
+#define TARGET_LONG_DOUBLE_128 1
+#endif
+
/* If there is no CPU defined at configure, use generic as default. */
#ifndef TARGET_CPU_DEFAULT
# define TARGET_CPU_DEFAULT AARCH64_CPU_generic_armv8_a
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/**
+ * For aarch64-w64-mingw32 target, long double is 64 bits. Unlike in
+ * aarch64-linux-gnu, where long double is 128 bits. The tests below validate
+ * validate that. In aarch64-linux-gnu, the results would be the opposite.
+ */
+
+/*
+** test:
+** fmov d0, 4.0e\+0
+** ret
+*/
+long double
+test ()
+{
+ long double i = 4;
+ return i;
+}
+
+/* { dg-final { scan-assembler-not "ldr\tq\[0-9\]+, \[x\[0-9\]+\]*" } } */
--- /dev/null
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an AArch64-Mingw target.
+if {![istarget aarch64*-*-mingw32] } then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish