aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2018-01-16 03:03:09 +0000
committerJim Wilson <wilson@gcc.gnu.org>2018-01-15 19:03:09 -0800
commitff3cc569b2d3ba49fe6e2dc07ad761b5d9431c8a (patch)
treef6e0686b0c0cd220100a123726f7a7ba4ec30c34 /gcc
parent66a366a05a39ce91597fe192e3d943efd810eb87 (diff)
downloadgcc-ff3cc569b2d3ba49fe6e2dc07ad761b5d9431c8a.zip
gcc-ff3cc569b2d3ba49fe6e2dc07ad761b5d9431c8a.tar.gz
gcc-ff3cc569b2d3ba49fe6e2dc07ad761b5d9431c8a.tar.bz2
RISC-V: Increase mult/div cost if not implemented in hardware.
2018-01-15 Andrew Waterman <andrew@sifive.com> gcc/ * config/riscv/riscv.c (riscv_rtx_costs) <MULT>: Increase cost if !TARGET_MUL. <UDIV>: Increase cost if !TARGET_DIV. From-SVN: r256722
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/riscv/riscv.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b2acae1..c4af56f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-15 Andrew Waterman <andrew@sifive.com>
+
+ * config/riscv/riscv.c (riscv_rtx_costs) <MULT>: Increase cost if
+ !TARGET_MUL.
+ <UDIV>: Increase cost if !TARGET_DIV.
+
2018-01-15 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (define_attr "type"): Remove delayed_cr.
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index d260c0e..19a01e0 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -1615,6 +1615,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)
@@ -1635,7 +1638,10 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
case UDIV:
case UMOD:
- if (speed)
+ if (!TARGET_DIV)
+ /* Estimate the cost of a library call. */
+ *total = COSTS_N_INSNS (speed ? 32 : 6);
+ else if (speed)
*total = tune_info->int_div[mode == DImode];
else
*total = COSTS_N_INSNS (1);