Sign-extending 32-bit operands in adapters [Was: [aarch64-port-dev ] RFR: 8129426: aarch64: add support for PopCount in C2]

Andrew Haley aph at redhat.com
Mon Jun 29 12:15:21 UTC 2015


Here's a snippet from gen_i2c_adapter where we sign extend:

      if (!r_2->is_valid()) {
        // sign extend???
        __ ldrsw(rscratch2, Address(esp, ld_off));
        __ str(rscratch2, Address(sp, st_off));

but in another place we don't sign extend:

        // sign extend and use a full word?
        __ ldrw(r, Address(esp, ld_off));
      }

So, we sign extend when our argument is passed to compiled code in
memory, but zero extend when it is passed in a register.  The
confusion (and those comments) about what should happen seems to come
from the x86 code.  I think we've agreed that we should zero extend,
but I'm still far from convinced that we should ever use an input
operand in any mode other than its natural size.

Andrew.


More information about the hotspot-dev mailing list