Commit d783b763 authored by jacob.bramley's avatar jacob.bramley Committed by Commit bot

[arm64][turbofan] Fix implementation of Float64Min.

ARM64's `fmin` and `fmax` instructions don't have the same behaviour as
TurboFan's Float(32|64)(Min|Max) functions.

BUG=4206
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#29229}
parent 17b26fd2
......@@ -1282,24 +1282,16 @@ void InstructionSelector::VisitFloat64Mod(Node* node) {
}
void InstructionSelector::VisitFloat32Max(Node* node) {
VisitRRR(this, kArm64Float32Max, node);
}
void InstructionSelector::VisitFloat32Max(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitFloat64Max(Node* node) {
VisitRRR(this, kArm64Float64Max, node);
}
void InstructionSelector::VisitFloat64Max(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitFloat32Min(Node* node) {
VisitRRR(this, kArm64Float32Min, node);
}
void InstructionSelector::VisitFloat32Min(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitFloat64Min(Node* node) {
VisitRRR(this, kArm64Float64Min, node);
}
void InstructionSelector::VisitFloat64Min(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitFloat32Abs(Node* node) {
......@@ -2009,11 +2001,7 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
return MachineOperatorBuilder::kFloat32Max |
MachineOperatorBuilder::kFloat32Min |
MachineOperatorBuilder::kFloat64Max |
MachineOperatorBuilder::kFloat64Min |
MachineOperatorBuilder::kFloat64RoundDown |
return MachineOperatorBuilder::kFloat64RoundDown |
MachineOperatorBuilder::kFloat64RoundTruncate |
MachineOperatorBuilder::kFloat64RoundTiesAway |
MachineOperatorBuilder::kWord32ShiftIsSafe |
......
......@@ -88,6 +88,8 @@ class MachineOperatorBuilder final : public ZoneObject {
// for operations that are unsupported by some back-ends.
enum Flag {
kNoFlags = 0u,
// Note that Float*Max behaves like `(a < b) ? b : a`, not like Math.max().
// Note that Float*Min behaves like `(a < b) ? a : b`, not like Math.min().
kFloat32Max = 1u << 0,
kFloat32Min = 1u << 1,
kFloat64Max = 1u << 2,
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function Module(stdlib) {
"use asm";
function TernaryMin(a, b) {
a=+(a);
b=+(b);
return (+((a < b) ? a : b));
}
function TernaryMax(a, b) {
a=+(a);
b=+(b);
return (+((b < a) ? a : b));
}
return { TernaryMin: TernaryMin,
TernaryMax: TernaryMax };
}
var min = Module(this).TernaryMin;
var max = Module(this).TernaryMax;
assertEquals(0.0, min(-0.0, 0.0));
assertEquals(0.0, min(NaN, 0.0));
assertEquals(-0.0, min(NaN, -0.0));
assertEquals(-0.0, max(0.0, -0.0));
assertEquals(0.0, max(NaN, 0.0));
assertEquals(-0.0, max(NaN, -0.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