From: SourceForge.net <no...@so...> - 2009-11-24 11:57:31
|
Bugs item #2902772, was opened at 2009-11-23 23:11 Message generated for change (Comment added) made by wutje You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520074&aid=2902772&group_id=68108 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: GCC Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Brown (davidbrown) Assigned to: Nobody/Anonymous (nobody) Summary: Optimisation regression from 4.2 to 4.3 Initial Comment: Functions that do arithmetic on an expression, then return a 16-bit value, use an extra register pair r18:r19 for the arithmetic instead of using r24:r25 directly. This leads to extra register moves, and limits other optimisations (such as disallowing the use of adiw and similar instructions). This is a regression since gcc 4.2.2 in earlier WinAVR releases, and applies to gcc 4.3.x in various newer WinAVR releases. Compile options are -mmcu=atmega128 -Os, though it also applies to higher optimisations. extern int ext3 (void); int foo6(void) { return ext3() + 1; } avr-gcc 4.2 generates optimal code: foo6: call ext3 adiw r24,1 ret avrgcc 4.3.2 generates much worse code: foo6: call ext3 movw r18,r24 subi r18,lo8(-(1)) sbci r19,hi8(-(1)) movw r24,r18 ret Many other similar functions exhibit the same behaviour, but the function above is perhaps the simplest example. ---------------------------------------------------------------------- Comment By: Wouter (wutje) Date: 2009-11-24 12:57 Message: This problem is solved when using -fno-split-wide-types ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520074&aid=2902772&group_id=68108 |