optimization/2962: unnecessary instruction cwtl

Matthias Klose doko@cs.tu-berlin.de
Sat May 26 11:46:00 GMT 2001


>Number:         2962
>Category:       optimization
>Synopsis:       unnecessary instruction cwtl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 26 11:45:59 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     herbert@gondor.apana.org.au
>Release:        3.0 20010526 (Debian prerelease) (Debian testing/unstable)
>Organization:
Debian
>Environment:
System: Linux smile 2.2.17 #1 Sun Oct 8 19:26:41 MEST 2000 i686 unknown
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-x --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
gcc-3.0 -Os wastes a byte in the following code on i386:

a:
	pushl	%ebp
	movl	%esp, %ebp
	movl	8(%ebp), %eax
	andl	$1, %eax
	cwtl
	popl	%ebp
	ret

The cwtl is unnecessary since %eax has just been anded with 1.

The source is:

int a(short i) {
	return i & 1;
}


	
>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list