Commit 5319e928 authored by Junliang Yan's avatar Junliang Yan Committed by V8 LUCI CQ

PPC: replace LoadPX with LoadU64

Change-Id: I24081a3fe941d083cefa782d4ba712acf7776980
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2905766
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@{#74685}
parent c7cd212f
...@@ -1192,8 +1192,8 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { ...@@ -1192,8 +1192,8 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ lbzx(r6, MemOperand(kInterpreterBytecodeArrayRegister, __ lbzx(r6, MemOperand(kInterpreterBytecodeArrayRegister,
kInterpreterBytecodeOffsetRegister)); kInterpreterBytecodeOffsetRegister));
__ ShiftLeftImm(r6, r6, Operand(kSystemPointerSizeLog2)); __ ShiftLeftImm(r6, r6, Operand(kSystemPointerSizeLog2));
__ LoadPX(kJavaScriptCallCodeStartRegister, __ LoadU64(kJavaScriptCallCodeStartRegister,
MemOperand(kInterpreterDispatchTableRegister, r6)); MemOperand(kInterpreterDispatchTableRegister, r6));
__ Call(kJavaScriptCallCodeStartRegister); __ Call(kJavaScriptCallCodeStartRegister);
masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset());
...@@ -1470,8 +1470,8 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) { ...@@ -1470,8 +1470,8 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
__ lbzx(ip, MemOperand(kInterpreterBytecodeArrayRegister, __ lbzx(ip, MemOperand(kInterpreterBytecodeArrayRegister,
kInterpreterBytecodeOffsetRegister)); kInterpreterBytecodeOffsetRegister));
__ ShiftLeftImm(scratch, scratch, Operand(kSystemPointerSizeLog2)); __ ShiftLeftImm(scratch, scratch, Operand(kSystemPointerSizeLog2));
__ LoadPX(kJavaScriptCallCodeStartRegister, __ LoadU64(kJavaScriptCallCodeStartRegister,
MemOperand(kInterpreterDispatchTableRegister, scratch)); MemOperand(kInterpreterDispatchTableRegister, scratch));
__ Jump(kJavaScriptCallCodeStartRegister); __ Jump(kJavaScriptCallCodeStartRegister);
} }
...@@ -2014,7 +2014,7 @@ void Builtins::Generate_CallOrConstructForwardVarargs(MacroAssembler* masm, ...@@ -2014,7 +2014,7 @@ void Builtins::Generate_CallOrConstructForwardVarargs(MacroAssembler* masm,
{ {
__ subi(r8, r8, Operand(1)); __ subi(r8, r8, Operand(1));
__ ShiftLeftImm(scratch, r8, Operand(kSystemPointerSizeLog2)); __ ShiftLeftImm(scratch, r8, Operand(kSystemPointerSizeLog2));
__ LoadPX(r0, MemOperand(r7, scratch)); __ LoadU64(r0, MemOperand(r7, scratch));
__ StorePX(r0, MemOperand(r5, scratch)); __ StorePX(r0, MemOperand(r5, scratch));
__ cmpi(r8, Operand::Zero()); __ cmpi(r8, Operand::Zero());
__ bne(&loop); __ bne(&loop);
......
...@@ -2673,25 +2673,40 @@ void MacroAssembler::AndSmiLiteral(Register dst, Register src, Smi smi, ...@@ -2673,25 +2673,40 @@ void MacroAssembler::AndSmiLiteral(Register dst, Register src, Smi smi,
// Load a "pointer" sized value from the memory location // Load a "pointer" sized value from the memory location
void TurboAssembler::LoadU64(Register dst, const MemOperand& mem, void TurboAssembler::LoadU64(Register dst, const MemOperand& mem,
Register scratch) { Register scratch) {
DCHECK_EQ(mem.rb(), no_reg);
int offset = mem.offset(); int offset = mem.offset();
int misaligned = (offset & 3); if (mem.rb() == no_reg) {
int adj = (offset & 3) - 4; int misaligned = (offset & 3);
int alignedOffset = (offset & ~3) + 4; int adj = (offset & 3) - 4;
int alignedOffset = (offset & ~3) + 4;
if (!is_int16(offset) || (misaligned && !is_int16(alignedOffset))) {
/* cannot use d-form */ if (!is_int16(offset) || (misaligned && !is_int16(alignedOffset))) {
mov(scratch, Operand(offset)); /* cannot use d-form */
LoadPX(dst, MemOperand(mem.ra(), scratch)); CHECK_NE(scratch, no_reg);
mov(scratch, Operand(offset));
ldx(dst, MemOperand(mem.ra(), scratch));
} else {
if (misaligned) {
// adjust base to conform to offset alignment requirements
// Todo: enhance to use scratch if dst is unsuitable
DCHECK_NE(dst, r0);
addi(dst, mem.ra(), Operand(adj));
ld(dst, MemOperand(dst, alignedOffset));
} else {
ld(dst, mem);
}
}
} else { } else {
if (misaligned) { if (offset == 0) {
// adjust base to conform to offset alignment requirements ldx(dst, mem);
// Todo: enhance to use scratch if dst is unsuitable } else if (is_int16(offset)) {
DCHECK_NE(dst, r0); CHECK_NE(scratch, no_reg);
addi(dst, mem.ra(), Operand(adj)); addi(scratch, mem.rb(), Operand(offset));
ld(dst, MemOperand(dst, alignedOffset)); ldx(dst, mem);
} else { } else {
ld(dst, mem); CHECK_NE(scratch, no_reg);
mov(scratch, Operand(offset));
add(scratch, scratch, mem.rb());
ldx(dst, MemOperand(mem.ra(), scratch));
} }
} }
} }
...@@ -3221,7 +3236,7 @@ void TurboAssembler::LoadEntryFromBuiltinIndex(Register builtin_index) { ...@@ -3221,7 +3236,7 @@ void TurboAssembler::LoadEntryFromBuiltinIndex(Register builtin_index) {
} }
addi(builtin_index, builtin_index, addi(builtin_index, builtin_index,
Operand(IsolateData::builtin_entry_table_offset())); Operand(IsolateData::builtin_entry_table_offset()));
LoadPX(builtin_index, MemOperand(kRootRegister, builtin_index)); LoadU64(builtin_index, MemOperand(kRootRegister, builtin_index));
} }
void TurboAssembler::CallBuiltinByIndex(Register builtin_index) { void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
......
...@@ -38,7 +38,6 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg, ...@@ -38,7 +38,6 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,
// These exist to provide portability between 32 and 64bit // These exist to provide portability between 32 and 64bit
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
#define LoadPX ldx
#define LoadPUX ldux #define LoadPUX ldux
#define StorePX stdx #define StorePX stdx
#define StorePUX stdux #define StorePUX stdux
...@@ -51,7 +50,6 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg, ...@@ -51,7 +50,6 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,
#define ShiftRight_ srd #define ShiftRight_ srd
#define ShiftRightArith srad #define ShiftRightArith srad
#else #else
#define LoadPX lwzx
#define LoadPUX lwzux #define LoadPUX lwzux
#define StorePX stwx #define StorePX stwx
#define StorePUX stwux #define StorePUX stwux
......
...@@ -4000,7 +4000,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { ...@@ -4000,7 +4000,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
__ bge(GetLabel(i.InputRpo(1))); __ bge(GetLabel(i.InputRpo(1)));
__ mov_label_addr(kScratchReg, table); __ mov_label_addr(kScratchReg, table);
__ ShiftLeftImm(r0, input, Operand(kSystemPointerSizeLog2)); __ ShiftLeftImm(r0, input, Operand(kSystemPointerSizeLog2));
__ LoadPX(kScratchReg, MemOperand(kScratchReg, r0)); __ LoadU64(kScratchReg, MemOperand(kScratchReg, r0));
__ Jump(kScratchReg); __ Jump(kScratchReg);
} }
......
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