RFR: 8285923: [REDO] JDK-8285802 AArch64: Consistently handle offsets in MacroAssembler as 64-bit quantities
Nick Gasson
ngasson at openjdk.java.net
Fri May 6 11:39:59 UTC 2022
On Thu, 5 May 2022 14:56:38 GMT, Andrew Haley <aph at openjdk.org> wrote:
> It is with some trepidation that I post this after breaking things last time. However, I think I've tested this as much as it can be tested.
>
> The change from last time around is this:
>
>
> +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
> @@ -2192,11 +2192,13 @@ void MacroAssembler::unimplemented(const char* what) {
>
> // If a constant does not fit in an immediate field, generate some
> // number of MOV instructions and then perform the operation.
> -void MacroAssembler::wrap_add_sub_imm_insn(Register Rd, Register Rn, unsigned imm,
> +void MacroAssembler::wrap_add_sub_imm_insn(Register Rd, Register Rn, uint64_t imm,
> add_sub_imm_insn insn1,
> - add_sub_reg_insn insn2) {
> + add_sub_reg_insn insn2,
> + bool is32) {
> assert(Rd != zr, "Rd = zr and not setting flags?");
> - if (operand_valid_for_add_sub_immediate((int)imm)) {
> + bool fits = operand_valid_for_add_sub_immediate(is32 ? (int32_t)imm : imm);
> + if (fits) {
> (this->*insn1)(Rd, Rn, imm);
>
>
> After this patch, when an add/sub instruction has a 32-bit (rather than a 64-bit) operand, we truncate the operand to signed int. We do this because `operand_valid_for_add_sub_immediate()` takes a 64-bit signed operand, but if the instruction is only 32 bits wide we must ignore the upper 32 bits. Therefore, the call site to `wrap_add_sub_imm_insn()` needs to know the operand size in order to sign extend the operand correctly.
>
> Tested tier1-3, tier4 is still running but no regressions yet.
I also ran tier1-3 and didn't see any regressions.
src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp line 1178:
> 1176: #undef WRAP
> 1177: #define WRAP(INSN, is32) \
> 1178: void INSN(Register Rd, Register Rn, uint64_t imm) { \
Align the trailing backslash here and above?
-------------
Marked as reviewed by ngasson (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/8554
More information about the hotspot-dev
mailing list