Skip to content

Commit 201084a

Browse files
author
wilson
committed
RISC-V: Increase mult/div cost if not implemented in hardware.
2018-01-15 Andrew Waterman <[email protected]> gcc/ * config/riscv/riscv.c (riscv_rtx_costs) <MULT>: Increase cost if !TARGET_MUL. <UDIV>: Increase cost if !TARGET_DIV. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256722 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 4297999 commit 201084a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

gcc/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2018-01-15 Andrew Waterman <[email protected]>
2+
3+
* config/riscv/riscv.c (riscv_rtx_costs) <MULT>: Increase cost if
4+
!TARGET_MUL.
5+
<UDIV>: Increase cost if !TARGET_DIV.
6+
17
2018-01-15 Segher Boessenkool <[email protected]>
28

39
* config/rs6000/rs6000.md (define_attr "type"): Remove delayed_cr.

gcc/config/riscv/riscv.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,9 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
16151615
case MULT:
16161616
if (float_mode_p)
16171617
*total = tune_info->fp_mul[mode == DFmode];
1618+
else if (!TARGET_MUL)
1619+
/* Estimate the cost of a library call. */
1620+
*total = COSTS_N_INSNS (speed ? 32 : 6);
16181621
else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
16191622
*total = 3 * tune_info->int_mul[0] + COSTS_N_INSNS (2);
16201623
else if (!speed)
@@ -1635,7 +1638,10 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
16351638

16361639
case UDIV:
16371640
case UMOD:
1638-
if (speed)
1641+
if (!TARGET_DIV)
1642+
/* Estimate the cost of a library call. */
1643+
*total = COSTS_N_INSNS (speed ? 32 : 6);
1644+
else if (speed)
16391645
*total = tune_info->int_div[mode == DImode];
16401646
else
16411647
*total = COSTS_N_INSNS (1);

0 commit comments

Comments
 (0)