public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@cygnus.com>
To: Clinton Popetz <cpopetz@cygnus.com>
Cc: Zack Weinberg <zack@wolery.cumb.org>, gcc@gcc.gnu.org
Subject: Re: minor code-quality regression vs. 2.95
Date: Wed, 03 May 2000 09:39:00 -0000	[thread overview]
Message-ID: <24328.957372003@upchuck> (raw)
In-Reply-To: <20000412160823.A13160@cpopetz.com>

  In message <20000412160823.A13160@cpopetz.com>you write:
  > On Tue, Apr 11, 2000 at 09:45:41PM -0700, Zack Weinberg wrote:
  > > This function:
  > > 
  > > long long blocks (long long bytes) { return bytes / 512; }
  > > 
  > > compiles as follows with 2.95:
  > > 
  > > blocks:
  > > 	movl 4(%esp),%eax
  > > 	movl 8(%esp),%edx
  > > 	testl %edx,%edx
  > > 	jge .L3
  > > 	addl $511,%eax
  > > 	adcl $0,%edx
  > > L3:
  > > 	shrdl $9,%edx,%eax
  > > 	sarl $9,%edx
  > > 	ret
  > > 
  > > and with the 20000408 CVS tree:
  > > 
  > > blocks:
  > > 	movl	8(%esp), %edx
  > > 	movl	4(%esp), %eax
  > > 	cmpl	$0, %edx
  > > 	jg	.L3
  > > 	testl	%edx, %edx
  > > 	jns	.L3
  > > 	addl	$511, %eax
  > > 	adcl	$0, %edx
  > > L3:
  > > 	shrdl	$9, %edx, %eax
  > > 	sarl	$9, %edx
  > > 	ret
  > > 
  > > Notice the additional compare and test in the 2.96 code.  
  > > 
  > > I can't make any sense at all of the RTL.
  > 
  > ix86_expand_branch is emitting the long long compare like this:
  > 
  >          * a < b =>
  >          *    if (hi(a) < hi(b)) goto true; 
  >          *    if (hi(a) > hi(b)) goto false;
  >          *    if (lo(a) < lo(b)) goto true;
  > 
  > In the above case, the third jump can be turned into an uncoditional jump b
  > y
  > cse, which means the first test/jump could be eliminated _if_ it were emitt
  > ed
  > directly before the last one (i.e. swap the first two statements above.)
Maybe we should instead look at how we could improve our existing optimizers
to handle this situation.

For example, it might be possible to have thread_jumps detect this case.

Or somehow have life_analysis be aware that its actions can simplify the cfg
and account for those changes (by modifying the cfg and updating life info
appropriately).

jeff


  parent reply	other threads:[~2000-05-03  9:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-11 21:45 Zack Weinberg
2000-04-12 14:09 ` Clinton Popetz
2000-04-12 15:08   ` Zack Weinberg
2000-04-13 14:17     ` Clinton Popetz
2000-04-13 23:29       ` Zack Weinberg
2000-04-14 15:15         ` Zack Weinberg
2000-04-23 13:48         ` Jeffrey A Law
2000-04-23 13:56           ` Zack Weinberg
2000-04-23 21:33           ` Philippe De Muyter
2000-04-13  0:29   ` Richard Henderson
2000-04-13  6:50     ` Clinton Popetz
2000-04-17  8:15       ` Jeffrey A Law
2000-05-03  9:39   ` Jeffrey A Law [this message]
2000-04-12 14:26 John Wehle
2000-04-23 14:01 Richard Kenner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24328.957372003@upchuck \
    --to=law@cygnus.com \
    --cc=cpopetz@cygnus.com \
    --cc=gcc@gcc.gnu.org \
    --cc=zack@wolery.cumb.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).