+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.
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)
{
#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"