This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] support decimal float modes only when enabled
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 Sep 2009 09:52:23 -0700
- Subject: [PATCH] support decimal float modes only when enabled
- Reply-to: janis187 at us dot ibm dot com
Targets that can support decimal floating point arithmetic always report
that they support those modes, even when GCC has been configured to
disable that support. With the support disabled the compiler can handle
the modes, but there is no runtime support. The C types _Decimal32,
_Decimal64, and _Decimal128 are available only when the support is
enabled.
Function default_decimal_float_supported_p returns ENABLE_DECIMAL_FLOAT.
This patch changes checks in target hooks for decimal float modes being
available to call that function instead of returning "true". It also
changes the testsuite check for decimal float support to check for the
mode instead of the C types. I'll need the testsuite change for C++
code, which doesn't support the C types.
Tested with full bootstrap and regtest for -m32/-m64 on powerpc64-linux
and with simple builds of C and running dfp.exp tests on i686-linux for
three separate builds configured with --enable-decimal-float=bid/dpd/no.
OK for trunk?
2009-09-16 Janis Johnson <janis187@us.ibm.com>
gcc/
* config/i386/i386.c (ix86_scalar_mode_supported_p): Don't return
unconditional true for decimal float modes.
* config/rs6000/rs6000.c (rs6000_scalar_mode_supported_p): Ditto.
* config/s390/s390.c (s390_scalar_mode_supported_p): Ditto.
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_dfp_nocache):
Check support via mode instead of C type.
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c (revision 151731)
+++ gcc/config/s390/s390.c (working copy)
@@ -366,7 +366,7 @@ static bool
s390_scalar_mode_supported_p (enum machine_mode mode)
{
if (DECIMAL_FLOAT_MODE_P (mode))
- return true;
+ return default_decimal_float_supported_p ();
else
return default_scalar_mode_supported_p (mode);
}
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 151731)
+++ gcc/config/i386/i386.c (working copy)
@@ -27996,7 +27996,7 @@ static bool
ix86_scalar_mode_supported_p (enum machine_mode mode)
{
if (DECIMAL_FLOAT_MODE_P (mode))
- return true;
+ return default_decimal_float_supported_p ();
else if (mode == TFmode)
return true;
else
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 151731)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -25395,7 +25395,7 @@ static bool
rs6000_scalar_mode_supported_p (enum machine_mode mode)
{
if (DECIMAL_FLOAT_MODE_P (mode))
- return true;
+ return default_decimal_float_supported_p ();
else
return default_scalar_mode_supported_p (mode);
}
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp (revision 151731)
+++ gcc/testsuite/lib/target-supports.exp (working copy)
@@ -1295,7 +1295,7 @@ proc check_effective_target_fixed_point
proc check_effective_target_dfp_nocache { } {
verbose "check_effective_target_dfp_nocache: compiling source" 2
set ret [check_no_compiler_messages_nocache dfp object {
- _Decimal32 x; _Decimal64 y; _Decimal128 z;
+ float x __attribute__((mode(DD)));
}]
verbose "check_effective_target_dfp_nocache: returning $ret" 2
return $ret