aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/rx
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2018-02-22 11:36:48 -0500
committerOleg Endo <olegendo@gcc.gnu.org>2018-02-22 16:36:48 +0000
commitea49b4dd2eb8d190f1470fea30dc582eceeee05d (patch)
tree24844f06f4b319767efd79ef5f85c6169f23dbdb /gcc/config/rx
parent9029d3424fac933a8bd5fb6ea63583f7812b6ef6 (diff)
downloadgcc-ea49b4dd2eb8d190f1470fea30dc582eceeee05d.zip
gcc-ea49b4dd2eb8d190f1470fea30dc582eceeee05d.tar.gz
gcc-ea49b4dd2eb8d190f1470fea30dc582eceeee05d.tar.bz2
rx.c (rx_rtx_costs): New function.
gcc/ * config/rx/rx.c (rx_rtx_costs): New function. (TARGET_RTX_COSTS): Override to use rx_rtx_costs. Co-Authored-By: Oleg Endo <olegendo@gcc.gnu.org> Co-Authored-By: Sebastian Perta <sebastian.perta@renesas.com> From-SVN: r257905
Diffstat (limited to 'gcc/config/rx')
-rw-r--r--gcc/config/rx/rx.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index 007e052..fe467f7 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -2993,6 +2993,62 @@ rx_address_cost (rtx addr, machine_mode mode ATTRIBUTE_UNUSED,
}
static bool
+rx_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
+ int opno ATTRIBUTE_UNUSED, int* total, bool speed)
+{
+ if (x == const0_rtx)
+ {
+ *total = 0;
+ return true;
+ }
+
+ switch (GET_CODE (x))
+ {
+ case MULT:
+ if (mode == DImode)
+ {
+ *total = COSTS_N_INSNS (2);
+ return true;
+ }
+ /* fall through */
+
+ case PLUS:
+ case MINUS:
+ case AND:
+ case COMPARE:
+ case IOR:
+ case XOR:
+ *total = COSTS_N_INSNS (1);
+ return true;
+
+ case DIV:
+ if (speed)
+ /* This is the worst case for a division. Pessimize divisions when
+ not optimizing for size and allow reciprocal optimizations which
+ produce bigger code. */
+ *total = COSTS_N_INSNS (20);
+ else
+ *total = COSTS_N_INSNS (3);
+ return true;
+
+ case UDIV:
+ if (speed)
+ /* This is the worst case for a division. Pessimize divisions when
+ not optimizing for size and allow reciprocal optimizations which
+ produce bigger code. */
+ *total = COSTS_N_INSNS (18);
+ else
+ *total = COSTS_N_INSNS (3);
+ return true;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+static bool
rx_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
{
/* We can always eliminate to the frame pointer.
@@ -3726,6 +3782,9 @@ rx_modes_tieable_p (machine_mode mode1, machine_mode mode2)
#undef TARGET_MODES_TIEABLE_P
#define TARGET_MODES_TIEABLE_P rx_modes_tieable_p
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS rx_rtx_costs
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-rx.h"