Commit 7c37571c authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [turbofan] Add TruncateFloat32ToUint32 operator to Turbofan.

  port 2166bd8c (r33797)

  original commit message:

BUG=

Review URL: https://codereview.chromium.org/1697953002

Cr-Commit-Position: refs/heads/master@{#33969}
parent 70ea6bd6
......@@ -1209,6 +1209,26 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
}
break;
}
case kX87Float32ToUint32: {
if (!instr->InputAt(0)->IsDoubleRegister()) {
__ fld_s(i.InputOperand(0));
}
Label success;
__ TruncateX87TOSToI(i.OutputRegister(0));
__ test(i.OutputRegister(0), i.OutputRegister(0));
__ j(positive, &success);
__ push(Immediate(INT32_MIN));
__ fild_s(Operand(esp, 0));
__ lea(esp, Operand(esp, kPointerSize));
__ faddp();
__ TruncateX87TOSToI(i.OutputRegister(0));
__ or_(i.OutputRegister(0), Immediate(0x80000000));
__ bind(&success);
if (!instr->InputAt(0)->IsDoubleRegister()) {
__ fstp(0);
}
break;
}
case kX87Float64ToInt32: {
if (!instr->InputAt(0)->IsDoubleRegister()) {
__ fld_d(i.InputOperand(0));
......
......@@ -60,6 +60,7 @@ namespace compiler {
V(X87Uint32ToFloat64) \
V(X87Float64ToInt32) \
V(X87Float32ToInt32) \
V(X87Float32ToUint32) \
V(X87Float64ToFloat32) \
V(X87Float64ToUint32) \
V(X87Float64ExtractHighWord32) \
......
......@@ -691,7 +691,8 @@ void InstructionSelector::VisitTruncateFloat32ToInt32(Node* node) {
void InstructionSelector::VisitTruncateFloat32ToUint32(Node* node) {
UNIMPLEMENTED();
X87OperandGenerator g(this);
Emit(kX87Float32ToUint32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
}
......
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