public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Redundant instructions in loop optimization for x86-64?
@ 2004-09-10  0:22 H. J. Lu
  2004-09-10 10:17 ` Jan Hubicka
  0 siblings, 1 reply; 8+ messages in thread
From: H. J. Lu @ 2004-09-10  0:22 UTC (permalink / raw)
  To: gcc

It seems that gcc 3.4 and 4.0 generate redundant instructions in loop
optimization for x86-64:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17387

Does anyone know why?


H.J.

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

* Re: Redundant instructions in loop optimization for x86-64?
  2004-09-10  0:22 Redundant instructions in loop optimization for x86-64? H. J. Lu
@ 2004-09-10 10:17 ` Jan Hubicka
  2004-09-10 17:35   ` H. J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Hubicka @ 2004-09-10 10:17 UTC (permalink / raw)
  To: H. J. Lu; +Cc: gcc

> It seems that gcc 3.4 and 4.0 generate redundant instructions in loop
> optimization for x86-64:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17387
> 
> Does anyone know why?

It is a zero extension GCC believe to be essential.

Honza
> 
> 
> H.J.

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

* Re: Redundant instructions in loop optimization for x86-64?
  2004-09-10 10:17 ` Jan Hubicka
@ 2004-09-10 17:35   ` H. J. Lu
  2004-09-10 22:15     ` James E Wilson
  2004-09-11 11:51     ` Jan Hubicka
  0 siblings, 2 replies; 8+ messages in thread
From: H. J. Lu @ 2004-09-10 17:35 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc

On Fri, Sep 10, 2004 at 11:50:23AM +0200, Jan Hubicka wrote:
> > It seems that gcc 3.4 and 4.0 generate redundant instructions in loop
> > optimization for x86-64:
> > 
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17387
> > 
> > Does anyone know why?
> 
> It is a zero extension GCC believe to be essential.

Is there a way to tell gcc that 32bit zero extension isn't needed for
x86-64?


H.J.

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

* Re: Redundant instructions in loop optimization for x86-64?
  2004-09-10 17:35   ` H. J. Lu
@ 2004-09-10 22:15     ` James E Wilson
  2004-09-10 23:44       ` H. J. Lu
  2004-09-11  1:58       ` Jan Hubicka
  2004-09-11 11:51     ` Jan Hubicka
  1 sibling, 2 replies; 8+ messages in thread
From: James E Wilson @ 2004-09-10 22:15 UTC (permalink / raw)
  To: H. J. Lu; +Cc: gcc

H. J. Lu wrote:
> Is there a way to tell gcc that 32bit zero extension isn't needed for
> x86-64?

It isn't quite that simple.  Sometimes they will be needed.  Sometimes 
they won't.

You might want to look at
     http://gcc.gnu.org/ml/gcc/2004-09/msg00377.html
which is a proposal to add an RTL optimization pass to eliminate 
unnecessary sign/zero extension instructions on targets that support 
both 32-bit and 64-bit code.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

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

* Re: Redundant instructions in loop optimization for x86-64?
  2004-09-10 22:15     ` James E Wilson
@ 2004-09-10 23:44       ` H. J. Lu
  2004-09-11  0:10         ` James E Wilson
  2004-09-11  1:58       ` Jan Hubicka
  1 sibling, 1 reply; 8+ messages in thread
From: H. J. Lu @ 2004-09-10 23:44 UTC (permalink / raw)
  To: James E Wilson; +Cc: gcc

On Fri, Sep 10, 2004 at 01:43:09PM -0700, James E Wilson wrote:
> H. J. Lu wrote:
> >Is there a way to tell gcc that 32bit zero extension isn't needed for
> >x86-64?
> 
> It isn't quite that simple.  Sometimes they will be needed.  Sometimes 
> they won't.
> 
> You might want to look at
>     http://gcc.gnu.org/ml/gcc/2004-09/msg00377.html
> which is a proposal to add an RTL optimization pass to eliminate 
> unnecessary sign/zero extension instructions on targets that support 
> both 32-bit and 64-bit code.

Is there a version which will apply to the current source tree?


H.J.

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

* Re: Redundant instructions in loop optimization for x86-64?
  2004-09-10 23:44       ` H. J. Lu
@ 2004-09-11  0:10         ` James E Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: James E Wilson @ 2004-09-11  0:10 UTC (permalink / raw)
  To: H. J. Lu; +Cc: gcc

On Fri, 2004-09-10 at 15:07, H. J. Lu wrote:
> Is there a version which will apply to the current source tree?

I have no idea.  Try asking the authors of the patch.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

* Re: Redundant instructions in loop optimization for x86-64?
  2004-09-10 22:15     ` James E Wilson
  2004-09-10 23:44       ` H. J. Lu
@ 2004-09-11  1:58       ` Jan Hubicka
  1 sibling, 0 replies; 8+ messages in thread
From: Jan Hubicka @ 2004-09-11  1:58 UTC (permalink / raw)
  To: James E Wilson; +Cc: H. J. Lu, gcc

> H. J. Lu wrote:
> >Is there a way to tell gcc that 32bit zero extension isn't needed for
> >x86-64?
> 
> It isn't quite that simple.  Sometimes they will be needed.  Sometimes 
> they won't.
> 
> You might want to look at
>     http://gcc.gnu.org/ml/gcc/2004-09/msg00377.html
> which is a proposal to add an RTL optimization pass to eliminate 
> unnecessary sign/zero extension instructions on targets that support 
> both 32-bit and 64-bit code.

Actually I think Zdenek's ivopts should care this case by promoting the
induction variable to 64bit.  I already assigned the bugreport to him,
so lets see what happens son ;)
Without the actual promote, the zero extend is really needed and it is
almost impossible to elliminate it on RTL level since you need to watch
overflows.

Honza
> -- 
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

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

* Re: Redundant instructions in loop optimization for x86-64?
  2004-09-10 17:35   ` H. J. Lu
  2004-09-10 22:15     ` James E Wilson
@ 2004-09-11 11:51     ` Jan Hubicka
  1 sibling, 0 replies; 8+ messages in thread
From: Jan Hubicka @ 2004-09-11 11:51 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Jan Hubicka, gcc

> On Fri, Sep 10, 2004 at 11:50:23AM +0200, Jan Hubicka wrote:
> > > It seems that gcc 3.4 and 4.0 generate redundant instructions in loop
> > > optimization for x86-64:
> > > 
> > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17387
> > > 
> > > Does anyone know why?
> > 
> > It is a zero extension GCC believe to be essential.
> 
> Is there a way to tell gcc that 32bit zero extension isn't needed for
> x86-64?

GCC partly knows about this via combine pattern (ie if the computation
of the value is directly preceeding 32bit operation, it should get these
combined as there are combine patterns for it.

In this case GCC thinkgs that both zero extended and not-zero extended
values are needed (one for addressing, other for next iteration) and
thus combine won't try it.
Of course this is just stupid as both values can live in the same
registers - if we had pass noticing this and converting the later use
into subreg, we would get this optimized out.
Perhaps the pass to elliminate more extension posted somewhere can take
care of this.
> 
> 
> H.J.

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

end of thread, other threads:[~2004-09-11 10:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-10  0:22 Redundant instructions in loop optimization for x86-64? H. J. Lu
2004-09-10 10:17 ` Jan Hubicka
2004-09-10 17:35   ` H. J. Lu
2004-09-10 22:15     ` James E Wilson
2004-09-10 23:44       ` H. J. Lu
2004-09-11  0:10         ` James E Wilson
2004-09-11  1:58       ` Jan Hubicka
2004-09-11 11:51     ` Jan Hubicka

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).