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(
case kArchRet:
AssembleReturn(instr->InputAt(0));
break;
case kArchStackPointerGreaterThan:
// Pseudo-instruction used for cmp/branch. No opcode emitted here.
case kArchStackPointerGreaterThan: {
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;
}
case kArchStackCheckOffset:
__ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset()));
break;
......@@ -3704,13 +3711,11 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm,
__ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
} else if (instr->arch_opcode() == kArchStackPointerGreaterThan) {
cc = FlagsConditionToConditionCmp(condition);
Register lhs_register = sp;
uint32_t offset;
if (gen->ShouldApplyOffsetToStackCheck(instr, &offset)) {
lhs_register = i.TempRegister(0);
__ Subu(lhs_register, sp, offset);
DCHECK((cc == ls) || (cc == hi));
if (cc == ls) {
__ xori(i.OutputRegister(), i.OutputRegister(), 1);
}
__ Branch(tlabel, cc, lhs_register, Operand(i.InputRegister(0)));
__ Branch(tlabel, ne, i.OutputRegister(), Operand(zero_reg));
} else if (instr->arch_opcode() == kMipsCmpS ||
instr->arch_opcode() == kMipsCmpD) {
bool predicate;
......@@ -4020,6 +4025,13 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
}
}
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 {
PrintF("AssembleArchBoolean Unimplemented arch_opcode is : %d\n",
instr->arch_opcode());
......
......@@ -835,9 +835,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kArchRet:
AssembleReturn(instr->InputAt(0));
break;
case kArchStackPointerGreaterThan:
// Pseudo-instruction used for cmp/branch. No opcode emitted here.
case kArchStackPointerGreaterThan: {
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;
}
case kArchStackCheckOffset:
__ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset()));
break;
......@@ -3880,13 +3887,11 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm,
__ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
} else if (instr->arch_opcode() == kArchStackPointerGreaterThan) {
cc = FlagsConditionToConditionCmp(condition);
Register lhs_register = sp;
uint32_t offset;
if (gen->ShouldApplyOffsetToStackCheck(instr, &offset)) {
lhs_register = i.TempRegister(0);
__ Dsubu(lhs_register, sp, offset);
DCHECK((cc == ls) || (cc == hi));
if (cc == ls) {
__ xori(i.OutputRegister(), i.OutputRegister(), 1);
}
__ Branch(tlabel, cc, lhs_register, Operand(i.InputRegister(0)));
__ Branch(tlabel, ne, i.OutputRegister(), Operand(zero_reg));
} else if (instr->arch_opcode() == kMips64CmpS ||
instr->arch_opcode() == kMips64CmpD) {
bool predicate;
......@@ -4232,6 +4237,13 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
}
}
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 {
PrintF("AssembleArchBranch Unimplemented arch_opcode is : %d\n",
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