@@ -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);