Sign-extending 32-bit operands in adapters [Was: [aarch64-port-dev ] RFR: 8129426: aarch64: add support for PopCount in C2] (original) (raw)
Lindenmaier, Goetz goetz.lindenmaier at sap.com
Mon Jun 29 12:46:42 UTC 2015
- Previous message: Sign-extending 32-bit operands in adapters [Was: [aarch64-port-dev ] RFR: 8129426: aarch64: add support for PopCount in C2]
- Next message: Sign-extending 32-bit operands in adapters [Was: [aarch64-port-dev ] RFR: 8129426: aarch64: add support for PopCount in C2]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Andrew,
I have an off-topic question that touches this issue: You have CCallingConventionRequiresIntsAsLongs set to true.
We once introduced this, because we have to sign-extend all ints and place them in long slots for PPC C calling conventions. If this is set, we do the cast in the frontend, and the i2l nodes can be optimized, and we don't need to do it in the native wrapper. Unfortunately, there are more and more intrinsics with explicitly constructed calls. We have to adapt these in the frontend, which causes not that nice shared changes.
I think about doing the i2l cast right in the native wrapper. There, the cast will always be necessary, i.e., it's not optimized, but that's not really performance relevant.
So basically I could remove the code guarded by CCallingConventionRequiresIntsAsLongs, except for that you use it ... But as I read the aarch code, it's not really necessary. You pass ints in small slots, anyways. So do you rely on that code?
Best regards, Goetz.
-----Original Message----- From: hotspot-dev [mailto:hotspot-dev-bounces at openjdk.java.net] On Behalf Of Andrew Haley Sent: Montag, 29. Juni 2015 14:15 To: Andrew Dinn; edward.nevill at gmail.com Cc: hotspot-dev at openjdk.java.net; aarch64-port-dev at openjdk.java.net Subject: Sign-extending 32-bit operands in adapters [Was: [aarch64-port-dev ] RFR: 8129426: aarch64: add support for PopCount in C2]
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.
- Previous message: Sign-extending 32-bit operands in adapters [Was: [aarch64-port-dev ] RFR: 8129426: aarch64: add support for PopCount in C2]
- Next message: Sign-extending 32-bit operands in adapters [Was: [aarch64-port-dev ] RFR: 8129426: aarch64: add support for PopCount in C2]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]