This is the mail archive of the gcc-bugs@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]

[Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2



------- Comment #3 from mikpe at it dot uu dot se  2010-06-06 19:54 -------
I've looked at this, and as far as I can tell it's caused by two separate
improvements in 4.5 that are Ok individually but cause libgcc's __bswapsi2 to
call itself when combined (and certain build options are selected).

1. The middle-end now recognises C idioms for bswap and represents them as
calls to the builtin bswap.

2. The ARM backend now generates much better code for the builtin bswap, but
for archs prior to ARMv6 when -Os is enabled the .md expander arranges to have
a libcall emitted instead.

Consequently, then building for (say) ARMv5 with --enable-target-optspace:
a) the middle-end represents the C bswap idiom in libgcc2.c:__bswapsi2 () as a
call to the builtin
b) the ARM backend (not knowing it's compiling libgcc) emits a libcall
c) hence __bswapsi2 () calls itself

The only way I see around this is to add a compiler option (-fin-libgcc say),
set it when compiling libgcc routines (similar to -DIN_LIBGCC2), check for it
in the ARM bswap expander, and if set ignore -Os in the arch < v6 case.


-- 

mikpe at it dot uu dot se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu dot se


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392


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