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