[committed] arm: clean up some legacy FPA related cruft.

Message ID 20240709134556.3474164-1-rearnsha@arm.com
State New
Headers
Series [committed] arm: clean up some legacy FPA related cruft. |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged

Commit Message

Richard Earnshaw July 9, 2024, 1:45 p.m. UTC
  Support for the FPA on Arm was removed after gcc-4.7, but this little
bit of crufty code was left behind.  In particular the code to support
the 'N' modifier in assembly code was left behind and this lead to a
trail of other code that depended on it, even though most of the
constants that it supported had been removed in the original cleanup.

This patch removes most of the remaining cruft and simplifies the one
bit that remains: to determine whether an RTL construct contains 0.0 we
don't need to convert it to a real value, we can simply compare it to
CONST0_RTX of the appropriate mode.

gcc/

	* config/arm/arm.cc (fp_consts_initited): Delete variable.
	(value_fp0): Likewise.
	(init_fp_table): Delete function.
	(fp_const_from_val): Likewise.
	(arm_const_double_rtx): Rework to avoid converting to REAL_VALUE_TYPE.
	(arm_print_operand, case 'N'): Make use of this case an error.
---
 gcc/config/arm/arm.cc | 61 +++++++------------------------------------
 1 file changed, 10 insertions(+), 51 deletions(-)
  

Patch

diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index 459b7e648ab..93993d95eb9 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -117,7 +117,6 @@  static bool arm_assemble_integer (rtx, unsigned int, int);
 static void arm_print_operand (FILE *, rtx, int);
 static void arm_print_operand_address (FILE *, machine_mode, rtx);
 static bool arm_print_operand_punct_valid_p (unsigned char code);
-static const char *fp_const_from_val (REAL_VALUE_TYPE *);
 static arm_cc get_arm_condition_code (rtx);
 static bool arm_fixed_condition_code_regs (unsigned int *, unsigned int *);
 static const char *output_multi_immediate (rtx *, const char *, const char *,
@@ -12822,37 +12821,12 @@  arm_cortex_m7_branch_cost (bool speed_p, bool predictable_p)
   return speed_p ? 0 : arm_default_branch_cost (speed_p, predictable_p);
 }
 
-static bool fp_consts_inited = false;
-
-static REAL_VALUE_TYPE value_fp0;
-
-static void
-init_fp_table (void)
-{
-  REAL_VALUE_TYPE r;
-
-  r = REAL_VALUE_ATOF ("0", DFmode);
-  value_fp0 = r;
-  fp_consts_inited = true;
-}
-
 /* Return TRUE if rtx X is a valid immediate FP constant.  */
 int
 arm_const_double_rtx (rtx x)
 {
-  const REAL_VALUE_TYPE *r;
-
-  if (!fp_consts_inited)
-    init_fp_table ();
-
-  r = CONST_DOUBLE_REAL_VALUE (x);
-  if (REAL_VALUE_MINUS_ZERO (*r))
-    return 0;
-
-  if (real_equal (r, &value_fp0))
-    return 1;
-
-  return 0;
+  return (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT
+	  && x == CONST0_RTX (GET_MODE (x)));
 }
 
 /* VFPv3 has a fairly wide range of representable immediates, formed from
@@ -19793,17 +19767,6 @@  arm_reorg (void)
 
 /* Routines to output assembly language.  */
 
-/* Return string representation of passed in real value.  */
-static const char *
-fp_const_from_val (REAL_VALUE_TYPE *r)
-{
-  if (!fp_consts_inited)
-    init_fp_table ();
-
-  gcc_assert (real_equal (r, &value_fp0));
-  return "0";
-}
-
 /* OPERANDS[0] is the entire list of insns that constitute pop,
    OPERANDS[1] is the base register, RETURN_PC is true iff return insn
    is in the list, UPDATE is true iff the list contains explicit
@@ -24160,8 +24123,8 @@  arm_print_condition (FILE *stream)
 /* Globally reserved letters: acln
    Puncutation letters currently used: @_|?().!#
    Lower case letters currently used: bcdefhimpqtvwxyz
-   Upper case letters currently used: ABCDEFGHIJKLMNOPQRSTUV
-   Letters previously used, but now deprecated/obsolete: sWXYZ.
+   Upper case letters currently used: ABCDEFGHIJKLMOPQRSTUV
+   Letters previously used, but now deprecated/obsolete: sNWXYZ.
 
    Note that the global reservation for 'c' is only for CONSTANT_ADDRESS_P.
 
@@ -24174,8 +24137,6 @@  arm_print_condition (FILE *stream)
    in these cases the instruction pattern will take care to make sure that
    an instruction containing %d will follow, thereby undoing the effects of
    doing this instruction unconditionally.
-   If CODE is 'N' then X is a floating point operand that must be negated
-   before output.
    If CODE is 'B' then output a bitwise inverted value of X (a const int).
    If X is a REG and CODE is `M', output a ldm/stm style multi-reg.
    If CODE is 'V', then the operand must be a CONST_INT representing
@@ -24226,14 +24187,6 @@  arm_print_operand (FILE *stream, rtx x, int code)
     case '#':
       return;
 
-    case 'N':
-      {
-	REAL_VALUE_TYPE r;
-	r = real_value_negate (CONST_DOUBLE_REAL_VALUE (x));
-	fprintf (stream, "%s", fp_const_from_val (&r));
-      }
-      return;
-
     /* An integer or symbol address without a preceding # sign.  */
     case 'c':
       switch (GET_CODE (x))
@@ -24510,6 +24463,12 @@  arm_print_operand (FILE *stream, rtx x, int code)
       }
       return;
 
+    case 'N':
+      /* Former FPA support, effectively unused after GCC-4.7, but not
+	 removed until gcc-15.  */
+      output_operand_lossage ("obsolete FPA format code '%c'", code);
+      return;
+
     case 's':
     case 'W':
     case 'X':