diff mbox

[03/12] more removal of ifdef HAVE_cc0

Message ID 1429622658-9034-4-git-send-email-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org April 21, 2015, 1:24 p.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* combine.c (find_single_use): Remove HAVE_cc0 ifdef for code
	that is trivially ded on non cc0 targets.
	(simplify_set): Likewise.
	(mark_used_regs_combine): Likewise.
	* cse.c (new_basic_block): Likewise.
	(fold_rtx): Likewise.
	(cse_insn): Likewise.
	(cse_extended_basic_block): Likewise.
	(set_live_p): Likewise.
	* rtlanal.c (canonicalize_condition): Likewise.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
---
 gcc/combine.c      |  6 ------
 gcc/cse.c          | 18 ------------------
 gcc/rtlanal.c      |  2 --
 gcc/simplify-rtx.c |  5 ++---
 4 files changed, 2 insertions(+), 29 deletions(-)

Comments

Jeff Law April 21, 2015, 1:51 p.m. UTC | #1
On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* combine.c (find_single_use): Remove HAVE_cc0 ifdef for code
> 	that is trivially ded on non cc0 targets.
> 	(simplify_set): Likewise.
> 	(mark_used_regs_combine): Likewise.
> 	* cse.c (new_basic_block): Likewise.
> 	(fold_rtx): Likewise.
> 	(cse_insn): Likewise.
> 	(cse_extended_basic_block): Likewise.
> 	(set_live_p): Likewise.
> 	* rtlanal.c (canonicalize_condition): Likewise.
> 	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
OK.  I find myself wondering if the conditionals should look like
if (HAVE_cc0
     && (whatever))

But I doubt it makes any measurable difference.  It's something we can 
always add in the future if we feel the need to avoid the runtime checks 
for things that aren't ever going to happen on most modern targets.

jeff
Trevor Saunders April 21, 2015, 3:23 p.m. UTC | #2
On Tue, Apr 21, 2015 at 07:51:14AM -0600, Jeff Law wrote:
> On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> >From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> >gcc/ChangeLog:
> >
> >2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> >
> >	* combine.c (find_single_use): Remove HAVE_cc0 ifdef for code
> >	that is trivially ded on non cc0 targets.
> >	(simplify_set): Likewise.
> >	(mark_used_regs_combine): Likewise.
> >	* cse.c (new_basic_block): Likewise.
> >	(fold_rtx): Likewise.
> >	(cse_insn): Likewise.
> >	(cse_extended_basic_block): Likewise.
> >	(set_live_p): Likewise.
> >	* rtlanal.c (canonicalize_condition): Likewise.
> >	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
> OK.  I find myself wondering if the conditionals should look like
> if (HAVE_cc0
>     && (whatever))
> 
> But I doubt it makes any measurable difference.  It's something we can
> always add in the future if we feel the need to avoid the runtime checks for
> things that aren't ever going to happen on most modern targets.

 yeah, it seems reasonably likely the branch predictor can deal with
 this for us (I tried to ensure things handled this way didn't do much
 other than a compare).  If not well that's what profiling is for :-)

 Trev

> 
> jeff
>
diff mbox

Patch

diff --git a/gcc/combine.c b/gcc/combine.c
index 46cd6db..0a35b8f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -686,7 +686,6 @@  find_single_use (rtx dest, rtx_insn *insn, rtx_insn **ploc)
   rtx *result;
   struct insn_link *link;
 
-#ifdef HAVE_cc0
   if (dest == cc0_rtx)
     {
       next = NEXT_INSN (insn);
@@ -699,7 +698,6 @@  find_single_use (rtx dest, rtx_insn *insn, rtx_insn **ploc)
 	*ploc = next;
       return result;
     }
-#endif
 
   if (!REG_P (dest))
     return 0;
@@ -6724,7 +6722,6 @@  simplify_set (rtx x)
       src = SET_SRC (x), dest = SET_DEST (x);
     }
 
-#ifdef HAVE_cc0
   /* If we have (set (cc0) (subreg ...)), we try to remove the subreg
      in SRC.  */
   if (dest == cc0_rtx
@@ -6744,7 +6741,6 @@  simplify_set (rtx x)
 	  src = SET_SRC (x);
 	}
     }
-#endif
 
 #ifdef LOAD_EXTEND_OP
   /* If we have (set FOO (subreg:M (mem:N BAR) 0)) with M wider than N, this
@@ -13193,11 +13189,9 @@  mark_used_regs_combine (rtx x)
     case ADDR_VEC:
     case ADDR_DIFF_VEC:
     case ASM_INPUT:
-#ifdef HAVE_cc0
     /* CC0 must die in the insn after it is set, so we don't need to take
        special note of it here.  */
     case CC0:
-#endif
       return;
 
     case CLOBBER:
diff --git a/gcc/cse.c b/gcc/cse.c
index 2a33827..d184d27 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -281,7 +281,6 @@  struct qty_table_elem
 /* The table of all qtys, indexed by qty number.  */
 static struct qty_table_elem *qty_table;
 
-#ifdef HAVE_cc0
 /* For machines that have a CC0, we do not record its value in the hash
    table since its use is guaranteed to be the insn immediately following
    its definition and any other insn is presumed to invalidate it.
@@ -293,7 +292,6 @@  static struct qty_table_elem *qty_table;
 
 static rtx this_insn_cc0, prev_insn_cc0;
 static machine_mode this_insn_cc0_mode, prev_insn_cc0_mode;
-#endif
 
 /* Insn being scanned.  */
 
@@ -884,9 +882,7 @@  new_basic_block (void)
 	}
     }
 
-#ifdef HAVE_cc0
   prev_insn_cc0 = 0;
-#endif
 }
 
 /* Say that register REG contains a quantity in mode MODE not in any
@@ -3166,10 +3162,8 @@  fold_rtx (rtx x, rtx_insn *insn)
     case EXPR_LIST:
       return x;
 
-#ifdef HAVE_cc0
     case CC0:
       return prev_insn_cc0;
-#endif
 
     case ASM_OPERANDS:
       if (insn)
@@ -3223,7 +3217,6 @@  fold_rtx (rtx x, rtx_insn *insn)
 	    const_arg = folded_arg;
 	    break;
 
-#ifdef HAVE_cc0
 	  case CC0:
 	    /* The cc0-user and cc0-setter may be in different blocks if
 	       the cc0-setter potentially traps.  In that case PREV_INSN_CC0
@@ -3247,7 +3240,6 @@  fold_rtx (rtx x, rtx_insn *insn)
 		const_arg = equiv_constant (folded_arg);
 	      }
 	    break;
-#endif
 
 	  default:
 	    folded_arg = fold_rtx (folded_arg, insn);
@@ -4522,11 +4514,9 @@  cse_insn (rtx_insn *insn)
     sets = XALLOCAVEC (struct set, XVECLEN (x, 0));
 
   this_insn = insn;
-#ifdef HAVE_cc0
   /* Records what this insn does to set CC0.  */
   this_insn_cc0 = 0;
   this_insn_cc0_mode = VOIDmode;
-#endif
 
   /* Find all regs explicitly clobbered in this insn,
      to ensure they are not replaced with any other regs
@@ -5541,7 +5531,6 @@  cse_insn (rtx_insn *insn)
 	    }
 	}
 
-#ifdef HAVE_cc0
       /* If setting CC0, record what it was set to, or a constant, if it
 	 is equivalent to a constant.  If it is being set to a floating-point
 	 value, make a COMPARE with the appropriate constant of 0.  If we
@@ -5556,7 +5545,6 @@  cse_insn (rtx_insn *insn)
 	    this_insn_cc0 = gen_rtx_COMPARE (VOIDmode, this_insn_cc0,
 					     CONST0_RTX (mode));
 	}
-#endif
     }
 
   /* Now enter all non-volatile source expressions in the hash table
@@ -6604,11 +6592,9 @@  cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
 	  record_jump_equiv (insn, taken);
 	}
 
-#ifdef HAVE_cc0
       /* Clear the CC0-tracking related insns, they can't provide
 	 useful information across basic block boundaries.  */
       prev_insn_cc0 = 0;
-#endif
     }
 
   gcc_assert (next_qty <= max_qty);
@@ -6859,21 +6845,17 @@  static bool
 set_live_p (rtx set, rtx_insn *insn ATTRIBUTE_UNUSED, /* Only used with HAVE_cc0.  */
 	    int *counts)
 {
-#ifdef HAVE_cc0
   rtx tem;
-#endif
 
   if (set_noop_p (set))
     ;
 
-#ifdef HAVE_cc0
   else if (GET_CODE (SET_DEST (set)) == CC0
 	   && !side_effects_p (SET_SRC (set))
 	   && ((tem = next_nonnote_nondebug_insn (insn)) == NULL_RTX
 	       || !INSN_P (tem)
 	       || !reg_referenced_p (cc0_rtx, PATTERN (tem))))
     return false;
-#endif
   else if (!is_dead_reg (SET_DEST (set), counts)
 	   || side_effects_p (SET_SRC (set)))
     return true;
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 743aad6..2377f25a 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5035,7 +5035,6 @@  canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
       /* Set nonzero when we find something of interest.  */
       rtx x = 0;
 
-#ifdef HAVE_cc0
       /* If comparison with cc0, import actual comparison from compare
 	 insn.  */
       if (op0 == cc0_rtx)
@@ -5051,7 +5050,6 @@  canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
 	  if (earliest)
 	    *earliest = prev;
 	}
-#endif
 
       /* If this is a COMPARE, pick up the two things being compared.  */
       if (GET_CODE (op0) == COMPARE)
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 5d17498..61e440f 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2180,15 +2180,14 @@  simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
 	  rtx xop00 = XEXP (op0, 0);
 	  rtx xop10 = XEXP (op1, 0);
 
-#ifdef HAVE_cc0
 	  if (GET_CODE (xop00) == CC0 && GET_CODE (xop10) == CC0)
-#else
+	      return xop00;
+
 	    if (REG_P (xop00) && REG_P (xop10)
 		&& GET_MODE (xop00) == GET_MODE (xop10)
 		&& REGNO (xop00) == REGNO (xop10)
 		&& GET_MODE_CLASS (GET_MODE (xop00)) == MODE_CC
 		&& GET_MODE_CLASS (GET_MODE (xop10)) == MODE_CC)
-#endif
 	      return xop00;
 	}
       break;