Commit 3e7a7556 authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[loong64][mips64][wasm] Fix 64-bit addressed loads

Port commit 044a18ac

Bug: v8:10949
Change-Id: I1dfe8fdc4439f621d2ae9f38e63310a1e6f0b7f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3798964
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Auto-Submit: Liu Yu <liuyu@loongson.cn>
Cr-Commit-Position: refs/heads/main@{#82103}
parent bb78114a
...@@ -79,8 +79,13 @@ inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); } ...@@ -79,8 +79,13 @@ inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
template <typename T> template <typename T>
inline MemOperand GetMemOp(LiftoffAssembler* assm, Register addr, inline MemOperand GetMemOp(LiftoffAssembler* assm, Register addr,
Register offset, T offset_imm) { Register offset, T offset_imm,
if (is_int32(offset_imm)) { bool i64_offset = false) {
if (!i64_offset && offset != no_reg) {
assm->bstrpick_d(kScratchReg2, offset, 31, 0);
offset = kScratchReg2;
}
if (is_int31(offset_imm)) {
int32_t offset_imm32 = static_cast<int32_t>(offset_imm); int32_t offset_imm32 = static_cast<int32_t>(offset_imm);
if (offset == no_reg) return MemOperand(addr, offset_imm32); if (offset == no_reg) return MemOperand(addr, offset_imm32);
assm->add_d(kScratchReg, addr, offset); assm->add_d(kScratchReg, addr, offset);
...@@ -420,7 +425,8 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, ...@@ -420,7 +425,8 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
Register offset_reg, uintptr_t offset_imm, Register offset_reg, uintptr_t offset_imm,
LoadType type, uint32_t* protected_load_pc, LoadType type, uint32_t* protected_load_pc,
bool is_load_mem, bool i64_offset) { bool is_load_mem, bool i64_offset) {
MemOperand src_op = liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm); MemOperand src_op =
liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm, i64_offset);
if (protected_load_pc) *protected_load_pc = pc_offset(); if (protected_load_pc) *protected_load_pc = pc_offset();
switch (type.value()) { switch (type.value()) {
...@@ -467,8 +473,10 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, ...@@ -467,8 +473,10 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
uintptr_t offset_imm, LiftoffRegister src, uintptr_t offset_imm, LiftoffRegister src,
StoreType type, LiftoffRegList pinned, StoreType type, LiftoffRegList pinned,
uint32_t* protected_store_pc, bool is_store_mem) { uint32_t* protected_store_pc, bool is_store_mem,
MemOperand dst_op = liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm); bool i64_offset) {
MemOperand dst_op =
liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm, i64_offset);
if (protected_store_pc) *protected_store_pc = pc_offset(); if (protected_store_pc) *protected_store_pc = pc_offset();
switch (type.value()) { switch (type.value()) {
......
...@@ -79,8 +79,13 @@ inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); } ...@@ -79,8 +79,13 @@ inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
template <typename T> template <typename T>
inline MemOperand GetMemOp(LiftoffAssembler* assm, Register addr, inline MemOperand GetMemOp(LiftoffAssembler* assm, Register addr,
Register offset, T offset_imm) { Register offset, T offset_imm,
if (is_int32(offset_imm)) { bool i64_offset = false) {
if (!i64_offset && offset != no_reg) {
assm->Dext(kScratchReg2, offset, 0, 32);
offset = kScratchReg2;
}
if (is_int31(offset_imm)) {
int32_t offset_imm32 = static_cast<int32_t>(offset_imm); int32_t offset_imm32 = static_cast<int32_t>(offset_imm);
if (offset == no_reg) return MemOperand(addr, offset_imm32); if (offset == no_reg) return MemOperand(addr, offset_imm32);
assm->daddu(kScratchReg, addr, offset); assm->daddu(kScratchReg, addr, offset);
...@@ -527,7 +532,8 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, ...@@ -527,7 +532,8 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
Register offset_reg, uintptr_t offset_imm, Register offset_reg, uintptr_t offset_imm,
LoadType type, uint32_t* protected_load_pc, LoadType type, uint32_t* protected_load_pc,
bool is_load_mem, bool i64_offset) { bool is_load_mem, bool i64_offset) {
MemOperand src_op = liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm); MemOperand src_op =
liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm, i64_offset);
if (protected_load_pc) *protected_load_pc = pc_offset(); if (protected_load_pc) *protected_load_pc = pc_offset();
switch (type.value()) { switch (type.value()) {
...@@ -581,8 +587,10 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, ...@@ -581,8 +587,10 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
uintptr_t offset_imm, LiftoffRegister src, uintptr_t offset_imm, LiftoffRegister src,
StoreType type, LiftoffRegList pinned, StoreType type, LiftoffRegList pinned,
uint32_t* protected_store_pc, bool is_store_mem) { uint32_t* protected_store_pc, bool is_store_mem,
MemOperand dst_op = liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm); bool i64_offset) {
MemOperand dst_op =
liftoff::GetMemOp(this, dst_addr, offset_reg, offset_imm, i64_offset);
#if defined(V8_TARGET_BIG_ENDIAN) #if defined(V8_TARGET_BIG_ENDIAN)
if (is_store_mem) { if (is_store_mem) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment