Commit a0134a6d authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [turbofan] Added the optional Float64RoundTiesEven operator to turbofan.

  port dffecf31 (r32005)

  original commit message:
  The TiesEven rounding mode rounds float64 numbers to the nearest
  integer. If there are two nearest integers, then the number is rounded
  to the even one.  This is the default rounding mode according to
  IEEE~754.

  I implemented the operator on ia32, x64, arm, arm64, mips, and mips64.

  I think there is a bug in the current implementation of the ppc
  simulator, which kept me from implementing the operator on ppc.
  According to my understanding of the ppc instruction manual, the FRIN
  instruction provides the right behavior for Float64RoundTiesEven. In the
  simulator, however, FRIN provides a different semantics. If there are
  two nearest integers, then the simulator returns the one which is
  further away form 0.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#32490}
parent 48795506
......@@ -885,7 +885,9 @@ void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) {
void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) {
UNREACHABLE();
X87OperandGenerator g(this);
Emit(kX87Float64Round | MiscField::encode(kRoundToNearest),
g.UseFixed(node, stX_0), g.Use(node->InputAt(0)));
}
......@@ -1307,7 +1309,8 @@ InstructionSelector::SupportedMachineOperatorFlags() {
flags |= MachineOperatorBuilder::kFloat64RoundDown |
MachineOperatorBuilder::kFloat64RoundUp |
MachineOperatorBuilder::kFloat64RoundTruncate;
MachineOperatorBuilder::kFloat64RoundTruncate |
MachineOperatorBuilder::kFloat64RoundTiesEven;
return flags;
}
......
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