http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52421
Bug #: 52421 Summary: SH Target: -fnon-call-exceptions prevents delay slot filling Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: olege...@gcc.gnu.org Target: sh*-*-* When the -fnon-call-exceptions option is used delay slots might not be filled, although they could. int test (int x, int y) { return x == y; } compiled with -Os: cmp/eq r5,r4 ! 7 cmpeqsi_t/3 [length = 2] rts ! 22 *return_i [length = 2] movt r0 ! 13 movsi_i/8 [length = 2] compiled with -Os -fnon-call-exceptions cmp/eq r5,r4 ! 7 cmpeqsi_t/3 [length = 2] movt r0 ! 14 movsi_i/8 [length = 2] rts nop ! 24 *return_i [length = 4] It seems this happens for all SH variants. When compiled for SH2A the no-delay-slot-rts insn is picked: cmp/eq r5,r4 ! 7 cmpeqsi_t/3 [length = 2] movt r0 ! 14 movsi_ie/10 [length = 2] rts/n ! 28 *return_i [length = 4] Using built-in specs. COLLECT_GCC=sh-elf-gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sh-elf/4.7.0/lto-wrapper Target: sh-elf Configured with: ../gcc-trunk/configure --target=sh-elf --prefix=/usr/local --enable-languages=c,c++ --enable-multilib --disable-libssp --disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib Thread model: single gcc version 4.7.0 20120227 (experimental) (GCC)