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
This commit is contained in:
DJ Delorie 2018-02-22 11:36:48 -05:00 committed by Oleg Endo
parent 9029d3424f
commit ea49b4dd2e
2 changed files with 66 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2018-02-22 DJ Delorie <dj@redhat.com>
Sebastian Perta <sebastian.perta@renesas.com>
Oleg Endo <olegendo@gcc.gnu.org>
* config/rx/rx.c (rx_rtx_costs): New function.
(TARGET_RTX_COSTS): Override to use rx_rtx_costs.
2018-02-22 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/arm/t-multilib: Map Armv8-R to Armv7 multilibs.

View file

@ -2992,6 +2992,62 @@ rx_address_cost (rtx addr, machine_mode mode ATTRIBUTE_UNUSED,
return COSTS_N_INSNS (1);
}
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)
{
@ -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"