[PATCH] [RFC, GCC 4.8] Optimize conditional moves from adjacent memory locations

William J. Schmidt wschmidt@linux.vnet.ibm.com
Sun Feb 26 14:14:00 GMT 2012


On Sun, 2012-02-26 at 00:39 -0800, Andrew T Pinski wrote:
> On Fri, 2012-02-24 at 15:41 -0600, William J. Schmidt wrote:
> > On Fri, 2012-02-10 at 15:46 -0500, Michael Meissner wrote:
> > > I was looking at the routelookup EEMBC benchmark and it has code of the form:
> > > 
> > >    while ( this_node->cmpbit > next_node->cmpbit )
> > >     {
> > >       this_node = next_node;
> > > 
> > >       if ( proute->dst_addr & (0x1 << this_node->cmpbit) )
> > >          next_node = this_node->rlink;
> > >       else
> > >          next_node = this_node->llink;
> > >     }
> > > 
> > 
> > Andrew and Richard both suggested this would be better handled as a tree
> > optimization.  Here is a proposed patch to do that.  
> 
> I think this is slightly different from what was suggested by me.  Since
> my suggestion has to deal with the load from this_node->cmpbit taken
> into account and not just because this_node->rlink and this_node->llink
> might be in the same page.

Hi Andrew,

That's true, but I must be missing your concern here.  If this_node is
NULL, an exception will occur with or without the transformation,
whether this_node is dereferenced in bb0 or not.  Are you worried about
exception ordering or...?  Sorry if I'm being dense.

Thanks,
Bill

> 
> Thanks,
> Andrew Pinski
> 



More information about the Gcc-patches mailing list