Commit cbed76b7 authored by LiuYu's avatar LiuYu Committed by Commit Bot

[mips][liftoff]Fix some instructions

This fix the following instructions:
kExprI32SConvertF64 in mips32, RecordSpillsInSafepoint in mips32 and mips64.

Change-Id: I762fe4a7afa06fa8470fb0de932756a145d66099
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2605905
Auto-Submit: Liu yu <liuyu@loongson.cn>
Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71889}
parent d5662577
...@@ -1333,25 +1333,25 @@ bool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode, ...@@ -1333,25 +1333,25 @@ bool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode,
return true; return true;
} }
case kExprI32SConvertF64: { case kExprI32SConvertF64: {
if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && LiftoffRegister scratch =
IsFp64Mode()) { GetUnusedRegister(kGpReg, LiftoffRegList::ForRegs(dst));
LiftoffRegister rounded = LiftoffRegister scratch2 =
GetUnusedRegister(kFpReg, LiftoffRegList::ForRegs(src)); GetUnusedRegister(kGpReg, LiftoffRegList::ForRegs(dst, scratch));
LiftoffRegister converted_back =
GetUnusedRegister(kFpReg, LiftoffRegList::ForRegs(src, rounded)); // Clear cumulative exception flags and save the FCSR.
cfc1(scratch2.gp(), FCSR);
// Real conversion. ctc1(zero_reg, FCSR);
TurboAssembler::Trunc_d_d(rounded.fp(), src.fp()); // Try a conversion to a signed integer.
TurboAssembler::Trunc_w_d(kScratchDoubleReg, rounded.fp()); trunc_w_d(kScratchDoubleReg, src.fp());
mfc1(dst.gp(), kScratchDoubleReg); mfc1(dst.gp(), kScratchDoubleReg);
// Retrieve and restore the FCSR.
// Checking if trap. cfc1(scratch.gp(), FCSR);
cvt_d_w(converted_back.fp(), kScratchDoubleReg); ctc1(scratch2.gp(), FCSR);
TurboAssembler::CompareF64(EQ, rounded.fp(), converted_back.fp()); // Check for overflow and NaNs.
TurboAssembler::BranchFalseF(trap); And(scratch.gp(), scratch.gp(),
return true; kFCSROverflowFlagMask | kFCSRUnderflowFlagMask |
} kFCSRInvalidOpFlagMask);
bailout(kUnsupportedArchitecture, "kExprI32SConvertF64"); Branch(trap, ne, scratch.gp(), Operand(zero_reg));
return true; return true;
} }
case kExprI32UConvertF64: { case kExprI32UConvertF64: {
...@@ -2757,7 +2757,7 @@ void LiftoffAssembler::RecordSpillsInSafepoint(Safepoint& safepoint, ...@@ -2757,7 +2757,7 @@ void LiftoffAssembler::RecordSpillsInSafepoint(Safepoint& safepoint,
int spill_offset) { int spill_offset) {
int spill_space_size = 0; int spill_space_size = 0;
while (!all_spills.is_empty()) { while (!all_spills.is_empty()) {
LiftoffRegister reg = all_spills.GetLastRegSet(); LiftoffRegister reg = all_spills.GetFirstRegSet();
if (ref_spills.has(reg)) { if (ref_spills.has(reg)) {
safepoint.DefinePointerSlot(spill_offset); safepoint.DefinePointerSlot(spill_offset);
} }
......
...@@ -2898,14 +2898,8 @@ void LiftoffAssembler::RecordSpillsInSafepoint(Safepoint& safepoint, ...@@ -2898,14 +2898,8 @@ void LiftoffAssembler::RecordSpillsInSafepoint(Safepoint& safepoint,
LiftoffRegList ref_spills, LiftoffRegList ref_spills,
int spill_offset) { int spill_offset) {
int spill_space_size = 0; int spill_space_size = 0;
bool needs_padding =
(base::bits::CountPopulation(all_spills.GetGpList()) & 1) != 0;
if (needs_padding) {
spill_space_size += kSystemPointerSize;
++spill_offset;
}
while (!all_spills.is_empty()) { while (!all_spills.is_empty()) {
LiftoffRegister reg = all_spills.GetLastRegSet(); LiftoffRegister reg = all_spills.GetFirstRegSet();
if (ref_spills.has(reg)) { if (ref_spills.has(reg)) {
safepoint.DefinePointerSlot(spill_offset); safepoint.DefinePointerSlot(spill_offset);
} }
......
...@@ -365,13 +365,6 @@ ...@@ -365,13 +365,6 @@
'test-run-machops/RunFloat64MulAndFloat64Sub2': [SKIP], 'test-run-machops/RunFloat64MulAndFloat64Sub2': [SKIP],
}], # 'mips_arch_variant == r6' }], # 'mips_arch_variant == r6'
##############################################################################
['arch == mipsel and mips_arch_variant == r1', {
# For MIPS architecture release 1, conversion from double to int is unsupport
# on liftoff.
'test-gc/RunWasmLiftoff_NewDefault': [SKIP],
}], # 'arch == mipsel and mips_arch_variant == r1'
############################################################################## ##############################################################################
['system == android', { ['system == android', {
# Uses too much memory. # Uses too much memory.
......
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