This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/2962] unnecessary instruction cwtl
- From: "debian-gcc at lists dot debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2003 15:28:19 -0000
- Subject: [Bug optimization/2962] unnecessary instruction cwtl
- References: <20010526114559.2962.95318-quiet@bugs.debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2962
debian-gcc at lists dot debian dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |herbert at gondor dot apana
| |dot org dot au
------- Additional Comments From debian-gcc at lists dot debian dot org 2003-08-10 15:28 -------
Herbert Xu writes:
I appologise for all the reopening. Be rest assured that your efforts
in gettings these issues addressed is most appreciated.
Unfortunately as in other cases this bug hasn't been addressed in
full by the upstream. Although the cwtl instructions are gone, it has
been replaced by the equivalent mov?wl:
-- a.c --
#include <ctype.h>
int a(short i) {
return i & 1;
}
int foo(int c) {
return isdigit(c);
}
--
-- gcc -S -O2 a.c --
a:
pushl %ebp
movl %esp, %ebp
movswl 8(%ebp),%eax
andl $1, %eax
leave
ret
...
foo:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
call __ctype_b_loc
movl (%eax), %edx
movl 8(%ebp), %eax
movzwl (%edx,%eax,2), %eax
andl $2048, %eax
leave
ret
.size foo, .-foo
.ident "GCC: (GNU) 3.3 20030509 (Debian prerelease)"
In both instances the extension (mov?wl) is unnecessary as
it is followed immediately by an and which zaps the high bits.