This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, RFC] Eliminate TARGET_FLOAT_FORMAT
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: rguenther at suse dot de
- Date: Sun, 10 Aug 2008 17:37:05 +0200 (CEST)
- Subject: [PATCH, RFC] Eliminate TARGET_FLOAT_FORMAT
Hello,
if the MODE_HAS_... removal patch is accepted, only two locations remain
in all of GCC that check for TARGET_FLOAT_FORMAT, and both seem to be
actually erroneous:
- One location in simplify_binary_operation_1 continues to check
TARGET_FLOAT_FORMAT instead of using the appropriate HONOR_... flags.
(This is within a #ifdef HAVE_cc0 block.)
- The Java front end convert function uses TARGET_FLOAT_FORMAT to decide
whether to use a special conversion from real to integer. However, it
seems to me this special conversion should be done in any case (also
when using the VAX floating point format), as it is required to
guarantee the proper overflow behaviour defined by Java. I therefore
think this check should simply be removed.
If we can eliminate those two remaining occurrances, all definitions of
TARGET_FLOAT_FORMAT can then be removed. All target floating point format
properties are now completely defined by the real_format structures.
This patch doesn't fix any actual problem on any target I'm aware of,
but it seems a nice clean-up opportunity to me ... What do you think?
Tested on spu-elf, s390-ibm-linux, and s390x-ibm-linux with no regressions.
Bye,
Ulrich
ChangeLog:
* defaults.h (TARGET_FLOAT_FORMAT): Remove.
(UNKNOWN_FLOAT_FORMAT, IEEE_FLOAT_FORMAT, VAX_FLOAT_FORMAT): Remove.
* config/alpha/alpha.h (TARGET_FLOAT_FORMAT): Remove.
* config/iq2000/iq2000.h (TARGET_FLOAT_FORMAT): Remove.
* config/pdp11/pdp11.h (TARGET_FLOAT_FORMAT): Remove.
* config/score/score.h (TARGET_FLOAT_FORMAT): Remove.
* config/vax/vax.h (TARGET_FLOAT_FORMAT): Remove.
* doc/tm.texi (Storage Layout): Remove documentation for
TARGET_FLOAT_FORMAT.
* simplify-rtx.c (simplify_binary_operation_1): Replace
TARGET_FLOAT_FORMAT check by appropriate HONOR_... checks.
java/ChangeLog:
* typeck.c (convert): Do not check for TARGET_FLOAT_FORMAT.
diff -urNp -x .svn gcc-head-new/gcc.orig/config/alpha/alpha.h gcc-head-new/gcc/config/alpha/alpha.h
--- gcc-head-new/gcc.orig/config/alpha/alpha.h 2008-06-10 23:21:54.000000000 +0200
+++ gcc-head-new/gcc/config/alpha/alpha.h 2008-08-07 23:58:44.000000000 +0200
@@ -245,10 +245,6 @@ extern enum alpha_fp_trap_mode alpha_fpt
/* Define the size of `long long'. The default is the twice the word size. */
#define LONG_LONG_TYPE_SIZE 64
-/* We're IEEE unless someone says to use VAX. */
-#define TARGET_FLOAT_FORMAT \
- (TARGET_FLOAT_VAX ? VAX_FLOAT_FORMAT : IEEE_FLOAT_FORMAT)
-
/* The two floating-point formats we support are S-floating, which is
4 bytes, and T-floating, which is 8 bytes. `float' is S and `double'
and `long double' are T. */
diff -urNp -x .svn gcc-head-new/gcc.orig/config/iq2000/iq2000.h gcc-head-new/gcc/config/iq2000/iq2000.h
--- gcc-head-new/gcc.orig/config/iq2000/iq2000.h 2008-06-10 23:22:49.000000000 +0200
+++ gcc-head-new/gcc/config/iq2000/iq2000.h 2008-08-07 23:58:44.000000000 +0200
@@ -128,8 +128,6 @@
#define PCC_BITFIELD_TYPE_MATTERS 1
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
/* Layout of Source Language Data Types. */
diff -urNp -x .svn gcc-head-new/gcc.orig/config/pdp11/pdp11.h gcc-head-new/gcc/config/pdp11/pdp11.h
--- gcc-head-new/gcc.orig/config/pdp11/pdp11.h 2008-06-10 23:22:37.000000000 +0200
+++ gcc-head-new/gcc/config/pdp11/pdp11.h 2008-08-07 23:58:44.000000000 +0200
@@ -100,8 +100,6 @@ along with GCC; see the file COPYING3.
big endian, opposite for what you need for float, the vax float
conversion routines aren't actually used directly. But the underlying
format is indeed the vax/pdp11 float format. */
-#define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
-
extern const struct real_format pdp11_f_format;
extern const struct real_format pdp11_d_format;
diff -urNp -x .svn gcc-head-new/gcc.orig/config/score/score.h gcc-head-new/gcc/config/score/score.h
--- gcc-head-new/gcc.orig/config/score/score.h 2008-06-10 23:23:18.000000000 +0200
+++ gcc-head-new/gcc/config/score/score.h 2008-08-07 23:58:44.000000000 +0200
@@ -198,8 +198,6 @@
support long double, we also want a 128-bit integer type. */
#define MAX_FIXED_MODE_SIZE LONG_DOUBLE_TYPE_SIZE
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
/* Layout of Data Type. */
/* Set the sizes of the core types. */
#define INT_TYPE_SIZE 32
diff -urNp -x .svn gcc-head-new/gcc.orig/config/vax/vax.h gcc-head-new/gcc/config/vax/vax.h
--- gcc-head-new/gcc.orig/config/vax/vax.h 2008-06-10 23:23:49.000000000 +0200
+++ gcc-head-new/gcc/config/vax/vax.h 2008-08-07 23:58:45.000000000 +0200
@@ -642,10 +642,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_
so give the MEM rtx a byte's mode. */
#define FUNCTION_MODE QImode
-/* This machine doesn't use IEEE floats. */
-
-#define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
-
/* Specify the cost of a branch insn; roughly the number of extra insns that
should be added to avoid a branch.
diff -urNp -x .svn gcc-head-new/gcc.orig/defaults.h gcc-head-new/gcc/defaults.h
--- gcc-head-new/gcc.orig/defaults.h 2008-08-07 23:58:35.000000000 +0200
+++ gcc-head-new/gcc/defaults.h 2008-08-07 23:58:44.000000000 +0200
@@ -663,16 +663,6 @@ along with GCC; see the file COPYING3.
#define PREFERRED_DEBUGGING_TYPE NO_DEBUG
#endif
-/* Define codes for all the float formats that we know of. */
-#define UNKNOWN_FLOAT_FORMAT 0
-#define IEEE_FLOAT_FORMAT 1
-#define VAX_FLOAT_FORMAT 2
-
-/* Default to IEEE float if not specified. Nearly all machines use it. */
-#ifndef TARGET_FLOAT_FORMAT
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-#endif
-
#ifndef LARGEST_EXPONENT_IS_NORMAL
#define LARGEST_EXPONENT_IS_NORMAL(SIZE) 0
#endif
diff -urNp -x .svn gcc-head-new/gcc.orig/doc/tm.texi gcc-head-new/gcc/doc/tm.texi
--- gcc-head-new/gcc.orig/doc/tm.texi 2008-08-07 23:58:36.000000000 +0200
+++ gcc-head-new/gcc/doc/tm.texi 2008-08-08 00:01:41.000000000 +0200
@@ -1385,28 +1385,6 @@ of shift instructions expanded to libgcc
targets.
@end deftypefn
-@defmac TARGET_FLOAT_FORMAT
-A code distinguishing the floating point format of the target machine.
-There are two defined values:
-
-@ftable @code
-@item IEEE_FLOAT_FORMAT
-This code indicates IEEE floating point. It is the default; there is no
-need to define @code{TARGET_FLOAT_FORMAT} when the format is IEEE@.
-
-@item VAX_FLOAT_FORMAT
-This code indicates the ``F float'' (for @code{float}) and ``D float''
-or ``G float'' formats (for @code{double}) used on the VAX and PDP-11@.
-@end ftable
-
-If your target uses a floating point format other than these, you must
-define a new @var{name}_FLOAT_FORMAT code for it, and add support for
-it to @file{real.c}.
-
-The ordering of the component words of floating point values stored in
-memory is controlled by @code{FLOAT_WORDS_BIG_ENDIAN}.
-@end defmac
-
@defmac ROUND_TOWARDS_ZERO
If defined, this macro should be true if the prevailing rounding
mode is towards zero.
diff -urNp -x .svn gcc-head-new/gcc.orig/java/typeck.c gcc-head-new/gcc/java/typeck.c
--- gcc-head-new/gcc.orig/java/typeck.c 2008-06-28 12:54:57.000000000 +0200
+++ gcc-head-new/gcc/java/typeck.c 2008-08-08 00:04:58.000000000 +0200
@@ -131,8 +131,7 @@ convert (tree type, tree expr)
if (type == char_type_node || type == promoted_char_type_node)
return fold_convert (type, expr);
if ((really_constant_p (expr) || ! flag_unsafe_math_optimizations)
- && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
- && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
+ && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE)
return convert_ieee_real_to_integer (type, expr);
else
{
diff -urNp -x .svn gcc-head-new/gcc.orig/simplify-rtx.c gcc-head-new/gcc/simplify-rtx.c
--- gcc-head-new/gcc.orig/simplify-rtx.c 2008-08-07 23:58:36.000000000 +0200
+++ gcc-head-new/gcc/simplify-rtx.c 2008-08-07 23:58:44.000000000 +0200
@@ -1740,9 +1740,8 @@ simplify_binary_operation_1 (enum rtx_co
so we can distinguish it from a register-register-copy.
In IEEE floating point, x-0 is not the same as x. */
-
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (mode) || flag_unsafe_math_optimizations)
+ if (!(HONOR_SIGNED_ZEROS (mode)
+ && HONOR_SIGN_DEPENDENT_ROUNDING (mode))
&& trueop1 == CONST0_RTX (mode))
return op0;
#endif
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com