Skip to content

Commit

Permalink
8340643: RISC-V: Small refactoring for sub/subw macro-assembler routines
Browse files Browse the repository at this point in the history
Reviewed-by: fyang, luhenry
  • Loading branch information
zifeihan authored and RealFYang committed Sep 25, 2024
1 parent c0fcb25 commit a37bb2e
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2085,23 +2085,11 @@ void MacroAssembler::addw(Register Rd, Register Rn, int32_t increment, Register
}

void MacroAssembler::sub(Register Rd, Register Rn, int64_t decrement, Register temp) {
if (is_simm12(-decrement)) {
addi(Rd, Rn, -decrement);
} else {
assert_different_registers(Rn, temp);
li(temp, decrement);
sub(Rd, Rn, temp);
}
add(Rd, Rn, -decrement, temp);
}

void MacroAssembler::subw(Register Rd, Register Rn, int32_t decrement, Register temp) {
if (is_simm12(-decrement)) {
addiw(Rd, Rn, -decrement);
} else {
assert_different_registers(Rn, temp);
li(temp, decrement);
subw(Rd, Rn, temp);
}
addw(Rd, Rn, -decrement, temp);
}

void MacroAssembler::andrw(Register Rd, Register Rs1, Register Rs2) {
Expand Down

1 comment on commit a37bb2e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.