public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/3995: i386 optimisation: joining tests
@ 2002-05-06 20:40 sayle
  0 siblings, 0 replies; 3+ messages in thread
From: sayle @ 2002-05-06 20:40 UTC (permalink / raw)
  To: 105309-quiet, gcc-bugs, gcc-prs, herbert, nobody

Synopsis: i386 optimisation: joining tests

State-Changed-From-To: analyzed->closed
State-Changed-By: sayle
State-Changed-When: Mon May  6 20:40:16 2002
State-Changed-Why:
    This problem has been fixed on mainline by the recent patch:
    
    2002-05-06  Roger Sayle  <roger@eyesopen.com>
    
            * fold-const.c (sign_bit_p): New function.
            (fold) [EQ_EXPR]: Use this to convert (A & C) == 0 into A >= 0 and
            (A & C) != 0 into A < 0, when constant C is the sign bit of A's type.
            Reapply fold when converting (A & C) == C into (A & C) != 0.
    
    We now join the two tests together and generate better code.

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


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

* Re: optimization/3995: i386 optimisation: joining tests
@ 2002-04-02 16:26 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-04-02 16:26 UTC (permalink / raw)
  To: 105309-quiet, gcc-bugs, gcc-prs, herbert, nobody

Synopsis: i386 optimisation: joining tests

State-Changed-From-To: open->analyzed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 16:26:51 2002
State-Changed-Why:
    Fold needs to recognize !(x & sign) as x >= 0.
    At which point the regular simplifications take care of it.
    
    As for leave+ret, may be handled by Jan's block duplication
    code on cfg-branch.  At present we only issue multiple returns
    without a stack frame.

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


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

* optimization/3995: i386 optimisation: joining tests
@ 2001-08-11  0:46 Matthias Klose
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Klose @ 2001-08-11  0:46 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc

>Number:         3995
>Category:       optimization
>Synopsis:       i386 optimisation: joining tests
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 11 00:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     herbert@gondor.apana.org.au
>Release:        3.0 (Debian GNU/Linux)
>Organization:
The Debian project
>Environment:
System: Debian GNU/Linux (testing/unstable)
Architecture: i386
	
host: i386-linux
build: i386-linux
target: i386-linux
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-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
[ Reported to the Debian BTS as report #105309.
  Please CC 105309-quiet@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/105309 ]
 	
Here's another segment that needs to have an assembler optimiser run over it:

int foo(char c) {
	if (c && !(c & 0x80)) {
		a();
	} else {
		b();
	}
}

produces with -O2:

   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	83 ec 08             	sub    $0x8,%esp
   6:	8a 45 08             	mov    0x8(%ebp),%al
   9:	84 c0                	test   %al,%al
   b:	74 04                	je     11 <foo+0x11>
   d:	84 c0                	test   %al,%al
   f:	79 07                	jns    18 <foo+0x18>

9-f can be rewritten as:

test	%al, %al
jg	18

  11:	e8 fc ff ff ff       	call   12 <foo+0x12>
			12: R_386_PC32	b
  16:	c9                   	leave  
  17:	c3                   	ret    
  18:	e8 fc ff ff ff       	call   19 <foo+0x19>
			19: R_386_PC32	a
  1d:	eb f7                	jmp    16 <foo+0x16>

And what purpose does this jmp serve? Surely it can be replaced with

leave
ret

  1f:	90                   	nop    

>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:40 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:40 optimization/3995: i386 optimisation: joining tests sayle
  -- strict thread matches above, loose matches on Subject: below --
2002-04-02 16:26 rth
2001-08-11  0: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).