public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/segher/heads/cc0)] delete CC0_P
@ 2020-12-15 15:51 Segher Boessenkool
  0 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2020-12-15 15:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:710e377c6552d7c1da94243565f7c326eb7b3f78

commit 710e377c6552d7c1da94243565f7c326eb7b3f78
Author: Segher Boessenkool <segher@kernel.crashing.org>
Date:   Sun Sep 22 03:34:56 2019 +0000

    delete CC0_P

Diff:
---
 gcc/combine.c      |  8 ++------
 gcc/cprop.c        | 21 +++++++--------------
 gcc/genconfig.c    | 12 ++----------
 gcc/jump.c         |  2 +-
 gcc/rtlanal.c      |  4 ----
 gcc/simplify-rtx.c |  5 ++---
 6 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index e81a3d18dc2..735f4b937b7 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6181,8 +6181,7 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest,
       /* If the first operand is a condition code, we can't do anything
 	 with it.  */
       if (GET_CODE (XEXP (x, 0)) == COMPARE
-	  || (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC
-	      && ! CC0_P (XEXP (x, 0))))
+	  || GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC)
 	{
 	  rtx op0 = XEXP (x, 0);
 	  rtx op1 = XEXP (x, 1);
@@ -6798,9 +6797,7 @@ simplify_set (rtx x)
   /* If we are setting CC0 or if the source is a COMPARE, look for the use of
      the comparison result and try to simplify it unless we already have used
      undobuf.other_insn.  */
-  if ((GET_MODE_CLASS (mode) == MODE_CC
-       || GET_CODE (src) == COMPARE
-       || CC0_P (dest))
+  if ((GET_MODE_CLASS (mode) == MODE_CC || GET_CODE (src) == COMPARE)
       && (cc_use = find_single_use (dest, subst_insn, &other_insn)) != 0
       && (undobuf.other_insn == 0 || other_insn == undobuf.other_insn)
       && COMPARISON_P (*cc_use)
@@ -12190,7 +12187,6 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
 	  /* We can't do anything if OP0 is a condition code value, rather
 	     than an actual data value.  */
 	  if (const_op != 0
-	      || CC0_P (XEXP (op0, 0))
 	      || GET_MODE_CLASS (GET_MODE (XEXP (op0, 0))) == MODE_CC)
 	    break;
 
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 169ca804e33..d9fd0525702 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -963,10 +963,6 @@ cprop_jump (basic_block bb, rtx_insn *setcc, rtx_insn *jump, rtx from, rtx src)
 	remove_note (jump, note);
      }
 
-  /* Delete the cc0 setter.  */
-  if (HAVE_cc0 && setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
-    delete_insn (setcc);
-
   global_const_prop_count++;
   if (dump_file != NULL)
     {
@@ -1008,14 +1004,14 @@ constprop_register (rtx from, rtx src, rtx_insn *insn)
 {
   rtx sset;
 
-  /* Check for reg or cc0 setting instructions followed by
-     conditional branch instructions first.  */
+  /* Check for reg setting instructions followed by conditional branch
+     instructions first.  */
   if ((sset = single_set (insn)) != NULL
       && NEXT_INSN (insn)
       && any_condjump_p (NEXT_INSN (insn)) && onlyjump_p (NEXT_INSN (insn)))
     {
       rtx dest = SET_DEST (sset);
-      if ((REG_P (dest) || CC0_P (dest))
+      if (REG_P (dest)
 	  && cprop_jump (BLOCK_FOR_INSN (insn), insn, NEXT_INSN (insn),
 			 from, src))
 	return 1;
@@ -1634,8 +1630,7 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
 	  /* Avoid unification of the edge with other edges from original
 	     branch.  We would end up emitting the instruction on "both"
 	     edges.  */
-	  if (dest && setcc && !CC0_P (SET_DEST (PATTERN (setcc)))
-	      && find_edge (e->src, dest))
+	  if (dest && setcc && find_edge (e->src, dest))
 	    dest = NULL;
 
 	  old_dest = e->dest;
@@ -1645,13 +1640,11 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
             {
 	      redirect_edge_and_branch_force (e, dest);
 
-	      /* Copy the register setter to the redirected edge.
-		 Don't copy CC0 setters, as CC0 is dead after jump.  */
+	      /* Copy the register setter to the redirected edge.  */
 	      if (setcc)
 		{
 		  rtx pat = PATTERN (setcc);
-		  if (!CC0_P (SET_DEST (pat)))
-		    insert_insn_on_edge (copy_insn (pat), e);
+		  insert_insn_on_edge (copy_insn (pat), e);
 		}
 
 	      if (dump_file != NULL)
@@ -1717,7 +1710,7 @@ bypass_conditional_jumps (void)
 		  break;
 
 		dest = SET_DEST (PATTERN (insn));
-		if (REG_P (dest) || CC0_P (dest))
+		if (REG_P (dest))
 		  setcc = insn;
 		else
 		  break;
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 5a95676a312..b1abebf0585 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -330,17 +330,9 @@ main (int argc, const char **argv)
   printf ("#endif\n");
 
   if (have_cc0_flag)
-    {
-      printf ("#define HAVE_cc0 1\n");
-      printf ("#define CC0_P(X) ((X) == cc0_rtx)\n");
-    }
+    printf ("#define HAVE_cc0 1\n");
   else
-    {
-      /* We output CC0_P this way to make sure that X is declared
-	 somewhere.  */
-      printf ("#define HAVE_cc0 0\n");
-      printf ("#define CC0_P(X) ((X) ? 0 : 0)\n");
-    }
+    printf ("#define HAVE_cc0 0\n");
 
   if (have_cmove_flag)
     printf ("#define HAVE_conditional_move 1\n");
diff --git a/gcc/jump.c b/gcc/jump.c
index e6ea74960a3..26317546030 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -400,7 +400,7 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
       break;
     }
 
-  if (GET_MODE_CLASS (mode) == MODE_CC || CC0_P (arg0))
+  if (GET_MODE_CLASS (mode) == MODE_CC)
     {
       /* Try to search for the comparison to determine the real mode.
          This code is expensive, but with sane machine description it
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index ebc5822700c..9894377b5f9 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5732,10 +5732,6 @@ canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
 	}
     }
 
-  /* Never return CC0; return zero instead.  */
-  if (CC0_P (op0))
-    return 0;
-
   /* We promised to return a comparison.  */
   rtx ret = gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
   if (COMPARISON_P (ret))
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 47e7aebda8a..4cedfbb05a3 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -5302,8 +5302,7 @@ simplify_relational_operation (enum rtx_code code, machine_mode mode,
     return simplify_gen_relational (code, mode, VOIDmode,
 				    XEXP (op0, 0), XEXP (op0, 1));
 
-  if (GET_MODE_CLASS (cmp_mode) == MODE_CC
-      || CC0_P (op0))
+  if (GET_MODE_CLASS (cmp_mode) == MODE_CC)
     return NULL_RTX;
 
   trueop0 = avoid_constant_pool_reference (op0);
@@ -5668,7 +5667,7 @@ simplify_const_relational_operation (enum rtx_code code,
 
   /* We can't simplify MODE_CC values since we don't know what the
      actual comparison is.  */
-  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC || CC0_P (op0))
+  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC)
     return 0;
 
   /* Make sure the constant is second.  */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/segher/heads/cc0)] delete CC0_P
@ 2020-12-15 17:04 Segher Boessenkool
  0 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2020-12-15 17:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5cce0f7e03d0b07fabdc0945a7a638c4ba6da525

commit 5cce0f7e03d0b07fabdc0945a7a638c4ba6da525
Author: Segher Boessenkool <segher@kernel.crashing.org>
Date:   Sun Sep 22 03:34:56 2019 +0000

    delete CC0_P

Diff:
---
 gcc/combine.c      |  8 ++------
 gcc/cprop.c        | 21 +++++++--------------
 gcc/genconfig.c    | 12 ++----------
 gcc/jump.c         |  2 +-
 gcc/rtlanal.c      |  4 ----
 gcc/simplify-rtx.c |  5 ++---
 6 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index e81a3d18dc2..735f4b937b7 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6181,8 +6181,7 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest,
       /* If the first operand is a condition code, we can't do anything
 	 with it.  */
       if (GET_CODE (XEXP (x, 0)) == COMPARE
-	  || (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC
-	      && ! CC0_P (XEXP (x, 0))))
+	  || GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC)
 	{
 	  rtx op0 = XEXP (x, 0);
 	  rtx op1 = XEXP (x, 1);
@@ -6798,9 +6797,7 @@ simplify_set (rtx x)
   /* If we are setting CC0 or if the source is a COMPARE, look for the use of
      the comparison result and try to simplify it unless we already have used
      undobuf.other_insn.  */
-  if ((GET_MODE_CLASS (mode) == MODE_CC
-       || GET_CODE (src) == COMPARE
-       || CC0_P (dest))
+  if ((GET_MODE_CLASS (mode) == MODE_CC || GET_CODE (src) == COMPARE)
       && (cc_use = find_single_use (dest, subst_insn, &other_insn)) != 0
       && (undobuf.other_insn == 0 || other_insn == undobuf.other_insn)
       && COMPARISON_P (*cc_use)
@@ -12190,7 +12187,6 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
 	  /* We can't do anything if OP0 is a condition code value, rather
 	     than an actual data value.  */
 	  if (const_op != 0
-	      || CC0_P (XEXP (op0, 0))
 	      || GET_MODE_CLASS (GET_MODE (XEXP (op0, 0))) == MODE_CC)
 	    break;
 
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 169ca804e33..d9fd0525702 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -963,10 +963,6 @@ cprop_jump (basic_block bb, rtx_insn *setcc, rtx_insn *jump, rtx from, rtx src)
 	remove_note (jump, note);
      }
 
-  /* Delete the cc0 setter.  */
-  if (HAVE_cc0 && setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
-    delete_insn (setcc);
-
   global_const_prop_count++;
   if (dump_file != NULL)
     {
@@ -1008,14 +1004,14 @@ constprop_register (rtx from, rtx src, rtx_insn *insn)
 {
   rtx sset;
 
-  /* Check for reg or cc0 setting instructions followed by
-     conditional branch instructions first.  */
+  /* Check for reg setting instructions followed by conditional branch
+     instructions first.  */
   if ((sset = single_set (insn)) != NULL
       && NEXT_INSN (insn)
       && any_condjump_p (NEXT_INSN (insn)) && onlyjump_p (NEXT_INSN (insn)))
     {
       rtx dest = SET_DEST (sset);
-      if ((REG_P (dest) || CC0_P (dest))
+      if (REG_P (dest)
 	  && cprop_jump (BLOCK_FOR_INSN (insn), insn, NEXT_INSN (insn),
 			 from, src))
 	return 1;
@@ -1634,8 +1630,7 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
 	  /* Avoid unification of the edge with other edges from original
 	     branch.  We would end up emitting the instruction on "both"
 	     edges.  */
-	  if (dest && setcc && !CC0_P (SET_DEST (PATTERN (setcc)))
-	      && find_edge (e->src, dest))
+	  if (dest && setcc && find_edge (e->src, dest))
 	    dest = NULL;
 
 	  old_dest = e->dest;
@@ -1645,13 +1640,11 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
             {
 	      redirect_edge_and_branch_force (e, dest);
 
-	      /* Copy the register setter to the redirected edge.
-		 Don't copy CC0 setters, as CC0 is dead after jump.  */
+	      /* Copy the register setter to the redirected edge.  */
 	      if (setcc)
 		{
 		  rtx pat = PATTERN (setcc);
-		  if (!CC0_P (SET_DEST (pat)))
-		    insert_insn_on_edge (copy_insn (pat), e);
+		  insert_insn_on_edge (copy_insn (pat), e);
 		}
 
 	      if (dump_file != NULL)
@@ -1717,7 +1710,7 @@ bypass_conditional_jumps (void)
 		  break;
 
 		dest = SET_DEST (PATTERN (insn));
-		if (REG_P (dest) || CC0_P (dest))
+		if (REG_P (dest))
 		  setcc = insn;
 		else
 		  break;
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 5a95676a312..b1abebf0585 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -330,17 +330,9 @@ main (int argc, const char **argv)
   printf ("#endif\n");
 
   if (have_cc0_flag)
-    {
-      printf ("#define HAVE_cc0 1\n");
-      printf ("#define CC0_P(X) ((X) == cc0_rtx)\n");
-    }
+    printf ("#define HAVE_cc0 1\n");
   else
-    {
-      /* We output CC0_P this way to make sure that X is declared
-	 somewhere.  */
-      printf ("#define HAVE_cc0 0\n");
-      printf ("#define CC0_P(X) ((X) ? 0 : 0)\n");
-    }
+    printf ("#define HAVE_cc0 0\n");
 
   if (have_cmove_flag)
     printf ("#define HAVE_conditional_move 1\n");
diff --git a/gcc/jump.c b/gcc/jump.c
index e6ea74960a3..26317546030 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -400,7 +400,7 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
       break;
     }
 
-  if (GET_MODE_CLASS (mode) == MODE_CC || CC0_P (arg0))
+  if (GET_MODE_CLASS (mode) == MODE_CC)
     {
       /* Try to search for the comparison to determine the real mode.
          This code is expensive, but with sane machine description it
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index a76e7c54704..00aaa38996b 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5728,10 +5728,6 @@ canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
 	}
     }
 
-  /* Never return CC0; return zero instead.  */
-  if (CC0_P (op0))
-    return 0;
-
   /* We promised to return a comparison.  */
   rtx ret = gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
   if (COMPARISON_P (ret))
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 47e7aebda8a..4cedfbb05a3 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -5302,8 +5302,7 @@ simplify_relational_operation (enum rtx_code code, machine_mode mode,
     return simplify_gen_relational (code, mode, VOIDmode,
 				    XEXP (op0, 0), XEXP (op0, 1));
 
-  if (GET_MODE_CLASS (cmp_mode) == MODE_CC
-      || CC0_P (op0))
+  if (GET_MODE_CLASS (cmp_mode) == MODE_CC)
     return NULL_RTX;
 
   trueop0 = avoid_constant_pool_reference (op0);
@@ -5668,7 +5667,7 @@ simplify_const_relational_operation (enum rtx_code code,
 
   /* We can't simplify MODE_CC values since we don't know what the
      actual comparison is.  */
-  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC || CC0_P (op0))
+  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC)
     return 0;
 
   /* Make sure the constant is second.  */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/segher/heads/cc0)] delete CC0_P
@ 2020-06-15 19:23 Segher Boessenkool
  0 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2020-06-15 19:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:332578f6b4cb4a48d32e8842760ca7274a52f5bd

commit 332578f6b4cb4a48d32e8842760ca7274a52f5bd
Author: Segher Boessenkool <segher@kernel.crashing.org>
Date:   Sun Sep 22 03:34:56 2019 +0000

    delete CC0_P

Diff:
---
 gcc/combine.c      |  8 ++------
 gcc/cprop.c        | 21 +++++++--------------
 gcc/genconfig.c    | 12 ++----------
 gcc/jump.c         |  2 +-
 gcc/rtlanal.c      |  4 ----
 gcc/simplify-rtx.c |  5 ++---
 6 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index f575dd3f47b..8a30e29b54e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6180,8 +6180,7 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest,
       /* If the first operand is a condition code, we can't do anything
 	 with it.  */
       if (GET_CODE (XEXP (x, 0)) == COMPARE
-	  || (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC
-	      && ! CC0_P (XEXP (x, 0))))
+	  || GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC)
 	{
 	  rtx op0 = XEXP (x, 0);
 	  rtx op1 = XEXP (x, 1);
@@ -6797,9 +6796,7 @@ simplify_set (rtx x)
   /* If we are setting CC0 or if the source is a COMPARE, look for the use of
      the comparison result and try to simplify it unless we already have used
      undobuf.other_insn.  */
-  if ((GET_MODE_CLASS (mode) == MODE_CC
-       || GET_CODE (src) == COMPARE
-       || CC0_P (dest))
+  if ((GET_MODE_CLASS (mode) == MODE_CC || GET_CODE (src) == COMPARE)
       && (cc_use = find_single_use (dest, subst_insn, &other_insn)) != 0
       && (undobuf.other_insn == 0 || other_insn == undobuf.other_insn)
       && COMPARISON_P (*cc_use)
@@ -12168,7 +12165,6 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
 	  /* We can't do anything if OP0 is a condition code value, rather
 	     than an actual data value.  */
 	  if (const_op != 0
-	      || CC0_P (XEXP (op0, 0))
 	      || GET_MODE_CLASS (GET_MODE (XEXP (op0, 0))) == MODE_CC)
 	    break;
 
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 169ca804e33..d9fd0525702 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -963,10 +963,6 @@ cprop_jump (basic_block bb, rtx_insn *setcc, rtx_insn *jump, rtx from, rtx src)
 	remove_note (jump, note);
      }
 
-  /* Delete the cc0 setter.  */
-  if (HAVE_cc0 && setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
-    delete_insn (setcc);
-
   global_const_prop_count++;
   if (dump_file != NULL)
     {
@@ -1008,14 +1004,14 @@ constprop_register (rtx from, rtx src, rtx_insn *insn)
 {
   rtx sset;
 
-  /* Check for reg or cc0 setting instructions followed by
-     conditional branch instructions first.  */
+  /* Check for reg setting instructions followed by conditional branch
+     instructions first.  */
   if ((sset = single_set (insn)) != NULL
       && NEXT_INSN (insn)
       && any_condjump_p (NEXT_INSN (insn)) && onlyjump_p (NEXT_INSN (insn)))
     {
       rtx dest = SET_DEST (sset);
-      if ((REG_P (dest) || CC0_P (dest))
+      if (REG_P (dest)
 	  && cprop_jump (BLOCK_FOR_INSN (insn), insn, NEXT_INSN (insn),
 			 from, src))
 	return 1;
@@ -1634,8 +1630,7 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
 	  /* Avoid unification of the edge with other edges from original
 	     branch.  We would end up emitting the instruction on "both"
 	     edges.  */
-	  if (dest && setcc && !CC0_P (SET_DEST (PATTERN (setcc)))
-	      && find_edge (e->src, dest))
+	  if (dest && setcc && find_edge (e->src, dest))
 	    dest = NULL;
 
 	  old_dest = e->dest;
@@ -1645,13 +1640,11 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
             {
 	      redirect_edge_and_branch_force (e, dest);
 
-	      /* Copy the register setter to the redirected edge.
-		 Don't copy CC0 setters, as CC0 is dead after jump.  */
+	      /* Copy the register setter to the redirected edge.  */
 	      if (setcc)
 		{
 		  rtx pat = PATTERN (setcc);
-		  if (!CC0_P (SET_DEST (pat)))
-		    insert_insn_on_edge (copy_insn (pat), e);
+		  insert_insn_on_edge (copy_insn (pat), e);
 		}
 
 	      if (dump_file != NULL)
@@ -1717,7 +1710,7 @@ bypass_conditional_jumps (void)
 		  break;
 
 		dest = SET_DEST (PATTERN (insn));
-		if (REG_P (dest) || CC0_P (dest))
+		if (REG_P (dest))
 		  setcc = insn;
 		else
 		  break;
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 5a95676a312..b1abebf0585 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -330,17 +330,9 @@ main (int argc, const char **argv)
   printf ("#endif\n");
 
   if (have_cc0_flag)
-    {
-      printf ("#define HAVE_cc0 1\n");
-      printf ("#define CC0_P(X) ((X) == cc0_rtx)\n");
-    }
+    printf ("#define HAVE_cc0 1\n");
   else
-    {
-      /* We output CC0_P this way to make sure that X is declared
-	 somewhere.  */
-      printf ("#define HAVE_cc0 0\n");
-      printf ("#define CC0_P(X) ((X) ? 0 : 0)\n");
-    }
+    printf ("#define HAVE_cc0 0\n");
 
   if (have_cmove_flag)
     printf ("#define HAVE_conditional_move 1\n");
diff --git a/gcc/jump.c b/gcc/jump.c
index b36b9894f2e..b6469031904 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -400,7 +400,7 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
       break;
     }
 
-  if (GET_MODE_CLASS (mode) == MODE_CC || CC0_P (arg0))
+  if (GET_MODE_CLASS (mode) == MODE_CC)
     {
       /* Try to search for the comparison to determine the real mode.
          This code is expensive, but with sane machine description it
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 94c1f669e1b..93170a4394e 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5728,10 +5728,6 @@ canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
 	}
     }
 
-  /* Never return CC0; return zero instead.  */
-  if (CC0_P (op0))
-    return 0;
-
   /* We promised to return a comparison.  */
   rtx ret = gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
   if (COMPARISON_P (ret))
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 28c2dc69ae7..a92eb2ee4e9 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -5130,8 +5130,7 @@ simplify_relational_operation (enum rtx_code code, machine_mode mode,
     return simplify_gen_relational (code, mode, VOIDmode,
 				    XEXP (op0, 0), XEXP (op0, 1));
 
-  if (GET_MODE_CLASS (cmp_mode) == MODE_CC
-      || CC0_P (op0))
+  if (GET_MODE_CLASS (cmp_mode) == MODE_CC)
     return NULL_RTX;
 
   trueop0 = avoid_constant_pool_reference (op0);
@@ -5496,7 +5495,7 @@ simplify_const_relational_operation (enum rtx_code code,
 
   /* We can't simplify MODE_CC values since we don't know what the
      actual comparison is.  */
-  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC || CC0_P (op0))
+  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC)
     return 0;
 
   /* Make sure the constant is second.  */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/segher/heads/cc0)] delete CC0_P
@ 2020-02-04 21:55 Segher Boessenkool
  0 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2020-02-04 21:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:79b07eb91f7fc31e1b07efba6b8859523050c951

commit 79b07eb91f7fc31e1b07efba6b8859523050c951
Author: Segher Boessenkool <segher@kernel.crashing.org>
Date:   Sun Sep 22 03:34:56 2019 +0000

    delete CC0_P

Diff:
---
 gcc/combine.c      |  8 ++------
 gcc/cprop.c        | 21 +++++++--------------
 gcc/genconfig.c    | 12 ++----------
 gcc/jump.c         |  2 +-
 gcc/rtlanal.c      |  4 ----
 gcc/simplify-rtx.c |  5 ++---
 6 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index b5967e6..ef6f8e7 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6176,8 +6176,7 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest,
       /* If the first operand is a condition code, we can't do anything
 	 with it.  */
       if (GET_CODE (XEXP (x, 0)) == COMPARE
-	  || (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC
-	      && ! CC0_P (XEXP (x, 0))))
+	  || GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC)
 	{
 	  rtx op0 = XEXP (x, 0);
 	  rtx op1 = XEXP (x, 1);
@@ -6790,9 +6789,7 @@ simplify_set (rtx x)
   /* If we are setting CC0 or if the source is a COMPARE, look for the use of
      the comparison result and try to simplify it unless we already have used
      undobuf.other_insn.  */
-  if ((GET_MODE_CLASS (mode) == MODE_CC
-       || GET_CODE (src) == COMPARE
-       || CC0_P (dest))
+  if ((GET_MODE_CLASS (mode) == MODE_CC || GET_CODE (src) == COMPARE)
       && (cc_use = find_single_use (dest, subst_insn, &other_insn)) != 0
       && (undobuf.other_insn == 0 || other_insn == undobuf.other_insn)
       && COMPARISON_P (*cc_use)
@@ -12161,7 +12158,6 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
 	  /* We can't do anything if OP0 is a condition code value, rather
 	     than an actual data value.  */
 	  if (const_op != 0
-	      || CC0_P (XEXP (op0, 0))
 	      || GET_MODE_CLASS (GET_MODE (XEXP (op0, 0))) == MODE_CC)
 	    break;
 
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 169ca80..d9fd052 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -963,10 +963,6 @@ cprop_jump (basic_block bb, rtx_insn *setcc, rtx_insn *jump, rtx from, rtx src)
 	remove_note (jump, note);
      }
 
-  /* Delete the cc0 setter.  */
-  if (HAVE_cc0 && setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
-    delete_insn (setcc);
-
   global_const_prop_count++;
   if (dump_file != NULL)
     {
@@ -1008,14 +1004,14 @@ constprop_register (rtx from, rtx src, rtx_insn *insn)
 {
   rtx sset;
 
-  /* Check for reg or cc0 setting instructions followed by
-     conditional branch instructions first.  */
+  /* Check for reg setting instructions followed by conditional branch
+     instructions first.  */
   if ((sset = single_set (insn)) != NULL
       && NEXT_INSN (insn)
       && any_condjump_p (NEXT_INSN (insn)) && onlyjump_p (NEXT_INSN (insn)))
     {
       rtx dest = SET_DEST (sset);
-      if ((REG_P (dest) || CC0_P (dest))
+      if (REG_P (dest)
 	  && cprop_jump (BLOCK_FOR_INSN (insn), insn, NEXT_INSN (insn),
 			 from, src))
 	return 1;
@@ -1634,8 +1630,7 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
 	  /* Avoid unification of the edge with other edges from original
 	     branch.  We would end up emitting the instruction on "both"
 	     edges.  */
-	  if (dest && setcc && !CC0_P (SET_DEST (PATTERN (setcc)))
-	      && find_edge (e->src, dest))
+	  if (dest && setcc && find_edge (e->src, dest))
 	    dest = NULL;
 
 	  old_dest = e->dest;
@@ -1645,13 +1640,11 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
             {
 	      redirect_edge_and_branch_force (e, dest);
 
-	      /* Copy the register setter to the redirected edge.
-		 Don't copy CC0 setters, as CC0 is dead after jump.  */
+	      /* Copy the register setter to the redirected edge.  */
 	      if (setcc)
 		{
 		  rtx pat = PATTERN (setcc);
-		  if (!CC0_P (SET_DEST (pat)))
-		    insert_insn_on_edge (copy_insn (pat), e);
+		  insert_insn_on_edge (copy_insn (pat), e);
 		}
 
 	      if (dump_file != NULL)
@@ -1717,7 +1710,7 @@ bypass_conditional_jumps (void)
 		  break;
 
 		dest = SET_DEST (PATTERN (insn));
-		if (REG_P (dest) || CC0_P (dest))
+		if (REG_P (dest))
 		  setcc = insn;
 		else
 		  break;
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 5a95676..b1abebf 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -330,17 +330,9 @@ main (int argc, const char **argv)
   printf ("#endif\n");
 
   if (have_cc0_flag)
-    {
-      printf ("#define HAVE_cc0 1\n");
-      printf ("#define CC0_P(X) ((X) == cc0_rtx)\n");
-    }
+    printf ("#define HAVE_cc0 1\n");
   else
-    {
-      /* We output CC0_P this way to make sure that X is declared
-	 somewhere.  */
-      printf ("#define HAVE_cc0 0\n");
-      printf ("#define CC0_P(X) ((X) ? 0 : 0)\n");
-    }
+    printf ("#define HAVE_cc0 0\n");
 
   if (have_cmove_flag)
     printf ("#define HAVE_conditional_move 1\n");
diff --git a/gcc/jump.c b/gcc/jump.c
index b36b989..b646903 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -400,7 +400,7 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
       break;
     }
 
-  if (GET_MODE_CLASS (mode) == MODE_CC || CC0_P (arg0))
+  if (GET_MODE_CLASS (mode) == MODE_CC)
     {
       /* Try to search for the comparison to determine the real mode.
          This code is expensive, but with sane machine description it
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 2387da4..359c2be 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5722,10 +5722,6 @@ canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
 	}
     }
 
-  /* Never return CC0; return zero instead.  */
-  if (CC0_P (op0))
-    return 0;
-
   /* We promised to return a comparison.  */
   rtx ret = gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
   if (COMPARISON_P (ret))
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index dd3d851..fe1509d 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -5079,8 +5079,7 @@ simplify_relational_operation (enum rtx_code code, machine_mode mode,
     return simplify_gen_relational (code, mode, VOIDmode,
 				    XEXP (op0, 0), XEXP (op0, 1));
 
-  if (GET_MODE_CLASS (cmp_mode) == MODE_CC
-      || CC0_P (op0))
+  if (GET_MODE_CLASS (cmp_mode) == MODE_CC)
     return NULL_RTX;
 
   trueop0 = avoid_constant_pool_reference (op0);
@@ -5445,7 +5444,7 @@ simplify_const_relational_operation (enum rtx_code code,
 
   /* We can't simplify MODE_CC values since we don't know what the
      actual comparison is.  */
-  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC || CC0_P (op0))
+  if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC)
     return 0;
 
   /* Make sure the constant is second.  */


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-15 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 15:51 [gcc(refs/users/segher/heads/cc0)] delete CC0_P Segher Boessenkool
  -- strict thread matches above, loose matches on Subject: below --
2020-12-15 17:04 Segher Boessenkool
2020-06-15 19:23 Segher Boessenkool
2020-02-04 21:55 Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).