src/dst register for andI_rReg_imm255 and andI_rReg_imm65535

Christian Thalinger Christian.Thalinger at Sun.COM
Tue Sep 22 01:38:30 PDT 2009

Vladimir Kozlov wrote:
> The src is not register, it is Int constant which could be immediate
> value. We use "movzbl  $dst, $dst" to avoid immediate value and reduce
> the instruction size.
> instruct andI_rReg_imm255(rRegI dst, immI_255 src)
> %{
>    match(Set dst (AndI dst src));

Sorry, I really should be more verbose when explaining my problems :-/

What I actually meant was, why it's not defined this way:

instruct andI_rReg_imm255(rRegI dst, rRegI src, immI_255 mask) %{
  match(Set dst (AndI src mask));

  format %{ "movzbl  $dst, $src\t# int & 0xFF" %}
  ins_encode %{
    __ movzbl($dst$$Register, $src$$Register);

This way src and dst still can be the same register and produce the same
code as before (if required).

> The spill you see is to preserve the original value (which should be
> used later again) since the dst will be modified. The spill
> should not be related to int constant value "src".
> Could you show assembler?

I just sent one in reply to Tom's message.

-- Christian

More information about the hotspot-compiler-dev mailing list