Commit 30bcfba3 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [turbofan] Add the RoundInt32ToFloat32 operator to turbofan.

  port e06f7d78 (r33347)

  original commit message:
  The new operator converts an int32 input to float32. If the input cannot
  be represented exactly in float32, the value is rounded using the
  round-ties-even rounding mode (the default rounding mode).

  I provide implementations of the new operator for x64, ia32, arm, arm64,
  mips, mips64, ppc, and ppc64.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#33351}
parent 6faa6b31
......@@ -972,6 +972,20 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ lea(esp, Operand(esp, kDoubleSize));
break;
}
case kX87Int32ToFloat32: {
InstructionOperand* input = instr->InputAt(0);
DCHECK(input->IsRegister() || input->IsStackSlot());
__ fstp(0);
if (input->IsRegister()) {
Register input_reg = i.InputRegister(0);
__ push(input_reg);
__ fild_s(Operand(esp, 0));
__ pop(input_reg);
} else {
__ fild_s(i.InputOperand(0));
}
break;
}
case kX87Int32ToFloat64: {
InstructionOperand* input = instr->InputAt(0);
DCHECK(input->IsRegister() || input->IsStackSlot());
......
......@@ -53,6 +53,7 @@ namespace compiler {
V(X87Float64Max) \
V(X87Float64Min) \
V(X87Float64Abs) \
V(X87Int32ToFloat32) \
V(X87Int32ToFloat64) \
V(X87Float32ToFloat64) \
V(X87Uint32ToFloat64) \
......
......@@ -656,7 +656,9 @@ void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) {
void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) {
UNIMPLEMENTED();
X87OperandGenerator g(this);
Emit(kX87Int32ToFloat32, g.DefineAsFixed(node, stX_0),
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