Skip to content

Commit

Permalink
8287552: riscv: Fix comment typo in li64
Browse files Browse the repository at this point in the history
  • Loading branch information
DingliZhang committed Mar 21, 2023
1 parent f2bdd16 commit bf2d16c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/hotspot/cpu/riscv/assembler_riscv.cpp
Expand Up @@ -118,7 +118,7 @@ void Assembler::_li(Register Rd, int64_t imm) {

void Assembler::li64(Register Rd, int64_t imm) {
// Load upper 32 bits. upper = imm[63:32], but if imm[31] == 1 or
// (imm[31:28] == 0x7ff && imm[19] == 1), upper = imm[63:32] + 1.
// (imm[31:20] == 0x7ff && imm[19] == 1), upper = imm[63:32] + 1.
int64_t lower = imm & 0xffffffff;
lower -= ((lower << 44) >> 44);
int64_t tmp_imm = ((uint64_t)(imm & 0xffffffff00000000)) + (uint64_t)lower;
Expand Down Expand Up @@ -273,18 +273,18 @@ void Assembler::wrap_label(Register Rt, Label &L, jal_jalr_insn insn) {
}

void Assembler::movptr_with_offset(Register Rd, address addr, int32_t &offset) {
uintptr_t imm64 = (uintptr_t)addr;
int64_t imm64 = (int64_t)addr;
#ifndef PRODUCT
{
char buffer[64];
snprintf(buffer, sizeof(buffer), "0x%" PRIx64, imm64);
block_comment(buffer);
}
#endif
assert(is_unsigned_imm_in_range(imm64, 47, 0) || (imm64 == (uintptr_t)-1),
assert(is_unsigned_imm_in_range(imm64, 47, 0) || (imm64 == (int64_t)-1),
"bit 47 overflows in address constant");
// Load upper 31 bits
int32_t imm = imm64 >> 17;
int64_t imm = imm64 >> 17;
int64_t upper = imm, lower = imm;
lower = (lower << 52) >> 52;
upper -= lower;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Expand Up @@ -1221,7 +1221,7 @@ static int patch_imm_in_li64(address branch, address target) {
tmp_lower = (tmp_lower << 52) >> 52;
tmp_upper -= tmp_lower;
tmp_upper >>= 12;
// Load upper 32 bits. Upper = target[63:32], but if target[31] = 1 or (target[31:28] == 0x7ff && target[19] == 1),
// Load upper 32 bits. Upper = target[63:32], but if target[31] = 1 or (target[31:20] == 0x7ff && target[19] == 1),
// upper = target[63:32] + 1.
Assembler::patch(branch + 0, 31, 12, tmp_upper & 0xfffff); // Lui.
Assembler::patch(branch + 4, 31, 20, tmp_lower & 0xfff); // Addi.
Expand Down

0 comments on commit bf2d16c

Please sign in to comment.