aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2024-01-18 13:06:30 +0000
committerGaius Mulley <gaiusmod2@gmail.com>2024-01-18 13:06:30 +0000
commitf2872e00f61a5a333fa22e651d37d3b2035ac41f (patch)
treed2c9fabd7690d9e0efaf3e26c28032ed817cefc1 /gcc
parentaf66955000e38eeba5992641f98a4749cfeb8854 (diff)
downloadgcc-f2872e00f61a5a333fa22e651d37d3b2035ac41f.zip
gcc-f2872e00f61a5a333fa22e651d37d3b2035ac41f.tar.gz
gcc-f2872e00f61a5a333fa22e651d37d3b2035ac41f.tar.bz2
PR modula2/111956 Many powerpc platforms do _not_ have support for IEEE754
This patch corrects commit r14-4149-g81d5ca0b9b8431f1bd7a5ec8a2c94f04bb0cf032 which assummed all powerpc platforms would have IEEE754 long double. The patch ensures that cc1gm2 obtains the default IEEE754 long double availability from the configure generated tm_defines. The user command line switches -mabi=ibmlongdouble and -mabi=ieeelongdouble are implemented to override the configuration defaults. Bootstrapped on power8 and power9 machines. gcc/m2/ChangeLog: PR modula2/111956 * Make-lang.in (host_mc_longreal): Remove. * configure: Regenerate. * configure.ac (M2C_LONGREAL_FLOAT128): Remove. (M2C_LONGREAL_PPC64LE): Remove. * gm2-compiler/M2Options.def (SetIBMLongDouble): New procedure. (GetIBMLongDouble): New procedure function. (SetIEEELongDouble): New procedure. (GetIEEELongDouble): New procedure function. * gm2-compiler/M2Options.mod (SetIBMLongDouble): New procedure. (GetIBMLongDouble): New procedure function. (SetIEEELongDouble): New procedure. (GetIEEELongDouble): New procedure function. (InitializeLongDoubleFlags): New procedure called during module block initialization. * gm2-gcc/m2configure.cc: Remove duplicate includes. (m2configure_M2CLongRealFloat128): Remove. (m2configure_M2CLongRealIBM128): Remove. (m2configure_M2CLongRealLongDouble): Remove. (m2configure_M2CLongRealLongDoublePPC64LE): Remove. (m2configure_TargetIEEEQuadDefault): New function. * gm2-gcc/m2configure.def (M2CLongRealFloat128): Remove. (M2CLongRealIBM128): Remove. (M2CLongRealLongDouble): Remove. (M2CLongRealLongDoublePPC64LE): Remove. (TargetIEEEQuadDefault): New function. * gm2-gcc/m2configure.h (m2configure_M2CLongRealFloat128): Remove. (m2configure_M2CLongRealIBM128): Remove. (m2configure_M2CLongRealLongDouble): Remove. (m2configure_M2CLongRealLongDoublePPC64LE): Remove. (m2configure_TargetIEEEQuadDefault): New function. * gm2-gcc/m2options.h (M2Options_SetIBMLongDouble): New prototype. (M2Options_GetIBMLongDouble): New prototype. (M2Options_SetIEEELongDouble): New prototype. (M2Options_GetIEEELongDouble): New prototype. * gm2-gcc/m2type.cc (build_m2_long_real_node): Re-implement using results of M2Options_GetIBMLongDouble and M2Options_GetIEEELongDouble. * gm2-lang.cc (gm2_langhook_handle_option): Add case OPT_mabi_ibmlongdouble and call M2Options_SetIBMLongDouble. Add case OPT_mabi_ieeelongdouble and call M2Options_SetIEEELongDouble. * gm2config.aci.in: Regenerate. * gm2spec.cc (lang_specific_driver): Remove block defined by M2C_LONGREAL_PPC64LE. Remove case OPT_mabi_ibmlongdouble. Remove case OPT_mabi_ieeelongdouble. libgm2/ChangeLog: PR modula2/111956 * Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * Makefile.in: Regenerate. * libm2cor/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2pim/Makefile.in: Regenerate. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/m2/Make-lang.in6
-rwxr-xr-xgcc/m2/configure18
-rw-r--r--gcc/m2/configure.ac6
-rw-r--r--gcc/m2/gm2-compiler/M2Options.def32
-rw-r--r--gcc/m2/gm2-compiler/M2Options.mod79
-rw-r--r--gcc/m2/gm2-gcc/m2configure.cc55
-rw-r--r--gcc/m2/gm2-gcc/m2configure.def37
-rw-r--r--gcc/m2/gm2-gcc/m2configure.h13
-rw-r--r--gcc/m2/gm2-gcc/m2options.h4
-rw-r--r--gcc/m2/gm2-gcc/m2type.cc20
-rw-r--r--gcc/m2/gm2-lang.cc10
-rw-r--r--gcc/m2/gm2config.aci.in6
-rw-r--r--gcc/m2/gm2spec.cc24
13 files changed, 152 insertions, 158 deletions
diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in
index d7bc736..45bfa93 100644
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -98,9 +98,6 @@ GM2_PROG_DEP=gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext)
include m2/config-make
-# Determine if float128 should represent the Modula-2 type LONGREAL.
-host_mc_longreal := $(if $(strip $(filter powerpc64le%,$(host))),--longreal=__float128)
-
LIBSTDCXX=../$(TARGET_SUBDIR)/libstdc++-v3/src/.libs/libstdc++.a
PGE=m2/pge$(exeext)
@@ -474,8 +471,7 @@ MC_ARGS= --olang=c++ \
-I$(srcdir)/m2/gm2-gcc \
--quiet \
$(MC_COPYRIGHT) \
- --gcc-config-system \
- $(host_mc_longreal)
+ --gcc-config-system
MCDEPS=m2/boot-bin/mc$(exeext)
diff --git a/gcc/m2/configure b/gcc/m2/configure
index f62f3d8..4653097 100755
--- a/gcc/m2/configure
+++ b/gcc/m2/configure
@@ -3646,24 +3646,6 @@ $as_echo "#define HAVE_OPENDIR 1" >>confdefs.h
fi
-case $target in #(
- powerpc64le*) :
-
-$as_echo "#define M2C_LONGREAL_FLOAT128 1" >>confdefs.h
- ;; #(
- *) :
- ;;
-esac
-
-case $target in #(
- powerpc64le*) :
-
-$as_echo "#define M2C_LONGREAL_PPC64LE 1" >>confdefs.h
- ;; #(
- *) :
- ;;
-esac
-
ac_config_headers="$ac_config_headers gm2config.aci"
cat >confcache <<\_ACEOF
diff --git a/gcc/m2/configure.ac b/gcc/m2/configure.ac
index efcca62..15be509 100644
--- a/gcc/m2/configure.ac
+++ b/gcc/m2/configure.ac
@@ -30,11 +30,5 @@ AC_CHECK_HEADERS(sys/types.h)
AC_HEADER_DIRENT
AC_CHECK_LIB([c],[opendir],[AC_DEFINE([HAVE_OPENDIR],[1],[found opendir])])
-AS_CASE([$target],[powerpc64le*],
- [AC_DEFINE([M2C_LONGREAL_FLOAT128],[1],[use __float128 for LONGREAL])])
-
-AS_CASE([$target],[powerpc64le*],
- [AC_DEFINE([M2C_LONGREAL_PPC64LE],[1],[target is ppc64le])])
-
AC_CONFIG_HEADERS(gm2config.aci, [echo timestamp > stamp-h])
AC_OUTPUT
diff --git a/gcc/m2/gm2-compiler/M2Options.def b/gcc/m2/gm2-compiler/M2Options.def
index a5ecb82..4e5f499 100644
--- a/gcc/m2/gm2-compiler/M2Options.def
+++ b/gcc/m2/gm2-compiler/M2Options.def
@@ -971,6 +971,38 @@ PROCEDURE SetDebugBuiltins (value: BOOLEAN) ;
(*
+ SetIBMLongDouble - enable/disable LONGREAL to map onto the
+ IBM long double 128 bit data type.
+ (Only available on the ppc).
+*)
+
+PROCEDURE SetIBMLongDouble (value: BOOLEAN) ;
+
+
+(*
+ GetIBMLongDouble - return the value of IBMLongDouble.
+*)
+
+PROCEDURE GetIBMLongDouble () : BOOLEAN ;
+
+
+(*
+ SetIEEELongDouble - enable/disable LONGREAL to map onto the
+ IEEE long double 128 bit data type.
+ (Only available on the ppc).
+*)
+
+PROCEDURE SetIEEELongDouble (value: BOOLEAN) ;
+
+
+(*
+ GetIEEELongDouble - return the value of IEEELongDouble.
+*)
+
+PROCEDURE GetIEEELongDouble () : BOOLEAN ;
+
+
+(*
FinaliseOptions - once all options have been parsed we set any inferred
values.
*)
diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod
index 01562a1..ae49808 100644
--- a/gcc/m2/gm2-compiler/M2Options.mod
+++ b/gcc/m2/gm2-compiler/M2Options.mod
@@ -31,7 +31,8 @@ FROM FIO IMPORT StdErr ;
FROM libc IMPORT exit, printf ;
FROM Debug IMPORT Halt ;
FROM m2linemap IMPORT location_t ;
-FROM m2configure IMPORT FullPathCPP ;
+FROM m2configure IMPORT FullPathCPP, TargetIEEEQuadDefault ;
+FROM M2Error IMPORT InternalError ;
FROM DynamicStrings IMPORT String, Length, InitString, Mark, Slice, EqualArray,
@@ -74,6 +75,8 @@ VAR
MPFlag,
MDFlag,
MMDFlag,
+ IBMLongDouble,
+ IEEELongDouble,
UselistFlag,
CC1Quiet,
SeenSources : BOOLEAN ;
@@ -1594,6 +1597,79 @@ BEGIN
END SetDebugBuiltins ;
+(*
+ SetIBMLongDouble - enable/disable LONGREAL to map onto the
+ IBM long double 128 bit data type.
+ (Only available on the ppc).
+*)
+
+PROCEDURE SetIBMLongDouble (value: BOOLEAN) ;
+BEGIN
+ IBMLongDouble := value ;
+ IF value
+ THEN
+ IEEELongDouble := FALSE
+ END
+END SetIBMLongDouble ;
+
+
+(*
+ GetIBMLongDouble - return the value of IBMLongDouble.
+*)
+
+PROCEDURE GetIBMLongDouble () : BOOLEAN ;
+BEGIN
+ RETURN IBMLongDouble
+END GetIBMLongDouble ;
+
+
+(*
+ SetIEEELongDouble - enable/disable LONGREAL to map onto the
+ IEEE long double 128 bit data type.
+ (Only available on the ppc).
+*)
+
+PROCEDURE SetIEEELongDouble (value: BOOLEAN) ;
+BEGIN
+ IEEELongDouble := value ;
+ IF value
+ THEN
+ IBMLongDouble := FALSE
+ END
+END SetIEEELongDouble ;
+
+
+(*
+ GetIEEELongDouble - return the value of IEEELongDouble.
+*)
+
+PROCEDURE GetIEEELongDouble () : BOOLEAN ;
+BEGIN
+ RETURN IEEELongDouble
+END GetIEEELongDouble ;
+
+
+(*
+ InitializeLongDoubleFlags - initialize the long double related flags
+ with default values given during gcc configure.
+*)
+
+PROCEDURE InitializeLongDoubleFlags ;
+BEGIN
+ IBMLongDouble := FALSE ;
+ IEEELongDouble := FALSE ;
+ CASE TargetIEEEQuadDefault () OF
+
+ -1: |
+ 0: IBMLongDouble := TRUE |
+ 1: IEEELongDouble := TRUE
+
+ ELSE
+ InternalError ('unexpected value returned from TargetIEEEQuadDefault ()')
+ END
+END InitializeLongDoubleFlags ;
+
+
BEGIN
cflag := FALSE ; (* -c. *)
RuntimeModuleOverride := InitString (DefaultRuntimeModuleOverride) ;
@@ -1673,6 +1749,7 @@ BEGIN
MFarg := NIL ;
MTFlag := NIL ;
MQFlag := NIL ;
+ InitializeLongDoubleFlags ;
M2Prefix := InitString ('') ;
M2PathName := InitString ('')
END M2Options.
diff --git a/gcc/m2/gm2-gcc/m2configure.cc b/gcc/m2/gm2-gcc/m2configure.cc
index feb2810..9e0e82f 100644
--- a/gcc/m2/gm2-gcc/m2configure.cc
+++ b/gcc/m2/gm2-gcc/m2configure.cc
@@ -23,10 +23,6 @@ along with GNU Modula-2; see the file COPYING3. If not see
#include "system.h"
#include "libiberty.h"
-#include "config.h"
-#include "system.h"
-#include "libiberty.h"
-
#include "gcc-consolidation.h"
#include "../gm2-lang.h"
@@ -100,50 +96,17 @@ m2configure_FullPathCPP (void)
return NULL;
}
-/* Return true if M2C_LONGREAL_FLOAT128 is defined. */
-
-bool
-m2configure_M2CLongRealFloat128 (void)
-{
-#if defined(M2C_LONGREAL_FLOAT128)
- return true;
-#else
- return false;
-#endif
-}
-
-/* Return true if M2C_LONGREAL_IBM128 is defined. */
-
-bool
-m2configure_M2CLongRealIBM128 (void)
-{
-#if defined(M2C_LONGREAL_IBM128)
- return true;
-#else
- return false;
-#endif
-}
-
-/* Return true if M2C_LONGREAL_LONGDOUBLE is defined. */
-
-bool
-m2configure_M2CLongRealLongDouble (void)
-{
-#if defined(M2C_LONGREAL_LONGDOUBLE)
- return true;
-#else
- return false;
-#endif
-}
-
-/* Return true if the target is ppc64le. */
+/* Return the value of TARGET_IEEEQUAD_DEFAULT. If it is undefined
+ -1 is returned. A value of 0 indicates the default target long
+ double uses the IBM 128 representation. A value of 1 indicates
+ the default target long double (LONGREAL) is __float128. */
-bool
-m2configure_M2CLongRealLongDoublePPC64LE (void)
+int
+m2configure_TargetIEEEQuadDefault (void)
{
-#if defined(M2C_LONGREAL_PPC64LE)
- return true;
+#ifdef TARGET_IEEEQUAD_DEFAULT
+ return TARGET_IEEEQUAD_DEFAULT;
#else
- return false;
+ return -1;
#endif
}
diff --git a/gcc/m2/gm2-gcc/m2configure.def b/gcc/m2/gm2-gcc/m2configure.def
index 0c038b9..9e32049 100644
--- a/gcc/m2/gm2-gcc/m2configure.def
+++ b/gcc/m2/gm2-gcc/m2configure.def
@@ -41,38 +41,15 @@ PROCEDURE FullPathCPP () : ADDRESS ;
(*
- M2CLongRealFloat128 - return true if M2C_LONGREAL_FLOAT128
- is defined.
- Only one of M2CLongRealFloat128,
- M2CLongRealIBM128,
- M2CLongRealLongDouble will be set true.
+ TargetIEEEQuadDefault - return the value of TARGET_IEEEQUAD_DEFAULT.
+ If it is undefined -1 is returned.
+ A value of 0 indicates the default target long
+ double uses the IBM 128 representation.
+ A value of 1 indicates the default target long
+ double (LONGREAL) is __float128.
*)
-PROCEDURE M2CLongRealFloat128 () : BOOLEAN ;
-
-
-(*
- M2CLongRealIBM128 - return true if M2C_LONGREAL_IBM128
- is defined.
-*)
-
-PROCEDURE M2CLongRealIBM128 () : BOOLEAN ;
-
-
-(*
- M2CLongRealLongDouble - return true if M2C_LONGREAL_LONGDOUBLE
- is defined. This is true if the LONGREAL
- maps onto the default gcc long double type.
-*)
-
-PROCEDURE M2CLongRealLongDouble () : BOOLEAN ;
-
-
-(*
- M2CLongRealLongDoublePPC64LE - return true if the target is ppc64le.
-*)
-
-PROCEDURE M2CLongRealLongDoublePPC64LE () : BOOLEAN ;
+PROCEDURE TargetIEEEQuadDefault () : INTEGER ;
END m2configure.
diff --git a/gcc/m2/gm2-gcc/m2configure.h b/gcc/m2/gm2-gcc/m2configure.h
index a825600..dc4c116 100644
--- a/gcc/m2/gm2-gcc/m2configure.h
+++ b/gcc/m2/gm2-gcc/m2configure.h
@@ -41,17 +41,8 @@ along with GNU Modula-2; see the file COPYING3. If not see
EXTERN char *
m2configure_FullPathCPP (void);
-EXTERN bool
-m2configure_M2CLongRealFloat128 (void);
-
-EXTERN bool
-m2configure_M2CLongRealIBM128 (void);
-
-EXTERN bool
-m2configure_M2CLongRealLongDouble (void);
-
-EXTERN bool
-m2configure_M2CLongRealLongDoublePPC64LE (void);
+EXTERN int
+m2configure_TargetIEEEQuadDefault (void);
#undef EXTERN
#endif /* m2configure_h. */
diff --git a/gcc/m2/gm2-gcc/m2options.h b/gcc/m2/gm2-gcc/m2options.h
index 3d46dc8..01256a9 100644
--- a/gcc/m2/gm2-gcc/m2options.h
+++ b/gcc/m2/gm2-gcc/m2options.h
@@ -148,6 +148,10 @@ EXTERN char *M2Options_GetM2PathName (void);
EXTERN int M2Options_SetUninitVariableChecking (bool value, const char *arg);
EXTERN void M2Options_SetCaseEnumChecking (bool value);
EXTERN void M2Options_SetDebugBuiltins (bool value);
+EXTERN void M2Options_SetIBMLongDouble (bool value);
+EXTERN bool M2Options_GetIBMLongDouble (void);
+EXTERN void M2Options_SetIEEELongDouble (bool value);
+EXTERN bool M2Options_GetIEEELongDouble (void);
#undef EXTERN
#endif /* m2options_h. */
diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc
index e00987a..571923c 100644
--- a/gcc/m2/gm2-gcc/m2type.cc
+++ b/gcc/m2/gm2-gcc/m2type.cc
@@ -1441,22 +1441,20 @@ build_m2_real_node (void)
static tree
build_m2_long_real_node (void)
{
- tree c;
+ tree longreal;
/* Define `LONGREAL'. */
-
- if (m2configure_M2CLongRealFloat128 ())
- c = float128_type_node;
- else if (m2configure_M2CLongRealIBM128 ())
+ if (M2Options_GetIBMLongDouble ())
{
- c = make_node (REAL_TYPE);
- TYPE_PRECISION (c) = LONG_DOUBLE_TYPE_SIZE;
+ longreal = make_node (REAL_TYPE);
+ TYPE_PRECISION (longreal) = LONG_DOUBLE_TYPE_SIZE;
}
+ else if (M2Options_GetIEEELongDouble ())
+ longreal = float128_type_node;
else
- c = long_double_type_node;
-
- layout_type (c);
- return c;
+ longreal = long_double_type_node;
+ layout_type (longreal);
+ return longreal;
}
static tree
diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc
index cfebfc6..86124df 100644
--- a/gcc/m2/gm2-lang.cc
+++ b/gcc/m2/gm2-lang.cc
@@ -639,6 +639,16 @@ gm2_langhook_handle_option (
case OPT_fm2_whole_program:
M2Options_SetWholeProgram (value);
return 1;
+#ifdef OPT_mabi_ibmlongdouble
+ case OPT_mabi_ibmlongdouble:
+ M2Options_SetIBMLongDouble (value);
+ return 1;
+#endif
+#ifdef OPT_mabi_ieeelongdouble
+ case OPT_mabi_ieeelongdouble:
+ M2Options_SetIEEELongDouble (value);
+ return 1;
+#endif
case OPT_flocation_:
if (strcmp (arg, "builtins") == 0)
{
diff --git a/gcc/m2/gm2config.aci.in b/gcc/m2/gm2config.aci.in
index 5228ef0..cb9f505 100644
--- a/gcc/m2/gm2config.aci.in
+++ b/gcc/m2/gm2config.aci.in
@@ -48,12 +48,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* use __float128 for LONGREAL */
-#undef M2C_LONGREAL_FLOAT128
-
-/* target is ppc64le */
-#undef M2C_LONGREAL_PPC64LE
-
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
diff --git a/gcc/m2/gm2spec.cc b/gcc/m2/gm2spec.cc
index 6769ecc..a4faf88 100644
--- a/gcc/m2/gm2spec.cc
+++ b/gcc/m2/gm2spec.cc
@@ -475,15 +475,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
/* True if we should set up include paths and library paths. */
bool allow_libraries = true;
-#ifdef M2C_LONGREAL_PPC64LE
- /* Should we add -mabi=ieeelongdouble by default? */
-#ifdef M2C_LONGREAL_FLOAT128
- bool need_default_mabi = true;
-#else
- bool need_default_mabi = false;
-#endif
-#endif
-
#if defined(DEBUG_ARG)
printf ("argc = %d\n", argc);
fprintf (stderr, "Incoming:");
@@ -589,16 +580,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
args[i] |= SKIPOPT; /* We will add the option if it is needed. */
push_back_Ipath (decoded_options[i].arg);
break;
-#if defined(OPT_mabi_ibmlongdouble)
- case OPT_mabi_ibmlongdouble:
- need_default_mabi = false; /* User has specified a -mabi. */
- break;
-#endif
-#if defined(OPT_mabi_ieeelongdouble)
- case OPT_mabi_ieeelongdouble:
- need_default_mabi = true; /* User has specified a -mabi. */
- break;
-#endif
case OPT_nostdlib:
case OPT_nostdlib__:
case OPT_nodefaultlibs:
@@ -868,11 +849,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
if (need_plugin)
append_option (OPT_fplugin_, "m2rte", 1);
-#ifdef M2C_LONGREAL_PPC64LE
- if (need_default_mabi)
- append_option (OPT_mabi_ieeelongdouble, NULL, 1);
-#endif
-
if (linking)
{
if (allow_libraries)