avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Multiply improvement [2]


From: Anatoly Sokolov
Subject: [avr-gcc-list] Multiply improvement [2]
Date: Wed, 30 Apr 2008 01:57:50 +0400

Hello.

This patch adds 'maddqihi4' and 'maddqihi4' multiply-add insn patterns 
for 16bit += 8x8bit operations. Where multiplication is signed on signed 
or unsigned on unsigned . Code decreased on one 'MOVW' instruction 
per multiply-add operation.

The patch "madd.diff" caused 0 gcc testsuite regressions when applied 
against trunk, svn revision 134767.

Testcase:
extern  char _a;
extern  char _b;
volatile extern          int _r;

int
main (void) 
{
  _r += (int)_a * (int)_b;
  return 0;
}


Now:
 muls r18,r20  ;  8 mulqihi3 [length = 3]
 movw r18,r0
 clr r1

 add r18,r24  ;  9 *addhi3/1 [length = 2]
 adc r19,r25

With patch:
 muls r19,r18  ;  8 maddqihi4 [length = 4]
 add r24,r0
 adc r25,r1
 clr r1

Anatoly.

Attachment: madd.diff
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]