loadUB2L: SPARC vs. x86 (6797305)

Tom Rodriguez Thomas.Rodriguez at Sun.COM
Tue Feb 3 11:08:25 PST 2009


I think either one could occur as a result of inlining.  I suspect the  
sparc version is really from ba[0] & 0xffL.  I'd probably do both  
though.  In general there isn't a lot of uniformity in which patterns  
like this are matched in the different ad files and it might be nice  
to fix that.  I think I have a few lying around in a workspace that I  
could dig out.

We might consider improving some of our Ideal methods to canonicalize  
these patterns with the assumption that the AD file will match them.

It just occurred to me that the part of the original problem that  
motivated introducing LoadUB could be solved by changes in the  
Matcher::find_shared logic.  That logic is responsible for finding  
Nodes in the graph that have to be matched into a register because  
there are multiple users.  In the original example of (StoreC mem2  
addr2 (AndI (LoadB mem1 addr1) (ConI 0xff))) the AndI and the LoadB  
only have only a single user so they aren't forced into a register but  
the logic in the matcher that checks the memory breaks that match at  
the LoadB forcing it into a register.  If we modified find_shared to  
check for the idioms we want to support it could mark the AndI as  
shared which would start the match where we want and there would be no  
memory problems.

There was some other problem with control edges on other nodes that  
was breaking the match but maybe those could be resolved as well.

tom

On Feb 3, 2009, at 8:46 AM, Christian Thalinger wrote:

> Hi all!
>
> While working on 6797305 it looked more closely at the AD files and I
> saw that there is already some kind of unsigned byte load to long
> (loadUBL) on SPARC:
>
>  match(Set dst (AndL (ConvI2L (LoadB mem)) bytemask));
>
> But it's a bit different than the (commented) one on x86:
>
>  match(Set dst (ConvI2L (AndI (LoadB mem) bytemask)));
>
> The SPARC one matches code like:
>
>  ((long) ba[0]) & 0xFF;
>
> while the x86 one matches:
>
>  (long) (ba[0] & 0xFF);
>
> I wonder if the SPARC one is a common pattern and has been added
> intentional.  I'd guess that the x86 one is more common.
>
> My patch will change the match to:
>
>  match(Set dst (ConvI2L (LoadUB mem)));
>
> what is more easy to transform in the ideal graph.
>
> So the question is, which one of the two should we optimize?  Or even
> both of them?
>
> -- Christian
>




More information about the hotspot-compiler-dev mailing list