[EMAIL PROTECTED]:~$ gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug -- enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060729 (prerelease) (Debian 4.1.1-10) [EMAIL PROTECTED]:~$ cat tmp1.c int fct1(void); int fct2(void);
int fct (unsigned nb) { if ((nb >> 5) != 0) return fct1(); else return fct2(); } [EMAIL PROTECTED]:~$ gcc -O3 -fomit-frame-pointer -S tmp1.c -o tmp1.s [EMAIL PROTECTED]:~$ cat tmp1.s .file "tmp1.c" .text .p2align 4,,15 .globl fct .type fct, @function fct: movl 4(%esp), %eax shrl $5, %eax testl %eax, %eax je .L2 jmp fct1 .p2align 4,,7 .L2: jmp fct2 .size fct, .-fct .ident "GCC: (GNU) 4.1.2 20060729 (prerelease) (Debian 4.1.1-10)" .section .note.GNU-stack,"",@progbits [EMAIL PROTECTED]:~$ The assembly instruction "testl %eax, %eax" is not needed considering the Intel documentation of "SAL/SAR/SHL/SHR", "Flags Affected": The SF, ZF, and PF flags are set according to the result. -- Summary: assembler shifts set the flag ZF, no need to re-test to zero Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: etienne_lorrain at yahoo dot fr GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28946