public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
To: gcc-patches@gcc.gnu.org
Cc: philipp.tomsich@theobroma-systems.com
Subject: [AArch64 03/14] Retrieve BRANCH_COST from tuning structure.
Date: Tue, 18 Feb 2014 21:10:00 -0000	[thread overview]
Message-ID: <1392757787-25629-4-git-send-email-philipp.tomsich@theobroma-systems.com> (raw)
In-Reply-To: <1392757787-25629-1-git-send-email-philipp.tomsich@theobroma-systems.com>

The BRANCH_COST affects whether conditional instructions (e.g.
conditional moves) will be used in transforms in the middle-end.
This change makes the branch_cost configurable from within the
target tuning structure.
---
 gcc/config/aarch64/aarch64-protos.h |  2 ++
 gcc/config/aarch64/aarch64.c        | 13 +++++++++++--
 gcc/config/aarch64/aarch64.h        |  6 ++++--
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 5542f02..185bc64 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -157,6 +157,7 @@ struct tune_params
   const struct cpu_vector_cost *const vec_costs;
   const int memmov_cost;
   const int issue_rate;
+  const int branch_cost;
 };
 
 HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned);
@@ -227,6 +228,7 @@ void aarch64_init_cumulative_args (CUMULATIVE_ARGS *, const_tree, rtx,
 void aarch64_init_expanders (void);
 void aarch64_print_operand (FILE *, rtx, char);
 void aarch64_print_operand_address (FILE *, rtx);
+int aarch64_branch_cost (int, int);
 
 /* Initialize builtins for SIMD intrinsics.  */
 void init_aarch64_simd_builtins (void);
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 70dda00..43e4612 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -222,7 +222,8 @@ static const struct tune_params generic_tunings =
   &generic_regmove_cost,
   &generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (branch_cost, 2)
 };
 
 static const struct tune_params cortexa53_tunings =
@@ -232,7 +233,8 @@ static const struct tune_params cortexa53_tunings =
   &generic_regmove_cost,
   &generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
-  NAMED_PARAM (issue_rate, 2)
+  NAMED_PARAM (issue_rate, 2),
+  NAMED_PARAM (branch_cost, 2)
 };
 
 /* A processor implementing AArch64.  */
@@ -4891,6 +4893,13 @@ aarch64_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
   return regmove_cost->FP2FP;
 }
 
+int
+aarch64_branch_cost(int speed_p, int predictable_p)
+{
+  return (!(speed_p) ? 2 : (predictable_p) ? 0 : aarch64_tune_params->branch_cost);
+}
+
+
 static int
 aarch64_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
 			  reg_class_t rclass ATTRIBUTE_UNUSED,
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index b66a6b4..fbdf745 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -765,8 +765,10 @@ do {									     \
 #define MEMORY_MOVE_COST(M, CLASS, IN) \
   (GET_MODE_SIZE (M) < 8 ? 8 : GET_MODE_SIZE (M))
 
-/* To start with.  */
-#define BRANCH_COST(SPEED_P, PREDICTABLE_P) 2
+/* A C expression for the cost of a branch instruction.  A value of 1
+   is the default; other values are interpreted relative to that.  */
+#define BRANCH_COST(speed_p, predictable_p) \
+  (aarch64_branch_cost(speed_p, predictable_p))
 \f
 
 /* Assembly output.  */
-- 
1.9.0

  parent reply	other threads:[~2014-02-18 21:10 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 21:10 [AArch64 00/14] Pipeline-independent changes for XGene-1 Philipp Tomsich
2014-02-18 21:10 ` [AArch64 06/14] Extend '*tb<optab><mode>1' Philipp Tomsich
2014-02-18 21:19   ` Andrew Pinski
2014-02-18 21:10 ` [AArch64 07/14] Define additional patterns for adds/subs Philipp Tomsich
2014-02-18 21:19   ` Andrew Pinski
2014-02-18 21:10 ` [AArch64 02/14] Add "xgene1" core identifier Philipp Tomsich
2014-02-18 21:10 ` [AArch64 01/14] Use "generic" target, if no other default Philipp Tomsich
2014-02-21 14:02   ` Kyrill Tkachov
2014-02-18 21:10 ` [AArch64 05/14] Add AArch64 'prefetch'-pattern Philipp Tomsich
2014-02-18 21:18   ` Andrew Pinski
2014-02-28  8:58   ` Gopalasubramanian, Ganesh
2014-02-28  9:14   ` Gopalasubramanian, Ganesh
2014-02-28  9:28     ` Dr. Philipp Tomsich
2014-05-28 14:25       ` Gopalasubramanian, Ganesh
2014-05-28 14:41         ` Dr. Philipp Tomsich
2014-02-18 21:10 ` [AArch64 04/14] Correct the maximum shift amount for shifted operands Philipp Tomsich
2014-02-18 21:20   ` Andrew Pinski
2014-02-18 21:10 ` Philipp Tomsich [this message]
2014-02-18 21:26 ` [AArch64 10/14] Add mov<mode>cc definition for GPF case Philipp Tomsich
2014-02-18 21:40   ` Andrew Pinski
2014-02-18 21:27 ` [AArch64 11/14] Optimize and(s) patterns for HI/QI operands Philipp Tomsich
2014-02-18 21:41   ` Andrew Pinski
2014-02-18 21:28 ` [AArch64 13/14] Initial tuning description for XGene-1 core Philipp Tomsich
2014-02-18 21:28 ` [AArch64 14/14] Add cost-model for XGene-1 Philipp Tomsich
2014-02-18 21:29 ` [AArch64 08/14] Define a variant of cmp for the CC_NZ case Philipp Tomsich
2014-02-18 21:42   ` Andrew Pinski
2014-02-18 21:29 ` [AArch64 09/14] Add special cases of zero-extend w/ compare operations Philipp Tomsich
2014-02-18 21:42   ` Andrew Pinski
2014-02-18 21:30 ` [AArch64 12/14] Generate 'bics', when only interested in CC_NZ Philipp Tomsich
2014-02-18 21:43   ` Andrew Pinski
2014-02-19 14:02 ` [AArch64 00/14] Pipeline-independent changes for XGene-1 Richard Earnshaw
2014-02-19 14:41 ` Ramana Radhakrishnan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392757787-25629-4-git-send-email-philipp.tomsich@theobroma-systems.com \
    --to=philipp.tomsich@theobroma-systems.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).