Commit 6a34bd2b authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[mips] implement kArchStackPointerGreaterThan in AssembleArchBoolean

Besides, move the comparison of sp and input in kArchStackPointerGreaterThan
to AssembleArchInstruction from AssembleBranchToLabels.

Change-Id: Id2715ce89c673d16c94f1d9d7736644983c64248
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2882856
Auto-Submit: Liu yu <liuyu@loongson.cn>
Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#74462}
parent a44685da
...@@ -873,9 +873,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -873,9 +873,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kArchRet: case kArchRet:
AssembleReturn(instr->InputAt(0)); AssembleReturn(instr->InputAt(0));
break; break;
case kArchStackPointerGreaterThan: case kArchStackPointerGreaterThan: {
// Pseudo-instruction used for cmp/branch. No opcode emitted here. Register lhs_register = sp;
uint32_t offset;
if (ShouldApplyOffsetToStackCheck(instr, &offset)) {
lhs_register = i.TempRegister(0);
__ Subu(lhs_register, sp, offset);
}
__ Sltu(i.OutputRegister(), i.InputRegister(0), lhs_register);
break; break;
}
case kArchStackCheckOffset: case kArchStackCheckOffset:
__ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset())); __ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset()));
break; break;
...@@ -3704,13 +3711,11 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm, ...@@ -3704,13 +3711,11 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm,
__ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
} else if (instr->arch_opcode() == kArchStackPointerGreaterThan) { } else if (instr->arch_opcode() == kArchStackPointerGreaterThan) {
cc = FlagsConditionToConditionCmp(condition); cc = FlagsConditionToConditionCmp(condition);
Register lhs_register = sp; DCHECK((cc == ls) || (cc == hi));
uint32_t offset; if (cc == ls) {
if (gen->ShouldApplyOffsetToStackCheck(instr, &offset)) { __ xori(i.OutputRegister(), i.OutputRegister(), 1);
lhs_register = i.TempRegister(0);
__ Subu(lhs_register, sp, offset);
} }
__ Branch(tlabel, cc, lhs_register, Operand(i.InputRegister(0))); __ Branch(tlabel, ne, i.OutputRegister(), Operand(zero_reg));
} else if (instr->arch_opcode() == kMipsCmpS || } else if (instr->arch_opcode() == kMipsCmpS ||
instr->arch_opcode() == kMipsCmpD) { instr->arch_opcode() == kMipsCmpD) {
bool predicate; bool predicate;
...@@ -4020,6 +4025,13 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, ...@@ -4020,6 +4025,13 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
} }
} }
return; return;
} else if (instr->arch_opcode() == kArchStackPointerGreaterThan) {
cc = FlagsConditionToConditionCmp(condition);
DCHECK((cc == ls) || (cc == hi));
if (cc == ls) {
__ xori(i.OutputRegister(), i.OutputRegister(), 1);
}
return;
} else { } else {
PrintF("AssembleArchBoolean Unimplemented arch_opcode is : %d\n", PrintF("AssembleArchBoolean Unimplemented arch_opcode is : %d\n",
instr->arch_opcode()); instr->arch_opcode());
......
...@@ -835,9 +835,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -835,9 +835,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kArchRet: case kArchRet:
AssembleReturn(instr->InputAt(0)); AssembleReturn(instr->InputAt(0));
break; break;
case kArchStackPointerGreaterThan: case kArchStackPointerGreaterThan: {
// Pseudo-instruction used for cmp/branch. No opcode emitted here. Register lhs_register = sp;
uint32_t offset;
if (ShouldApplyOffsetToStackCheck(instr, &offset)) {
lhs_register = i.TempRegister(0);
__ Dsubu(lhs_register, sp, offset);
}
__ Sltu(i.OutputRegister(), i.InputRegister(0), lhs_register);
break; break;
}
case kArchStackCheckOffset: case kArchStackCheckOffset:
__ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset())); __ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset()));
break; break;
...@@ -3880,13 +3887,11 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm, ...@@ -3880,13 +3887,11 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm,
__ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
} else if (instr->arch_opcode() == kArchStackPointerGreaterThan) { } else if (instr->arch_opcode() == kArchStackPointerGreaterThan) {
cc = FlagsConditionToConditionCmp(condition); cc = FlagsConditionToConditionCmp(condition);
Register lhs_register = sp; DCHECK((cc == ls) || (cc == hi));
uint32_t offset; if (cc == ls) {
if (gen->ShouldApplyOffsetToStackCheck(instr, &offset)) { __ xori(i.OutputRegister(), i.OutputRegister(), 1);
lhs_register = i.TempRegister(0);
__ Dsubu(lhs_register, sp, offset);
} }
__ Branch(tlabel, cc, lhs_register, Operand(i.InputRegister(0))); __ Branch(tlabel, ne, i.OutputRegister(), Operand(zero_reg));
} else if (instr->arch_opcode() == kMips64CmpS || } else if (instr->arch_opcode() == kMips64CmpS ||
instr->arch_opcode() == kMips64CmpD) { instr->arch_opcode() == kMips64CmpD) {
bool predicate; bool predicate;
...@@ -4232,6 +4237,13 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, ...@@ -4232,6 +4237,13 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
} }
} }
return; return;
} else if (instr->arch_opcode() == kArchStackPointerGreaterThan) {
cc = FlagsConditionToConditionCmp(condition);
DCHECK((cc == ls) || (cc == hi));
if (cc == ls) {
__ xori(i.OutputRegister(), i.OutputRegister(), 1);
}
return;
} else { } else {
PrintF("AssembleArchBranch Unimplemented arch_opcode is : %d\n", PrintF("AssembleArchBranch Unimplemented arch_opcode is : %d\n",
instr->arch_opcode()); instr->arch_opcode());
......
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