This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/28946] New: assembler shifts set the flag ZF, no need to re-test to zero
- From: "etienne_lorrain at yahoo dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Sep 2006 12:02:04 -0000
- Subject: [Bug c/28946] New: assembler shifts set the flag ZF, no need to re-test to zero
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
etienne@cygne:~$ 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)
etienne@cygne:~$ cat tmp1.c
int fct1(void);
int fct2(void);
int fct (unsigned nb)
{
if ((nb >> 5) != 0)
return fct1();
else
return fct2();
}
etienne@cygne:~$ gcc -O3 -fomit-frame-pointer -S tmp1.c -o tmp1.s
etienne@cygne:~$ 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
etienne@cygne:~$
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
- Follow-Ups:
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: pinskia at gcc dot gnu dot org
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: hjl at lucon dot org
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: dann at godzilla dot ics dot uci dot edu
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at kss-loka dot si
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at kss-loka dot si
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at kss-loka dot si
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at kss-loka dot si
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: hjl at lucon dot org
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at kss-loka dot si
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: hjl at lucon dot org
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: mmitchel at gcc dot gnu dot org
- [Bug target/28946] [4.0/4.1/4.2 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at gcc dot gnu dot org
- [Bug target/28946] [4.0/4.1 Regression] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at gcc dot gnu dot org
- [Bug target/28946] [4.0 Only] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at gcc dot gnu dot org
- [Bug target/28946] assembler shifts set the flag ZF, no need to re-test to zero
- From: uros at kss-loka dot si