Sandra Loosemore <san...@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  <san...@codesourcery.com>
>           Julian Brown  <jul...@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

Reply via email to