[Bug optimization/2962] unnecessary instruction cwtl
debian-gcc at lists dot debian dot org
gcc-bugzilla@gcc.gnu.org
Sun Aug 10 15:28:00 GMT 2003
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.
More information about the Gcc-bugs
mailing list