From a2cdcdd65dbbc6717c363fc4e22d9b16a4dea986 Mon Sep 17 00:00:00 2001 From: Yadong Wang Date: Sun, 13 Nov 2022 03:07:09 +0000 Subject: [PATCH] 8296630: Fix SkipIfEqual on AArch64 and RISC-V Reviewed-by: ngasson, fyang, luhenry, aph --- src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 6 +++++- src/hotspot/cpu/riscv/macroAssembler_riscv.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 148baafba81..6fb9d7dbca4 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -3976,7 +3976,11 @@ SkipIfEqual::SkipIfEqual( uint64_t offset; _masm->adrp(rscratch1, ExternalAddress((address)flag_addr), offset); _masm->ldrb(rscratch1, Address(rscratch1, offset)); - _masm->cbzw(rscratch1, _label); + if (value) { + _masm->cbnzw(rscratch1, _label); + } else { + _masm->cbzw(rscratch1, _label); + } } SkipIfEqual::~SkipIfEqual() { diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 08fc0a18bb1..82f8e07336d 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -2061,7 +2061,11 @@ SkipIfEqual::SkipIfEqual(MacroAssembler* masm, const bool* flag_addr, bool value _masm->la_patchable(t0, target, offset); _masm->lbu(t0, Address(t0, offset)); }); - _masm->beqz(t0, _label); + if (value) { + _masm->bnez(t0, _label); + } else { + _masm->beqz(t0, _label); + } } SkipIfEqual::~SkipIfEqual() {