[Top][All Lists]

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

[avr-gcc-list] Bug with -Os with constant multiplier of 3?

From: David Kopf
Subject: [avr-gcc-list] Bug with -Os with constant multiplier of 3?
Date: Tue, 21 Dec 2010 10:01:32 -0500


Using WinAVR avr-gcc 4.3.0 and 4.3.3, compiling 3*<uint8_t> with -Os calls __mulhi3 instead of the optimized *2+1 when no hardware multiply is present. O1,O2,O3 does it right:

Target: ATTiny85

uint8_t rssi;  //r24
-O1 -O2 -O3
   aa: 28 2f        mov r18, r24
   ac: 22 0f        add r18, r18
   ae: 28 0f        add r18, r24

   ae: 90 e0        ldi r25, 0x00 ; 0
   b0: 63 e0        ldi r22, 0x03 ; 3
   b2: 70 e0        ldi r23, 0x00 ; 0
   b4: 40 d0        rcall .+128     ; 0x136<__mulhi3>

reply via email to

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