This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: MIPS don't gererate MUL when muliplying by constant of for 2^N +/- 1 optimizing for size
- From: Graham Stott <graham dot stott at btinternet dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 8 Jul 2013 15:20:10 +0100 (BST)
- Subject: Re: MIPS don't gererate MUL when muliplying by constant of for 2^N +/- 1 optimizing for size
- References: <1372860592 dot 24107 dot YahooMailNeo at web87401 dot mail dot ir2 dot yahoo dot com> <87mwq31rau dot fsf at talisman dot default>
- Reply-to: Graham Stott <graham dot stott at btinternet dot com>
Hi Richard,
The problem was with adjusting to be more expansive the load imm + mul sequence and
the shift + add sequence were the smake cost when optimizing for size so the code in expmed.c
choose the MUL.
I also considered this version also I couldn't decide which was better just went with the other
version on a toss of a coin.
I submit again with mips target testcase which use scan assember technique to check that
we use the shift+add/sub sequence.
A simple testcase compiled with -Os
int foo(int x)
{
return x * 17;
}
will demonstrate that we currently use "LI + MUL" and after the patch we will use "SLL + ADDU".
Gtraham