loadUB2L: SPARC vs. x86 (6797305)

Ulf Zibis Ulf.Zibis at gmx.de
Wed Feb 4 00:59:19 PST 2009


I think,

   ((long) ba[0]) & 0xFF;

is bad coding style, and maybe should be optimized by javac.

So +1 for preferring x86 pattern, or both.

-Ulf


Am 03.02.2009 17:46, Christian Thalinger schrieb:
> 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