X87: [turbofan] Add TruncateFloat32ToUint32 operator to Turbofan.

port 2166bd8ce5 (r33797)

  original commit message:

BUG=

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

Cr-Commit-Position: refs/heads/master@{#33969}
This commit is contained in:
zhengxing.li 2016-02-14 22:36:25 -08:00 committed by Commit bot
parent 70ea6bd6de
commit 7c37571c39
3 changed files with 23 additions and 1 deletions

View File

@ -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));

View File

@ -60,6 +60,7 @@ namespace compiler {
V(X87Uint32ToFloat64) \
V(X87Float64ToInt32) \
V(X87Float32ToInt32) \
V(X87Float32ToUint32) \
V(X87Float64ToFloat32) \
V(X87Float64ToUint32) \
V(X87Float64ExtractHighWord32) \

View File

@ -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)));
}