public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/2962: unnecessary instruction cwtl
@ 2002-05-06 20:34 sayle
  0 siblings, 0 replies; 3+ messages in thread
From: sayle @ 2002-05-06 20:34 UTC (permalink / raw)
  To: 95318-quiet, gcc-bugs, gcc-prs, nobody

Synopsis: unnecessary instruction cwtl

State-Changed-From-To: analyzed->closed
State-Changed-By: sayle
State-Changed-When: Mon May  6 20:34:42 2002
State-Changed-Why:
    This has been fixed on mainline by the recent patch
    
    2002-04-17  Roger Sayle  <roger@eyesopen.com>
                Jakub Jelinek  <jakub@redhat.com>
    
        * fold-const.c (fold) [NOP_EXPR]: Convert (T)(x&c) into ((T)x&(T)c)
        for integer constant c (if x has unsigned type or sign bit is not
        set in c).  This folds the zero/sign extension into the bit-wise
        and operation.
    
    We now no longer generate the unnecessary "cwtl" instruction for the
    test case in the PR.  [Unfortunately with -Os, there is no net space
    saving for this example function as mainline also decides to use a
    longer but faster load instruction].

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2962


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: optimization/2962: unnecessary instruction cwtl
@ 2002-04-02  1:15 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-04-02  1:15 UTC (permalink / raw)
  To: 95318-quiet, gcc-bugs, gcc-prs, nobody

Synopsis: unnecessary instruction cwtl

State-Changed-From-To: open->analyzed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 01:15:31 2002
State-Changed-Why:
    The combiner creates
      (and:HI (mem:HI ...) (const_int 1))
    at which point it isn't allowed to widen the operation.
    
    Need to adjust ix86_binary_operator_ok such that it doesn't
    allow a memory source without a register source that we could
    possibly match.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2962


^ permalink raw reply	[flat|nested] 3+ messages in thread

* optimization/2962: unnecessary instruction cwtl
@ 2001-05-26 11:46 Matthias Klose
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Klose @ 2001-05-26 11:46 UTC (permalink / raw)
  To: gcc-gnats; +Cc: 95318-forwarded

>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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-05-07  3:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-06 20:34 optimization/2962: unnecessary instruction cwtl sayle
  -- strict thread matches above, loose matches on Subject: below --
2002-04-02  1:15 rth
2001-05-26 11:46 Matthias Klose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).