Commit 5e825b72 authored by Junliang Yan's avatar Junliang Yan Committed by V8 LUCI CQ

ppc: replace StorePU by StoreU64WithUpdate

Change-Id: I795d45a02f49e3a0cc62ce5d87b75a1af7b2dcc1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2917913
Commit-Queue: Junliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Auto-Submit: Junliang Yan <junyan@redhat.com>
Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#74766}
parent 17ad3bce
......@@ -1897,7 +1897,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
__ bind(&copy);
__ LoadU64WithUpdate(r0, MemOperand(src, kSystemPointerSize));
__ StorePU(r0, MemOperand(dest, kSystemPointerSize));
__ StoreU64WithUpdate(r0, MemOperand(dest, kSystemPointerSize));
__ bdnz(&copy);
}
......@@ -1916,7 +1916,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
__ bne(&skip);
__ LoadRoot(scratch, RootIndex::kUndefinedValue);
__ bind(&skip);
__ StorePU(scratch, MemOperand(r8, kSystemPointerSize));
__ StoreU64WithUpdate(scratch, MemOperand(r8, kSystemPointerSize));
__ bdnz(&loop);
__ bind(&no_args);
__ add(r3, r3, r7);
......@@ -2001,7 +2001,7 @@ void Builtins::Generate_CallOrConstructForwardVarargs(MacroAssembler* masm,
__ bind(&copy);
__ LoadU64WithUpdate(r0, MemOperand(src, kSystemPointerSize));
__ StorePU(r0, MemOperand(dest, kSystemPointerSize));
__ StoreU64WithUpdate(r0, MemOperand(dest, kSystemPointerSize));
__ bdnz(&copy);
}
// Copy arguments from the caller frame.
......
......@@ -333,7 +333,7 @@ void TurboAssembler::PushArray(Register array, Register size, Register scratch,
bind(&loop);
LoadU64WithUpdate(scratch2, MemOperand(scratch, -kSystemPointerSize));
StorePU(scratch2, MemOperand(sp, -kSystemPointerSize));
StoreU64WithUpdate(scratch2, MemOperand(sp, -kSystemPointerSize));
bdnz(&loop);
bind(&done);
......@@ -346,7 +346,7 @@ void TurboAssembler::PushArray(Register array, Register size, Register scratch,
bind(&loop);
LoadU64WithUpdate(scratch2, MemOperand(scratch, kSystemPointerSize));
StorePU(scratch2, MemOperand(sp, -kSystemPointerSize));
StoreU64WithUpdate(scratch2, MemOperand(sp, -kSystemPointerSize));
bdnz(&loop);
bind(&done);
}
......@@ -1240,8 +1240,8 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
Operand(base::bits::WhichPowerOfTwo(frame_alignment)));
}
li(r0, Operand::Zero());
StorePU(r0,
MemOperand(sp, -kNumRequiredStackFrameSlots * kSystemPointerSize));
StoreU64WithUpdate(
r0, MemOperand(sp, -kNumRequiredStackFrameSlots * kSystemPointerSize));
// Set the exit frame sp value to point just before the return address
// location.
......@@ -1356,7 +1356,7 @@ void TurboAssembler::PrepareForTailCall(Register callee_args_count,
mtctr(tmp_reg);
bind(&loop);
LoadU64WithUpdate(tmp_reg, MemOperand(src_reg, -kSystemPointerSize));
StorePU(tmp_reg, MemOperand(dst_reg, -kSystemPointerSize));
StoreU64WithUpdate(tmp_reg, MemOperand(dst_reg, -kSystemPointerSize));
bdnz(&loop);
// Leave current frame.
......@@ -1436,7 +1436,7 @@ void MacroAssembler::InvokePrologue(Register expected_parameter_count,
bind(&copy);
LoadU64WithUpdate(r0, MemOperand(src, kSystemPointerSize));
StorePU(r0, MemOperand(dest, kSystemPointerSize));
StoreU64WithUpdate(r0, MemOperand(dest, kSystemPointerSize));
bdnz(&copy);
}
......@@ -1447,7 +1447,7 @@ void MacroAssembler::InvokePrologue(Register expected_parameter_count,
Label loop;
bind(&loop);
StorePU(scratch, MemOperand(r8, kSystemPointerSize));
StoreU64WithUpdate(scratch, MemOperand(r8, kSystemPointerSize));
bdnz(&loop);
}
b(&regular_invoke);
......@@ -2096,7 +2096,7 @@ void TurboAssembler::PrepareCallCFunction(int num_reg_arguments,
// Allocate frame with required slots to make ABI work.
li(r0, Operand::Zero());
StorePU(r0, MemOperand(sp, -stack_space * kSystemPointerSize));
StoreU64WithUpdate(r0, MemOperand(sp, -stack_space * kSystemPointerSize));
}
void TurboAssembler::PrepareCallCFunction(int num_reg_arguments,
......@@ -2776,21 +2776,33 @@ void TurboAssembler::StoreU64(Register src, const MemOperand& mem,
}
}
void TurboAssembler::StorePU(Register src, const MemOperand& mem,
Register scratch) {
void TurboAssembler::StoreU64WithUpdate(Register src, const MemOperand& mem,
Register scratch) {
int offset = mem.offset();
int misaligned = (offset & 3);
if (!is_int16(offset)) {
/* cannot use d-form */
DCHECK(scratch != no_reg);
mov(scratch, Operand(offset));
StorePUX(src, MemOperand(mem.ra(), scratch));
if (mem.rb() == no_reg) {
if (!is_int16(offset) || misaligned) {
/* cannot use d-form */
CHECK_NE(scratch, no_reg);
mov(scratch, Operand(offset));
stdux(src, MemOperand(mem.ra(), scratch));
} else {
stdu(src, mem);
}
} else {
#if V8_TARGET_ARCH_PPC64
stdu(src, mem);
#else
stwu(src, mem);
#endif
if (offset == 0) {
stdux(src, mem);
} else if (is_int16(offset)) {
CHECK_NE(scratch, no_reg);
addi(scratch, mem.rb(), Operand(offset));
stdux(src, MemOperand(mem.ra(), scratch));
} else {
CHECK_NE(scratch, no_reg);
mov(scratch, Operand(offset));
add(scratch, scratch, mem.rb());
stdux(src, MemOperand(mem.ra(), scratch));
}
}
}
......
......@@ -145,7 +145,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
Register scratch = no_reg);
void LoadS32(Register dst, const MemOperand& mem, Register scratch = no_reg);
void StoreU64(Register src, const MemOperand& mem, Register scratch = no_reg);
void StorePU(Register src, const MemOperand& mem, Register scratch = no_reg);
void StoreU64WithUpdate(Register src, const MemOperand& mem,
Register scratch = no_reg);
void LoadDouble(DoubleRegister dst, const MemOperand& mem,
Register scratch = no_reg);
......@@ -205,20 +206,20 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Push two registers. Pushes leftmost register first (to highest address).
void Push(Register src1, Register src2) {
StorePU(src2, MemOperand(sp, -2 * kSystemPointerSize));
StoreU64WithUpdate(src2, MemOperand(sp, -2 * kSystemPointerSize));
StoreU64(src1, MemOperand(sp, kSystemPointerSize));
}
// Push three registers. Pushes leftmost register first (to highest address).
void Push(Register src1, Register src2, Register src3) {
StorePU(src3, MemOperand(sp, -3 * kSystemPointerSize));
StoreU64WithUpdate(src3, MemOperand(sp, -3 * kSystemPointerSize));
StoreU64(src2, MemOperand(sp, kSystemPointerSize));
StoreU64(src1, MemOperand(sp, 2 * kSystemPointerSize));
}
// Push four registers. Pushes leftmost register first (to highest address).
void Push(Register src1, Register src2, Register src3, Register src4) {
StorePU(src4, MemOperand(sp, -4 * kSystemPointerSize));
StoreU64WithUpdate(src4, MemOperand(sp, -4 * kSystemPointerSize));
StoreU64(src3, MemOperand(sp, kSystemPointerSize));
StoreU64(src2, MemOperand(sp, 2 * kSystemPointerSize));
StoreU64(src1, MemOperand(sp, 3 * kSystemPointerSize));
......@@ -227,7 +228,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Push five registers. Pushes leftmost register first (to highest address).
void Push(Register src1, Register src2, Register src3, Register src4,
Register src5) {
StorePU(src5, MemOperand(sp, -5 * kSystemPointerSize));
StoreU64WithUpdate(src5, MemOperand(sp, -5 * kSystemPointerSize));
StoreU64(src4, MemOperand(sp, kSystemPointerSize));
StoreU64(src3, MemOperand(sp, 2 * kSystemPointerSize));
StoreU64(src2, MemOperand(sp, 3 * kSystemPointerSize));
......
......@@ -1769,8 +1769,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ StoreSimd128(i.InputSimd128Register(1), MemOperand(r0, sp));
break;
default:
__ StorePU(i.InputRegister(1), MemOperand(sp, -kSystemPointerSize),
r0);
__ StoreU64WithUpdate(i.InputRegister(1),
MemOperand(sp, -kSystemPointerSize), r0);
break;
}
frame_access_state()->IncreaseSPDelta(slots);
......@@ -1790,8 +1790,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
MemOperand(sp, -num_slots * kSystemPointerSize), r0);
}
} else {
__ StorePU(i.InputRegister(0),
MemOperand(sp, -num_slots * kSystemPointerSize), r0);
__ StoreU64WithUpdate(i.InputRegister(0),
MemOperand(sp, -num_slots * kSystemPointerSize),
r0);
}
break;
}
......
......@@ -788,7 +788,7 @@ Handle<HeapObject> RegExpMacroAssemblerPPC::GetCode(Handle<String> source) {
__ mtctr(r5);
Label init_loop;
__ bind(&init_loop);
__ StorePU(r3, MemOperand(r4, -kSystemPointerSize));
__ StoreU64WithUpdate(r3, MemOperand(r4, -kSystemPointerSize));
__ bdnz(&init_loop);
} else {
for (int i = 0; i < num_saved_registers_; i++) {
......@@ -1143,7 +1143,7 @@ void RegExpMacroAssemblerPPC::CallCheckStackGuardState(Register scratch) {
// Allocate frame with required slots to make ABI work.
__ li(r0, Operand::Zero());
__ StorePU(r0, MemOperand(sp, -stack_space * kSystemPointerSize));
__ StoreU64WithUpdate(r0, MemOperand(sp, -stack_space * kSystemPointerSize));
// RegExp code frame pointer.
__ mr(r5, frame_pointer());
......@@ -1269,7 +1269,8 @@ void RegExpMacroAssemblerPPC::SafeCallTarget(Label* name) {
void RegExpMacroAssemblerPPC::Push(Register source) {
DCHECK(source != backtrack_stackpointer());
__ StorePU(source, MemOperand(backtrack_stackpointer(), -kSystemPointerSize));
__ StoreU64WithUpdate(
source, MemOperand(backtrack_stackpointer(), -kSystemPointerSize));
}
......
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