This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] MIPS - Add 3 operand mul as new attribute to machine description.
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: David Ung <davidu at mips dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 11 May 2005 09:12:17 +0100
- Subject: Re: [Patch] MIPS - Add 3 operand mul as new attribute to machine description.
- References: <1115736604.1627.110.camel@localhost.localdomain>
David Ung <davidu@mips.com> writes:
> Later mips processors typically have 3 operand multiply instructions
> which don't use the hi/lo registers. This patch adds the new "mul3"
> type attribute to the machine descriptions files.
I like the idea.
> * config/mips/mips.md ("type"): Add new attribute for a 3 operand
> multiply.
> ("mulsi3_mult3"): Set attribute to imul3.
> ("muldi3_mult3"): Similarly.
There are a few other three-operand multiplication patterns too.
Grep for imul in mips.md. "may_clobber_hilo" should also be
true for imul3. The patch looks good otherwise.
Since a small revision is needed anyway, you might as well change
the documentation of "imul" to emphasise that it is now for 2-operand
multiplications. (After reload at least. Before reload, you can't
be 100% sure whether an insn with imul and imul3 alternatives will
use a three-operand multiplication or not.)
For the record (since you didn't mention this explicitly): some of the
pipeline descriptions are using match_operand to differentiate between
two- and three-operand multiplications and should probably be tweaked
after this patch. But that sort of change is better done separately
(and I'll try to do it myself... sometime ;). Simply changing "imul"
to "imul,imul3" (like you do here) will not alter the DFA behaviour
in any way and is the right thing for the initial "imul3" patch to do.
Richard