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

ppc: [liftoff] more conversion from float to int

Change-Id: Ie3778dfc1b477a234399d58dd78ef1a3c1195b4d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3166250Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#76888}
parent 6ff9c686
......@@ -1180,6 +1180,78 @@ bool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode,
boverflow(trap, cr7);
return true;
}
case kExprI32SConvertSatF64:
case kExprI32SConvertSatF32: {
Label done, src_is_nan;
LoadDoubleLiteral(kScratchDoubleReg, base::Double(0.0), r0);
fcmpu(src.fp(), kScratchDoubleReg);
bunordered(&src_is_nan);
mtfsb0(VXCVI); // clear FPSCR:VXCVI bit
fctiwz(kScratchDoubleReg, src.fp());
MovDoubleLowToInt(dst.gp(), kScratchDoubleReg);
b(&done);
bind(&src_is_nan);
mov(dst.gp(), Operand::Zero());
bind(&done);
return true;
}
case kExprI32UConvertSatF64:
case kExprI32UConvertSatF32: {
Label done, src_is_nan;
LoadDoubleLiteral(kScratchDoubleReg, base::Double(0.0), r0);
fcmpu(src.fp(), kScratchDoubleReg);
bunordered(&src_is_nan);
mtfsb0(VXCVI); // clear FPSCR:VXCVI bit
fctiwuz(kScratchDoubleReg, src.fp());
MovDoubleLowToInt(dst.gp(), kScratchDoubleReg);
b(&done);
bind(&src_is_nan);
mov(dst.gp(), Operand::Zero());
bind(&done);
return true;
}
case kExprI64SConvertSatF64:
case kExprI64SConvertSatF32: {
Label done, src_is_nan;
LoadDoubleLiteral(kScratchDoubleReg, base::Double(0.0), r0);
fcmpu(src.fp(), kScratchDoubleReg);
bunordered(&src_is_nan);
mtfsb0(VXCVI); // clear FPSCR:VXCVI bit
fctidz(kScratchDoubleReg, src.fp());
MovDoubleToInt64(dst.gp(), kScratchDoubleReg);
b(&done);
bind(&src_is_nan);
mov(dst.gp(), Operand::Zero());
bind(&done);
return true;
}
case kExprI64UConvertSatF64:
case kExprI64UConvertSatF32: {
Label done, src_is_nan;
LoadDoubleLiteral(kScratchDoubleReg, base::Double(0.0), r0);
fcmpu(src.fp(), kScratchDoubleReg);
bunordered(&src_is_nan);
mtfsb0(VXCVI); // clear FPSCR:VXCVI bit
fctiduz(kScratchDoubleReg, src.fp());
MovDoubleToInt64(dst.gp(), kScratchDoubleReg);
b(&done);
bind(&src_is_nan);
mov(dst.gp(), Operand::Zero());
bind(&done);
return true;
}
default:
break;
}
......
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