This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, MIPS] add new peephole for 74k dspr2
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 19 Aug 2012 18:22:52 +0100
- Subject: Re: [PATCH, MIPS] add new peephole for 74k dspr2
- References: <502D0DF4.3070302@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com> writes:
> This patch adds a peephole optimization to use a clever trick to
> zero-initialize the two halves of an accumulator register with one
> instruction instead of a mtlo/mthi pair. OK to check in?
>
> -Sandra
>
> 2012-08-16 Sandra Loosemore <sandra@codesourcery.com>
> Julian Brown <julian@codesourcery.com>
> MIPS Technologies, Inc.
>
> gcc/
> * config/mips/mips-dspr2.md (UNSPEC_ACC_INIT): Declare.
> (mult peephole2): Add peephole that converts
> "mtlo $ac[1-3],$0; mthi $ac[1-3],$0" into
> "mult $ac[1-3],$0,$0".
> (*mips_acc_init): New insn for above.
Not sure whether a peephole is the right choice here. In practice,
I'd imagine these opportunities would only come from a DImode move of
$0 into a doubleword register, so we could simply emit the pattern in
mips_split_doubleword_move.
That would also allow us to use it for plain HI and LO. It wasn't
obvious from the patch why it was restricted to the DSP extension
registers.
Please also add a scan-assembler test.
Richard