Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
RISC-V: Increase costs of MULT/DIV if ISA doesn't have them
Browse files Browse the repository at this point in the history
  • Loading branch information
aswaterman authored and palmer-dabbelt committed Nov 8, 2017
1 parent 97779c9 commit a59d503
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gcc/config/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,9 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
case MULT:
if (float_mode_p)
*total = tune_info->fp_mul[mode == DFmode];
else if (!TARGET_MUL)
/* Estimate the cost of a library call. */
*total = COSTS_N_INSNS (speed ? 32 : 6);
else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
*total = 3 * tune_info->int_mul[0] + COSTS_N_INSNS (2);
else if (!speed)
Expand All @@ -1598,6 +1601,9 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN

case UDIV:
case UMOD:
if (!TARGET_DIV)
/* Estimate the cost of a library call. */
*total = COSTS_N_INSNS (speed ? 32 : 6);
if (speed)
*total = tune_info->int_div[mode == DImode];
else
Expand Down

0 comments on commit a59d503

Please sign in to comment.