Hi DJ, This is the patch that I have checked in.
Cheers Nick gcc/ChangeLog 2015-10-06 Nick Clifton <ni...@redhat.com> * config/rl78/rl78.c (rl78_rtx_costs): Improve cost estimates for multiplication. Index: gcc/config/rl78/rl78.c =================================================================== --- gcc/config/rl78/rl78.c (revision 228513) +++ gcc/config/rl78/rl78.c (working copy) @@ -4165,12 +4165,31 @@ return true; } + if (mode == HImode) + { + if (code == MULT && ! speed) + { + * total = COSTS_N_INSNS (8); + return true; + } + return false; + } + if (mode == SImode) { switch (code) { case MULT: - if (RL78_MUL_G14) + if (! speed) + /* If we are compiling for space then we do not want to use the + inline SImode multiplication patterns or shift sequences. + The cost is not set to 1 or 5 however as we have to allow for + the possibility that we might be converting a leaf function + into a non-leaf function. (There is no way to tell here). + A value of 13 seems to be a reasonable compromise for the + moment. */ + * total = COSTS_N_INSNS (13); + else if (RL78_MUL_G14) *total = COSTS_N_INSNS (14); else if (RL78_MUL_G13) *total = COSTS_N_INSNS (29);