loadUB2L: SPARC vs. x86 (6797305)

Christian Thalinger Christian.Thalinger at Sun.COM
Tue Feb 3 08:46:16 PST 2009


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