public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] aarch64: Fix failure in cmpimm_branch_1.c
@ 2020-01-31 17:45 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-01-31 17:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e2a14becd6bdc68e1d2fbe084079f7472434488e

commit e2a14becd6bdc68e1d2fbe084079f7472434488e
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Sat Jan 25 10:39:06 2020 +0000

    aarch64: Fix failure in cmpimm_branch_1.c
    
    gcc.target/aarch64/cmpimm_branch_1.c started failing after Bernd's
    fix to make combine take the costs of jumps into account
    (g:391500af1932e696a007).  This is because the rtx costs
    of *compare_condjump<GPI:mode> were higher than the costs
    of the instructions it combines.
    
    2020-01-27  Richard Sandiford  <richard.sandiford@arm.com>
    
    gcc/
    	* config/aarch64/aarch64.c (aarch64_if_then_else_costs): Match
    	jump conditions for *compare_condjump<GPI:mode>.

Diff:
---
 gcc/ChangeLog                |  5 +++++
 gcc/config/aarch64/aarch64.c | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1759f1b..5bbe0e3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-27  Richard Sandiford  <richard.sandiford@arm.com>
+
+	* config/aarch64/aarch64.c (aarch64_if_then_else_costs): Match
+	jump conditions for *compare_condjump<GPI:mode>.
+
 2020-01-27  David Malcolm  <dmalcolm@redhat.com>
 
 	PR analyzer/93276
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 3437fff..11197bd 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -11020,6 +11020,8 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed)
   rtx inner;
   rtx comparator;
   enum rtx_code cmpcode;
+  const struct cpu_cost_table *extra_cost
+    = aarch64_tune_params.insn_extra_cost;
 
   if (COMPARISON_P (op0))
     {
@@ -11054,8 +11056,17 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed)
 		    /* CBZ/CBNZ.  */
 		    *cost += rtx_cost (inner, VOIDmode, cmpcode, 0, speed);
 
-	        return true;
-	      }
+		  return true;
+		}
+	      if (register_operand (inner, VOIDmode)
+		  && aarch64_imm24 (comparator, VOIDmode))
+		{
+		  /* SUB and SUBS.  */
+		  *cost += COSTS_N_INSNS (2);
+		  if (speed)
+		    *cost += extra_cost->alu.arith * 2;
+		  return true;
+		}
 	    }
 	  else if (cmpcode == LT || cmpcode == GE)
 	    {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-31 17:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 17:45 [gcc/devel/c++-modules] aarch64: Fix failure in cmpimm_branch_1.c Nathan Sidwell

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).