This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, MIPS] add new peephole for 74k dspr2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]